Skip to content

Instantly share code, notes, and snippets.

@yura
Created December 6, 2009 17:58
Show Gist options
  • Save yura/250315 to your computer and use it in GitHub Desktop.
Save yura/250315 to your computer and use it in GitHub Desktop.
CmdUtils.CreateCommand({
names: ["github"],
icon: "http://github.com/favicon.ico",
description: "GitHub search",
author: {name: "Yury Kotlyarov", email: "[email protected]"},
license: "Ruby",
homepage: "http://www.brainhouse.ru/",
arguments: [{role: 'object', nountype: noun_arb_text, label: 'search query'}],
_getSearchUrl: function(query) {
return "http://github.com/search?" + jQuery.param( {q: query} );
},
preview: function preview(pblock, args) {
pblock.innerHTML = _("GitHub search in progress...");
CmdUtils.previewGet(pblock, this._getSearchUrl(args.object.text), function (htm) {
pblock.innerHTML = htm;
});
},
execute: function execute(args) {
Utils.openUrlInBrowser(this._getSearchUrl(args.object.text));
}
});
<link rel="commands" href="github.js" name="Ubiquity GitHub Search Command" />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment