Forked from jackdempsey/ruby-search.ubiquity-command.js
Created
September 7, 2008 20:39
-
-
Save davidwparker/9310 to your computer and use it in GitHub Desktop.
rspec ubiquity search
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: "rspec", | |
takes: {"function": noun_arb_text}, | |
icon: "http://ruby-doc.org/favicon.ico", | |
homepage: "http://davidwparker.com", | |
author: {name: "Jack Dempsey, fork by David Parker", email: "[email protected]"}, | |
license: "MPL,GPL", | |
description: "Search rspec functions documentation", | |
help: "Select a rspec function", | |
execute: function(directObject) | |
{ | |
var url = "http://apidock.com/rspec/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 rspec function documentation"; | |
return; | |
} | |
var previewTemplate = "Search rspec function 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