Created
October 21, 2008 15:05
-
-
Save jasonroelofs/18320 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
CmdUtils.CreateCommand( | |
{ | |
name: "erlang", | |
takes: {"function": noun_arb_text}, | |
icon: "http://erlang.org/favicon.ico", | |
author: {name: "Jason Roelofs", email: "[email protected]"}, | |
license: "MPL,GPL", | |
description: "Open erlang documentation for a given module", | |
help: "Select an erlang module", | |
execute: function(directObject) | |
{ | |
var url = "http://www.erlang.org/doc/man/{QUERY}.html" | |
var urlString = url.replace("{QUERY}", directObject.text); | |
Utils.openUrlInBrowser(urlString); | |
}, | |
preview: function(pblock, directObject) | |
{ | |
searchText = jQuery.trim(directObject.text); | |
if(searchText.length <= 0) | |
{ | |
pblock.innerHTML = "Search erlang modules"; | |
return; | |
} | |
var previewTemplate = "Open erlang man page for ${query}"; | |
var previewData = {query: searchText}; | |
pblock.innerHTML = CmdUtils.renderTemplate(previewTemplate, previewData); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment