Created
December 29, 2009 12:56
-
-
Save spejman/265296 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
// Based on Zhao Lu Ubiquity < 0.5 command | |
CmdUtils.CreateCommand({ | |
names: ['rails', 'search rails documentation'], | |
arguments: [{role: 'object', nountype: noun_arb_text, label: 'method'}], | |
icon: "http://rubyonrails.org/images/rails.png", | |
homepage: "", | |
author: {name: "Sergio Espeja", email: "[email protected]"}, | |
license: "MPL,GPL", | |
description: "Search rails documentation", | |
help: "Type a rails class or method", | |
execute: function(args) | |
{ | |
var url = "http://apidock.com/rails/{TERM}" | |
var urlString = url.replace("{TERM}", args.object.text); | |
Utils.openUrlInBrowser(urlString); | |
}, | |
preview: function(pblock, args) | |
{ | |
searchText = jQuery.trim(args.object.text); | |
if(searchText.length <= 0) | |
{ | |
pblock.innerHTML = "Search rails documentation"; | |
return; | |
} | |
var previewTemplate = "Search rails documentation of ${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