annotate verbs.js @ 18:5fce4c8f3ebd

Preliminary version of date stuff added
author jonathandicarlo@jonathan-dicarlos-macbook-pro.local
date Tue, 15 Jul 2008 14:10:17 -0700
parents 8dcc88f93829
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
1 var fly = new Verb( "fly", null, null, { "from": city, "to": city } );
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
2 fly.getDescription = function( directObject, mods ) {
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
3 var fromCity = mods[ "from" ];
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
4 var toCity = mods["to"];
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
5 if ( !fromCity ) {
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
6 fromCity = "from somewhere";
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
7 }
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
8 if ( !toCity ) {
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
9 toCity = "to somewhere else";
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
10 }
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
11 return "Buy airplane tickets from " + fromCity + " to " + toCity;
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
12 };
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
13 var define = new Verb( "define", "word", anyWord, {} );
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
14 define.getDescription = function( directObject, mods ) {
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
15 if (directObject ) {
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
16 return "Search for definition of the word "" + directObject + """;
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
17 } else {
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
18 return "Search for the definition of a word.";
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
19 }
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
20 };
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
21 var google = new Verb( "google", "word", anyWord, {} );
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
22 google.getDescription = function( directObject, mods ) {
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
23 if (directObject ) {
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
24 return "Search Google for "" + directObject + """;
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
25 } else {
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
26 return "Search Google for a word or phrase.";
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
27 }
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
28 };
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
29 var go = new Verb( "go", "tab", tab, {} );
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
30 go.getDescription = function( directObject, mods ) {
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
31 if (directObject ) {
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
32 return "Switch to the Firefox tab "" + directObject + """;
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
33 } else {
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
34 return "Search to a given Firefox tab.";
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
35 }
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
36 };
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
37 var close = new Verb( "close", null, null, {} );
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
38 close.getDescription = function( directObject, mods ) {
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
39 return "Close the front window or tab.";
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
40 };
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
41 var translate = new Verb( "translate", "text", anyWord, { "from": language, "to": language } );
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
42 translate.getDescription = function( directObject, mods ) {
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
43 if (directObject ) {
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
44 var DO = "the phrase "" + directObject + """;
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
45 } else {
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
46 var DO = "a given phrase";
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
47 }
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
48 var fromLang = mods["from"];
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
49 if (!fromLang) {
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
50 fromLang = "a given language";
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
51 }
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
52 var toLang = mods["to"];
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
53 if (!fromLang) {
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
54 toLang = "another language.";
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
55 }
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
56 return "Translate " + DO + " from " + fromLang + " to " + toLang;
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
57 };
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
58 var nuke = new Verb( "nuke", "city", city, {} );
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
59 nuke.getDescription = function( directObject, mods ) {
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
60 if (!directObject) {
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
61 directObject = "a given city";
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
62 }
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
63 return "Launch a nuclear missile at " + directObject;
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
64 };
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
65 var open = new Verb( "open", "url", anyWord, { "with": application } );
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
66 open.getDescription = function( directObject, mods ) {
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
67 if (directObject ) {
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
68 var desc = "Open the URL "" + directObject + """;
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
69 } else {
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
70 var desc = "Open a given URL";
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
71 }
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
72 if ( mods["with"] ) {
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
73 desc += " using the application "" + mods["with"] + """;
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
74 }
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
75 return desc;
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
76 };
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
77 var email = new Verb( "email", "text", anyWord, { "to": person, "subject": anyWord } );
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
78 email.getDescription = function( directObject, mods ) {
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
79 if (directObject ) {
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
80 var DO = "the message "" + directObject + "" as an email";
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
81 } else {
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
82 var DO = "an email";
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
83 }
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
84 var target = mods["to"];
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
85 if ( !target ) {
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
86 target = "someone from your address book";
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
87 }
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
88 if ( mods["subject"] ) {
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
89 var subject = ", with the subject " + mods["subject"] + ", ";
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
90 } else {
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
91 var subject = " ";
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
92 }
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
93 return "Send " + DO + subject + "to " + target;
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
94 };
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
95
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
96 var encrypt = new Verb( "encrypt", "text", anyWord, { "for": person } );
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
97 encrypt.getDescription = function( directObject, mods ) {
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
98 if (directObject ) {
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
99 var DO = "the message "" + directObject + """;
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
100 } else {
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
101 var DO = "a secret message";
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
102 }
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
103 var target = mods["for"];
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
104 if ( !target ) {
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
105 target = "one particular person";
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
106 }
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
107 return "Encrypt " + DO + " so it can only be read by " + target;
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
108 };
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
109
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
110 var wiki = new Verb( "wikipedia", "word", anyWord, { "language": language } );
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
111 wiki.getDescription = function( directObject, mods ) {
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
112 var desc = "Search ";
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
113 if ( mods["language"] ) {
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
114 desc = desc + "the " + mods["language"] + " language version of ";
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
115 }
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
116 desc = desc + "Wikipedia for "" + directObject + """;
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
117 return desc;
8dcc88f93829 Broke up hip.js into some smaller js files
jonathandicarlo@localhost
parents:
diff changeset
118 };
18
5fce4c8f3ebd Preliminary version of date stuff added
jonathandicarlo@jonathan-dicarlos-macbook-pro.local
parents: 13
diff changeset
119
5fce4c8f3ebd Preliminary version of date stuff added
jonathandicarlo@jonathan-dicarlos-macbook-pro.local
parents: 13
diff changeset
120 var calendarize = new Verb( "calendarize", "date", DateNounType, {} );
5fce4c8f3ebd Preliminary version of date stuff added
jonathandicarlo@jonathan-dicarlos-macbook-pro.local
parents: 13
diff changeset
121 calendarize.getDescription = function( directObject, mods ) {
5fce4c8f3ebd Preliminary version of date stuff added
jonathandicarlo@jonathan-dicarlos-macbook-pro.local
parents: 13
diff changeset
122 return "Add event to your calendar on " + directObject;
5fce4c8f3ebd Preliminary version of date stuff added
jonathandicarlo@jonathan-dicarlos-macbook-pro.local
parents: 13
diff changeset
123 }
5fce4c8f3ebd Preliminary version of date stuff added
jonathandicarlo@jonathan-dicarlos-macbook-pro.local
parents: 13
diff changeset
124
5fce4c8f3ebd Preliminary version of date stuff added
jonathandicarlo@jonathan-dicarlos-macbook-pro.local
parents: 13
diff changeset
125 // email mapping