Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@wwood
Created September 3, 2009 02:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wwood/180078 to your computer and use it in GitHub Desktop.
Save wwood/180078 to your computer and use it in GitHub Desktop.
Google Scholar Ubiquity Plugin (Ubiquity 0.5 compatible) Another copy of http://static.isnotworking.com/scholar-search.html
var noun_type_article = {
_name: "article title",
suggest: function( text, html ) {
var suggestions = [CmdUtils.makeSugg(text)];
return suggestions;
}
}
CmdUtils.CreateCommand({
names: ["scholar"],
icon: "http://www.google.com/favicon.ico",
homepage: "http://static.isnotworking.com/scholar-search.html",
author: { name: "Ricardo Niederberger Cabral", email: "ricardo@isnotworking.com"},
license: "MPL",
help: "Searches Google Scholar for articles",
arguments: [{role:'object', nountype: noun_type_article, label:'keywords'}],
preview: function(pblock, args) {
searchText = jQuery.trim(args.object.text);
if(searchText.length < 1) {
pblock.innerHTML = "Searches Google Scholar for articles";
return;
}
var previewTemplate = "Searches Google Scholar for articles containing <b>${query}</b>";
var previewData = {query: searchText};
pblock.innerHTML = CmdUtils.renderTemplate(previewTemplate, previewData);
},
execute: function(args) {
var url = "http://scholar.google.com/scholar?q={QUERY}"
var query = args.object.text;
var urlString = url.replace("{QUERY}", query);
Utils.openUrlInBrowser(urlString);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment