Created
September 3, 2008 22:42
-
-
Save imlucas/8683 to your computer and use it in GitHub Desktop.
This file contains hidden or 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_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: "[email protected]"}, | |
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