Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.