Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save netsuke/47637 to your computer and use it in GitHub Desktop.
Save netsuke/47637 to your computer and use it in GitHub Desktop.
//Google site search ubiquity command
//Search the current webpage using google site search
CmdUtils.CreateCommand({
name: "google-site-search",
icon: "http://www.google.com/favicon.ico",
author: { name: "Nanya Bizuidenhoud", email: "netsuke87@yahoo.com"},
description: "Search the current website for the given keyword using google site search",
help: "Simply type google-site-search in the ubiquity command interface, input the keyword to search for and the website you are looking at will be searched using google site search for the specified keyword",
takes: {"keyword": noun_arb_text},
preview: function( pblock, searchTerm) {
pblock.innerHTML = "Searches current site for: " + searchTerm.text;
},
execute: function(keyword) {
var url = context.focusedWindow.document.URL;
var search="http://www.google.com/search?sitesearch="+url+"&as_q="+keyword.text+"&x=0&y=0"
Utils.openUrlInBrowser(search);
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment