Forked from jackdempsey/ruby-search.ubiquity-command.js
Created
September 5, 2008 20:18
-
-
Save jasonroelofs/9015 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
CmdUtils.CreateCommand( | |
{ | |
name: "rails", | |
takes: {"function": noun_arb_text}, | |
icon: "http://ruby-doc.org/favicon.ico", | |
homepage: "http://jackndempsey.blogspot.com", | |
author: {name: "Jack Dempsey", email: "jack.dempsey@gmail.com"}, | |
license: "MPL,GPL", | |
description: "Search rails functions documentation", | |
help: "Select a rails function", | |
execute: function(directObject) | |
{ | |
var url = "http://apidock.com/rails/search?query={QUERY}&commit=Search" | |
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 rails function documentation"; | |
return; | |
} | |
var previewTemplate = "Search rails api 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