-
-
Save pvalencia/168442 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
/* Based on gist: 26061 by bastos. */ | |
CmdUtils.CreateCommand({ | |
names: ["code"], | |
icon: "http://www.github.com/favicon.ico", | |
author: {name: "Pedro Valencia", email: "[email protected]"}, | |
license: "GPL", | |
homepage: "http://gist.github.com/gists/168442", | |
description: "Search on Github Code Search", | |
help: "Search on Github Code Search", | |
arguments: [{role: 'object', nountype: noun_arb_text, label: 'function'}], | |
preview: function preview(pblock, args) { | |
searchText = jQuery.trim(args.object.text); | |
if(searchText.length <= 0) { | |
pblock.innerHTML = "Search on github codesearch"; | |
return; | |
} | |
var previewTemplate = "Search on Github: ${query}"; | |
var previewData = {query: searchText}; | |
pblock.innerHTML = CmdUtils.renderTemplate(previewTemplate, previewData); | |
}, | |
execute: function execute(args) { | |
var url = "http://github.com/search?type=Code&q={QUERY}"; | |
var urlString = url.replace("{QUERY}", args.object.text); | |
Utils.openUrlInBrowser(urlString); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment