Created
July 21, 2009 12:23
-
-
Save esquifit/151313 to your computer and use it in GitHub Desktop.
Hybrid Ubiquity command for parser 1 and 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var noun_type_fooCommand = { | |
suggest: function( text, html ) { | |
var suggestions = []; | |
suggestions.push( CmdUtils.makeSugg('foo', 'foo', 'foo') ); | |
suggestions.push( CmdUtils.makeSugg('bar', 'bar', 'bar') ); | |
suggestions.push( CmdUtils.makeSugg('baz', 'baz', 'baz') ); | |
return suggestions; | |
} | |
} | |
CmdUtils.CreateCommand({ | |
name: "foobar", | |
names: ["foobar"], | |
author: (CmdUtils.parserVersion == 2) ? {name: "esquifit"} : "esquifit", | |
takes: {"Some foostring": noun_type_fooCommand }, | |
arguments: [{role: "object", | |
label: "Some foostring", | |
nountype: noun_type_fooCommand}], | |
description: "Hybrid foo command", | |
execute: function( arg ) { | |
var data = (CmdUtils.parserVersion == 2) ? arg.object.data : arg.data; | |
displayMessage(data); | |
}, | |
preview: function( pblock, {object} ) { | |
var text = (CmdUtils.parserVersion == 2) ? object.text : object; | |
pblock.innerHTML = "Text: " + text ; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment