-
-
Save libin/62805 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: ['git'], | |
arguments: [{role: 'object', nountype: noun_arb_text, label: 'query'}], | |
icon: "http://github.com/favicon.ico", | |
homepage: "http://mrgossett.com", | |
author: {name: "Tim Gossett", email: "tim@mrgossett.com"}, | |
license: "Creative Commons", | |
description: "Search GitHub repositories", | |
help: "Start typing a search term", | |
execute: function(args) | |
{ | |
var url = "http://github.com/search?q={QUERY}" | |
var urlString = url.replace("{QUERY}", args.object.text); | |
Utils.openUrlInBrowser(urlString); | |
}, | |
preview: function(previewBlock, args) | |
{ | |
searchText = jQuery.trim(args.object.text); | |
if(searchText.length < 1) | |
{ | |
pblock.innerHTML = "Search GitHub repositories"; | |
return; | |
} | |
var previewTemplate = "Search GitHub repositories for ${query}"; | |
var previewData = {query: searchText}; | |
previewBlock.innerHTML = CmdUtils.renderTemplate(previewTemplate, previewData); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment