Created
September 3, 2009 02:08
-
-
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
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
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