Created
September 4, 2008 14:17
-
-
Save imlucas/8780 to your computer and use it in GitHub Desktop.
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_flexclassname = { | |
_name: "class name", | |
suggest: function( text, html ) { | |
var suggestions = [CmdUtils.makeSugg(text)]; | |
return suggestions; | |
} | |
} | |
var __FLEXDOC_FIRST_CLASS_NAME; | |
CmdUtils.CreateCommand({ | |
name: "flexdoc", | |
takes: {classname: noun_type_flexclassname}, | |
locale: "en-US", | |
description: 'Pulls in data from <a href="http://www.mikechambers.com/blog/2008/09/03/actionscript-3-api-service-on-google-app-engine/">Mike Chambers AS3 Reference API</a> to make it as simple as possible to get to the livedocs page for any AS3 class.', | |
author: {name: "Lucas Hrabovsky"}, | |
icon: "http://livedocs.adobe.com/favicon.ico", | |
preview: function(pblock, directObject) { | |
searchText = jQuery.trim(directObject.text); | |
if(searchText.length < 2) { | |
pblock.innerHTML = "Get to livedocs for a class"; | |
return; | |
} | |
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 = ''; | |
__FLEXDOC_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/'+__FLEXDOC_FIRST_CLASS_NAME.path); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment