Skip to content

Instantly share code, notes, and snippets.

@imlucas
Created September 3, 2008 22:42
Show Gist options
  • Save imlucas/8683 to your computer and use it in GitHub Desktop.
Save imlucas/8683 to your computer and use it in GitHub Desktop.
var noun_type_flexclass = {
_name: "class name",
suggest: function( text, html ) {
var suggestions = [CmdUtils.makeSugg(text)];
return suggestions;
}
}
var FIRST_CLASS_NAME;
CmdUtils.CreateCommand({
name: "flexdoc",
takes: {flexclass: noun_type_flexclass},
locale: "en-US",
homepage: "http://amiestreet.com",
author: {name: "Lucas", email: "lucas@amiestreet.com"},
icon: "http://livedocs.adobe.com/favicon.ico",
preview: function(pblock, directObject) {
searchText = jQuery.trim(directObject.text);
pblock.innerHTML = 'Loading...';
var url = 'http://as3reference.appspot.com/getapi?version=flex3&api='+directObject.text;
jQuery.ajax({
type: "GET",
url: url,
dataType: "json",
error: function() {
displayMessage("Could not get suggestions");
},
success: function(data) {
var h = '';
FIRST_CLASS_NAME = data.items[0];
jQuery.each(data.items, function(){
h += '<a href="http://livedocs.adobe.com/flex/3/langref/'+this.path+'">'+this.name+'</a><br />';
});
h += '';
pblock.innerHTML = h;
}
});
},
execute: function(directObject) {
Utils.openUrlInBrowser('http://livedocs.adobe.com/flex/3/langref/'+FIRST_CLASS_NAME.path);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment