Mercurial > hip
changeset 10:8f6b1c89d8de
With the basic demo functionality ready to go, I added a list of What To Do Next.
author | jonathandicarlo@jonathan-dicarlos-macbook-pro.local |
---|---|
date | Wed, 14 May 2008 22:08:44 -0700 |
parents | d5699c104b48 |
children | 9e18b8d8c936 |
files | hip.js |
diffstat | 1 files changed, 36 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/hip.js Wed May 14 15:11:30 2008 -0700 +++ b/hip.js Wed May 14 22:08:44 2008 -0700 @@ -53,6 +53,8 @@ var person = new NounType( "person", ["atul@mozilla.com", "aza@mozilla.com", "thunder@mozilla.com", "chris@mozilla.com", "myk@mozilla.com" ] ); +var application = new NounType( "application", ["firefox", "safari", "opera", "internet explorer", "paint.net", "notepad"] ); + var anyWord = { // a singleton object which can be used in place of a NounType. _name: "text", @@ -322,15 +324,18 @@ } return "Launch a nuclear missile at " + directObject; }; -var open = new Verb( "open", "url", anyWord, {} ); +var open = new Verb( "open", "url", anyWord, { "with": application } ); open.getDescription = function( directObject, mods ) { if (directObject ) { - return "Open the URL "" + directObject + """; + var desc = "Open the URL "" + directObject + """; } else { - return "Open a given URL."; + var desc = "Open a given URL"; } + if ( mods["with"] ) { + desc += " using the application "" + mods["with"] + """; + } + return desc; }; - var email = new Verb( "email", "text", anyWord, { "to": person, "subject": anyWord } ); email.getDescription = function( directObject, mods ) { if (directObject ) { @@ -527,7 +532,6 @@ default: gQs.updateSuggestionList( event.target.value ); break; - // todo: delete key "unlocks" if you delete past a space? } updateDisplay(); @@ -544,3 +548,30 @@ ); }); +/* Where to go next: + +1. Noun-first completions. If you type "london", it matches no verb, so +the parser looks at the known noun categories, sees that "london" could be +a city, and then looks for verbs that take cities and suggests +fly to london +fly from london +nuke london + +2. If you have a selection, put the magic word "this" ( or "selection" ) into your sentence to indicate where you want the selection to go, e.g. +email this to aza (with content selected) +vs +email hello there to this (with an email address selected) + +3. Allow the possibility of a multiple-word indirect-object + +4. Preview output of topmost or hilited command, as you type. + +5. When a command is executed, put its output in a special buffer that forms +the implicit selection for the next command. In this way commands can be +chained conversationally, without the need for a special word or key to +link them together. + +6. More complex datatypes, like dates, that allow for multiple input formats. +( see http://www.datejs.com/ ) + +*/