public
Last active

Ubiquity commands

  • Download Gist
-Readme.txt
1 2 3 4 5 6 7 8 9 10
// -----------------------------------------------------------------
// Description page for these Ubiquity commands: http://www.endolith.com/ubiquity_commands.html
// -----------------------------------------------------------------
 
// I guess only one link rel="commands" works per page, so for now, at least, all commands are in one gist, separated into files based on subject.
 
// Some of these ain't workin since 0.5. Need to fix them.
 
// For http://www.jslint.com/ :
/*global CmdUtils, Utils, context, displayMessage, noun_arb_text, noun_type_url, _*/
Google site search command.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
// -----------------------------------------------------------------
// Google site: search
// -----------------------------------------------------------------
 
// Derivative of http://hondje.mine.nu/ubiquity/?get=google-site-search
// Another variant: http://gist.github.com/47637
 
// Example URL to try: http://www.labor.state.ny.us/workerprotection/publicwork/PWContents.shtm
 
// Can use accesskeys like Alt+3 to select an option.
// Should also allow "using domain.com" or "using 4"?
 
// Add translation things
 
if (CmdUtils.parserVersion == 2) {
 
 
CmdUtils.CreateCommand({
names: ["Google site search"],
description: "Search with Google within this site.",
help: "Searches within the current site for your search term. Pressing Enter searches inside the entire hostname, or you can click in the list of other variants to search within a certain subdomain/subdirectory.",
icon: "http://www.google.com/favicon.ico",
version: "1.3",
homepage: "http://www.endolith.com/ubiquity_commands.html",
author: { email: "endolith@gmail.com" },
license: "MPL",
contributors: ["Tim van Heugten"],
arguments: [{role: "object",
nountype: noun_arb_text,
label: "search terms"}],
preview: function( pblock, args ) {
var doc = CmdUtils.getDocument();
var host = doc.location.host;
var hostbits = host.split('.');
var pathbits = doc.location.pathname.split('/');
var searchTerm = escape(args.object.text);
// I am not a real JavaScript programmer.
// This is a super-kludge!
var template = 'Search Google for <strong>' + args.object.summary + '</strong> only within this site:<ol>';
// Create the list of subdomains
var site = hostbits[hostbits.length - 1];
var x = 1;
for (var i = hostbits.length - 2; i >= 1; i--) {
site = hostbits[i] + '.' + site;
template = template + '<li value = ' + x + '><a accesskey="' + x + '" href="http://www.google.com/search?q=site:' + site + '%20' + searchTerm + '">' + site + '</a></li>';
x++;
}
 
// Add the full host to the list, bolded since it's the default
template = template + '<li value = ' + x + '><strong><a accesskey="' + x + '" href="http://www.google.com/search?q=site:' + host + '%20' + searchTerm + '">' + host + '</a></strong></li>';
x++;
 
// Create the list of subdirectories
site = host + '/';
for (var i = 1; i <= pathbits.length - 2; i++) {
site += pathbits[i] + '/';
template = template + '<li value = ' + x + '><a accesskey="' + x + '" href="http://www.google.com/search?q=site:' + site + '%20' + searchTerm + '">' + site + '</a></li>';
x++;
}
template = template + "</ol><small>Tip: You can go to one of these searches directly by using its number as an access key. (Linux and Windows: Alt-number, Mac: Control-number)</small>";
pblock.innerHTML = template;
},
execute: function(args) {
var doc = CmdUtils.getDocument();
var siteHost = doc.location.host;
var query = "site:" + siteHost + " " + args.object.text;
var urlString = "http://www.google.com/search?q=" + query;
Utils.openUrlInBrowser(urlString);
CmdUtils.setLastResult( urlString );
}
});
 
} else {
 
 
CmdUtils.CreateCommand({
name: "google-site-search",
description: "Search with Google within this site.",
help: "Searches within the current site for your search term. Pressing Enter searches inside the entire hostname, or you can click in the list of other variants to search within a certain subdomain/subdirectory.",
icon: "http://www.google.com/favicon.ico",
version: "1.3",
homepage: "http://www.endolith.com/ubiquity_commands.html",
author: { name: "Endolith", email: "endolith@gmail.com" },
license: "MPL",
contributors: ["Tim van Heugten"],
takes: {"search term": noun_arb_text},
preview: function( pblock, directObject ) {
var doc = CmdUtils.getDocument();
var host = doc.location.host;
var hostbits = host.split('.');
var pathbits = doc.location.pathname.split('/');
var searchTerm = escape(directObject.text);
// I am not a real JavaScript programmer.
// This is a super-kludge!
var template = 'Search Google for <strong>' + directObject.summary + '</strong> only within this site:<ol>';
// Create the list of subdomains
var site = hostbits[hostbits.length - 1];
var x = 1;
for (var i = hostbits.length - 2; i >= 1; i--) {
site = hostbits[i] + '.' + site;
template = template + '<li value = ' + x + '><a accesskey="' + x + '" href="http://www.google.com/search?q=site:' + site + '%20' + searchTerm + '">' + site + '</a></li>';
x++;
}
// Add the full host to the list, bolded since it's the default
template = template + '<li value = ' + x + '><strong><a accesskey="' + x + '" href="http://www.google.com/search?q=site:' + host + '%20' + searchTerm + '">' + host + '</a></strong></li>';
x++;
// Create the list of subdirectories
site = host + '/';
for (var i = 1; i <= pathbits.length - 2; i++) {
site += pathbits[i] + '/';
template = template + '<li value = ' + x + '><a accesskey="' + x + '" href="http://www.google.com/search?q=site:' + site + '%20' + searchTerm + '">' + site + '</a></li>';
x++;
}
template = template + "</ol><small>Tip: You can go to one of these searches directly by using its number as an access key. (Linux and Windows: Alt-number, Mac: Control-number)</small>";
pblock.innerHTML = template;
},
execute: function(directObject, modifiers) {
var doc = CmdUtils.getDocument();
var siteHost = doc.location.host;
var query = "site:"+siteHost+" "+directObject.text;
var urlString = "http://www.google.com/search?q="+query;
Utils.openUrlInBrowser(urlString);
CmdUtils.setLastResult( urlString );
}
});
 
}
Miscellaneous commands.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
// -----------------------------------------------------------------
// Miscellaneous commands
// -----------------------------------------------------------------
 
CmdUtils.CreateCommand({
names: ["zap stylesheets"],
description: "Remove CSS styles from the current page. Adapted from the squarefree.com bookmarklet",
homepage: "http://www.endolith.com/ubiquity_commands.html",
author: { email: "endolith@gmail.com" },
preview: "Remove CSS styles from the current page.",
icon: "http://www.famfamfam.com/lab/icons/silk/icons/page_white_lightning.png",
execute: function() {
var doc = CmdUtils.getDocument();
var i, x;
for (var i = 0; x = doc.styleSheets[i]; ++i) {
x.disabled = true;
}
}
});
 
CmdUtils.makeBookmarkletCommand({
name: "note in Google Reader",
description: "Converted from a bookmarklet from Google Reader",
icon: "http://www.google.com/favicon.ico",
homepage: "http://www.endolith.com/ubiquity_commands.html",
author: { email: "endolith@gmail.com" },
url: "javascript:var%20b=document.body;var%20GR________bookmarklet_domain='https://www.google.com';if(b&&!document.xmlVersion){void(z=document.createElement('script'));void(z.src='https://www.google.com/reader/ui/link-bookmarklet.js');void(b.appendChild(z));}else{}"
});
Resurrect dead page commands.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314
// -----------------------------------------------------------------
// Resurrect dead page commands
// -----------------------------------------------------------------
 
// Should all be combined into one "resurrect" command
// "resurrect ______ using Google's text-only cache"
// "retrieve cache of ______ using Google (text-only)"
// Default to ____,
// If a plain text URL is highlighted, it should resurrect that URL
// If HTML with a link inside it is highlighted, it should resurrect that link
// What about image URLs, etc?
// If current page is a 404 or other error, try to figure out what it was supposed to be
// Existing page --> Link to dead page --> redirect to 404
// In this case we should resurrect the dead page
// Referrer doesn't work
// Otherwise it will resurrect the current page
// Should check if cached version exists first and only show engines that have a result, maybe showing a preview of each
 
if (CmdUtils.parserVersion == 2) {
 
function get_target(input) {
var doc = CmdUtils.getDocument();
if (input.object.text) { // Typed-in target or selected URL
this.name = input.object.summary;
var a = doc.createElement('a'); // http://james.padolsey.com/javascript/parsing-urls-with-the-dom/
a.href = input.object.text;
this.location = a;
}
else if (0) { // Link contained in selected HTML
/*
targetLocation = link text;
url = link ;
*/
}
else if (0) { // Current page is a 404
/*
location = referring page title
url = referring page URL
*/
}
else { // Current page
if (doc.title) {
this.name = doc.title + " (" + doc.location.hostname + ")"; // Won't be accurate if 404ed, though
}
else {
this.name = "this page";
}
this.location = doc.location;
}
}
 
CmdUtils.CreateCommand({
names: ["Wayback Machine latest"],
description: "View the most recently archived version of a page using the Internet Archive's Wayback Machine.",
help: "If no URL is entered in Ubiquity, it will default to the currently-viewed page.",
icon: "http://web.archive.org/favicon.ico",
homepage: "http://www.endolith.com/ubiquity_commands.html",
author: { email: "endolith@gmail.com" },
license: "GPL",
arguments: {object: noun_type_url},
preview: function(pblock, input) {
var target = new get_target(input);
pblock.innerHTML = _("Opens the most recent archived version of <b>" + target.name + "</b> using the Internet Archive's Wayback Machine");
},
execute: function(input) {
var target = new get_target(input);
Utils.openUrlInBrowser("http://web.archive.org/" + escape(target.location.href));
}
});
 
CmdUtils.CreateCommand({
names: ["Wayback Machine list"],
description: "View the list of archived versions of a page on the Internet Archive's Wayback Machine.",
help: "If no URL is entered in Ubiquity, it will default to the currently-viewed page.",
icon: "http://web.archive.org/favicon.ico",
homepage: "http://www.endolith.com/ubiquity_commands.html",
author: { email: "endolith@gmail.com" },
license: "GPL",
arguments: {object: noun_type_url},
preview: function(pblock, input) {
var target = new get_target(input);
pblock.innerHTML = _("Opens the Wayback Machine's list of archived versions of <b>" + target.name + "</b>");
},
execute: function(input) {
var target = new get_target(input);
Utils.openUrlInBrowser("http://web.archive.org/web/*/" + escape(target.location.href));
}
});
 
CmdUtils.CreateCommand({
names: ["Google cache"], /* Should be a verb? */
description: "View Google's cached version of a URL or the current page",
help: "If no URL is entered in Ubiquity, it will default to the currently-viewed page.",
icon: "http://www.google.com/favicon.ico",
homepage: "http://www.endolith.com/ubiquity_commands.html",
author: { email: "endolith@gmail.com" },
license: "GPL",
arguments: {object: noun_type_url},
preview: function(pblock, input) {
var target = new get_target(input);
pblock.innerHTML = _("Opens Google's cached version of <b>" + target.name + "</b>");
},
execute: function(input) {
var target = new get_target(input);
Utils.openUrlInBrowser("http://www.google.com/search?q=cache:" + escape(target.location.href));
}
});
 
CmdUtils.CreateCommand({
names: ["Google cache text-only"],
description: "View Google's text-only cached version of a page",
help: "If no URL is entered in Ubiquity, it will default to the currently-viewed page.",
icon: "http://www.google.com/favicon.ico",
homepage: "http://www.endolith.com/ubiquity_commands.html",
author: { email: "endolith@gmail.com" },
license: "GPL",
arguments: {object: noun_type_url},
preview: function(pblock, input) {
var target = new get_target(input);
pblock.innerHTML = _("Opens Google's text-only cached version of <b>" + target.name + "</b>");
},
execute: function(input) {
var target = new get_target(input);
Utils.openUrlInBrowser("http://www.google.com/search?strip=1&q=cache:" + escape(target.location.href));
}
});
 
CmdUtils.CreateCommand({
names: ["Webcite cache"],
description: "View WebCite's archived version of a page.",
help: "If no URL is entered in Ubiquity, it will default to the currently-viewed page.",
icon: "http://www.webcitation.org/favicon.ico",
homepage: "http://www.endolith.com/ubiquity_commands.html",
author: { email: "endolith@gmail.com" },
license: "GPL",
arguments: {object: noun_type_url},
preview: function(pblock, input) {
var target = new get_target(input);
pblock.innerHTML = _("Opens WebCite's cached version of <b>" + target.name + "</b>");
},
execute: function(input) {
var target = new get_target(input);
Utils.openUrlInBrowser("http://webcitation.org/query.php?url=" + escape(target.location.href));
}
});
 
CmdUtils.CreateCommand({
names: ["Coral cache"],
description: "View CoralCDN's cached version of the current page.",
help: "If no URL is entered in Ubiquity, it will default to the currently-viewed page.",
icon: "http://www.coralcdn.org/favicon.ico",
homepage: "http://www.endolith.com/ubiquity_commands.html",
author: { email: "endolith@gmail.com" },
arguments: {object: noun_type_url},
preview: function(pblock, input) {
var target = new get_target(input);
pblock.innerHTML = _("Opens the CoralCDN cached version of <b>" + target.name + "</b>");
},
execute: function(input) {
var target = new get_target(input);
var loc = target.location;
if (loc.protocol == "http:"){
var coralizedhost = loc.host.replace(':','.') + '.nyud.net';
Utils.openUrlInBrowser(loc.href.replace(loc.host, coralizedhost));
}
else {
displayMessage(loc.protocol + _(" URLs cannot be Coralized"));
}
}
});
 
} else {
 
function get_target(input) {
var doc = CmdUtils.getDocument();
if (input.text) { // Typed-in target or selected URL
this.name = input.summary;
var a = doc.createElement('a'); // http://james.padolsey.com/javascript/parsing-urls-with-the-dom/
a.href = input.text;
this.location = a;
}
else { // Current page
if (doc.title) {
this.name = doc.title + " (" + doc.location.hostname + ")"; // Won't be accurate if 404ed, though
}
else {
this.name = "this page";
}
this.location = doc.location;
}
}
 
 
CmdUtils.CreateCommand({
name: "wayback-machine-latest",
description: "View the most recently archived version of a page using the Internet Archive's Wayback Machine.",
help: "If no URL is entered in Ubiquity, it will default to the currently-viewed page.",
icon: "http://web.archive.org/favicon.ico",
homepage: "http://www.endolith.com/ubiquity_commands.html",
author: { name: "Endolith", email: "endolith@gmail.com" },
license: "GPL",
takes: {"URL": noun_type_url},
preview: function(pblock, input) {
var target = new get_target(input);
pblock.innerHTML = "Opens the most recent archived version of <b>" + target.name + "</b> using the Internet Archive's Wayback Machine";
},
execute: function(input) {
var target = new get_target(input);
Utils.openUrlInBrowser("http://web.archive.org/" + escape(target.location.href));
}
});
CmdUtils.CreateCommand({
name: "wayback-machine-list",
description: "View the list of archived versions of a page on the Internet Archive's Wayback Machine.",
help: "If no URL is entered in Ubiquity, it will default to the currently-viewed page.",
icon: "http://web.archive.org/favicon.ico",
homepage: "http://www.endolith.com/ubiquity_commands.html",
author: { name: "Endolith", email: "endolith@gmail.com" },
license: "GPL",
takes: {"URL": noun_type_url},
preview: function(pblock, input) {
var target = new get_target(input);
pblock.innerHTML = "Opens the Wayback Machine's list of archived versions of <b>" + target.name + "</b>";
},
execute: function(input) {
var target = new get_target(input);
Utils.openUrlInBrowser("http://web.archive.org/web/*/" + escape(target.location.href));
}
});
CmdUtils.CreateCommand({
name: "google-cache",
description: "View Google's cached version of a URL or the current page",
help: "If no URL is entered in Ubiquity, it will default to the currently-viewed page.",
icon: "http://www.google.com/favicon.ico",
homepage: "http://www.endolith.com/ubiquity_commands.html",
author: { name: "Endolith", email: "endolith@gmail.com" },
license: "GPL",
takes: {"URL": noun_type_url},
preview: function(pblock, input) {
var target = new get_target(input);
pblock.innerHTML = "Opens Google's cached version of <b>" + target.name + "</b>";
},
execute: function(input) {
var target = new get_target(input);
Utils.openUrlInBrowser("http://www.google.com/search?q=cache:" + escape(target.location.href));
}
});
CmdUtils.CreateCommand({
name: "google-cache-text-only",
description: "View Google's text-only cached version of a page",
help: "If no URL is entered in Ubiquity, it will default to the currently-viewed page.",
icon: "http://www.google.com/favicon.ico",
homepage: "http://www.endolith.com/ubiquity_commands.html",
author: { name: "Endolith", email: "endolith@gmail.com" },
license: "GPL",
takes: {"URL": noun_type_url},
preview: function(pblock, input) {
var target = new get_target(input);
pblock.innerHTML = "Opens Google's text-only cached version of <b>" + target.name + "</b>";
},
execute: function(input) {
var target = new get_target(input);
Utils.openUrlInBrowser("http://www.google.com/search?strip=1&q=cache:" + escape(target.location.href));
}
});
CmdUtils.CreateCommand({
name: "webcite-cache",
description: "View WebCite's archived version of a page.",
help: "If no URL is entered in Ubiquity, it will default to the currently-viewed page.",
icon: "http://www.webcitation.org/favicon.ico",
homepage: "http://www.endolith.com/ubiquity_commands.html",
author: { name: "Endolith", email: "endolith@gmail.com" },
license: "GPL",
takes: {"URL": noun_type_url},
preview: function(pblock, input) {
var target = new get_target(input);
pblock.innerHTML = "Opens WebCite's cached version of <b>" + target.name + "</b>";
},
execute: function(input) {
var target = new get_target(input);
Utils.openUrlInBrowser("http://webcitation.org/query.php?url=" + escape(target.location.href));
}
});
CmdUtils.CreateCommand({
name: "coral-cache",
description: "View CoralCDN's cached version of the current page.",
help: "If no URL is entered in Ubiquity, it will default to the currently-viewed page.",
icon: "http://www.coralcdn.org/favicon.ico",
homepage: "http://www.endolith.com/ubiquity_commands.html",
author: { name: "Endolith", email: "endolith@gmail.com" },
takes: {"URL": noun_type_url},
preview: function(pblock, input) {
var target = new get_target(input);
pblock.innerHTML = "Opens the CoralCDN cached version of <b>" + target.name + "</b>";
},
execute: function(input) {
var target = new get_target(input);
var loc = target.location;
if (loc.protocol == "http:"){
var coralizedhost = loc.host.replace(':','.') + '.nyud.net';
Utils.openUrlInBrowser(loc.href.replace(loc.host, coralizedhost));
}
else {
displayMessage(loc.protocol + " URLs cannot be Coralized");
}
}
});
 
}
Text formatting commands.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
// -----------------------------------------------------------------
// Text formatting commands
// -----------------------------------------------------------------
 
// These all use execcommand instead of adding HTML tags manually, so they only work on rich text editing areas
 
CmdUtils.CreateCommand({
names: ["strikethrough", "strike through"],
description: "If you're in a rich-text-edit area, strikes through the selected text, like <s>this</s>.",
help: "Select some text and apply the command to <s>strike through the text</s>, or to toggle it back to normal.",
icon: "http://www.famfamfam.com/lab/icons/silk/icons/text_strikethrough.png",
homepage: "http://www.endolith.com/ubiquity_commands.html",
author: { email: "endolith@gmail.com" },
license: "GPL",
preview: function(pblock, input) {
pblock.innerHTML = cmd_strikethrough.description;
},
execute: function(input) {
var doc = context.focusedWindow.document; // change to CmdUtils.getDocument() ?
if (doc.designMode == "on") {
doc.execCommand("strikethrough", false, null);
}
else {
displayMessage(_("You're not in a rich text editing field."), this);
}
}
});
 
CmdUtils.CreateCommand({
names: ["monospace"],
description: "If you're in a rich-text-edit area, changes your current selection to a monospace font, like <tt>this</tt>.",
help: "Select some text and apply the command to <tt>make it monospace</tt>.",
icon: "http://www.famfamfam.com/lab/icons/silk/icons/text_letterspacing.png",
homepage: "http://www.endolith.com/ubiquity_commands.html",
author: { email: "endolith@gmail.com" },
license: "GPL",
preview: function(pblock, input) {
pblock.innerHTML = cmd_monospace.description;
},
execute: function(input) {
var doc = context.focusedWindow.document; // change to CmdUtils.getDocument() ?
if (doc.designMode == "on") {
doc.execCommand("fontname", false, "monospace");
}
else {
displayMessage(_("You're not in a rich text editing field."), this);
}
}
});
 
function cmd_highlight() {
var doc = context.focusedWindow.document;
if (doc.designMode == "on") {
doc.execCommand("hilitecolor",false,"yellow");
}
else {
displayMessage(_("You're not in a rich text editing field."), this);
}
}
cmd_highlight.preview = function(pblock) {
pblock.innerHTML = cmd_monospace.description;
};
cmd_highlight.description = "If you're in a rich-text-edit area, highlights your current selection, like <span style='background: yellow; color: black;'>this</span>.";
cmd_highlight.homepage = "http://www.endolith.com/ubiquity_commands.html";
cmd_highlight.icon = "chrome://ubiquity/skin/icons/textfield_rename.png";
UWO library proxy command.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
// -----------------------------------------------------------------
// UWO library proxy
// -----------------------------------------------------------------
 
 
if (CmdUtils.parserVersion == 2) {
//parser 2 command here
CmdUtils.CreateCommand({
names: ["UWO", "University of Western Ontario"],
description: "Access this scientific paper through the University of Western Ontario library",
preview: "Access this scientific paper through the University of Western Ontario library",
icon: "http://www.uwo.ca/local_files/favicon.ico",
execute: function() {
var doc = CmdUtils.getDocument();
var loc = doc.location;
var newhost = loc.host.replace(':','.') + '.proxy2.lib.uwo.ca:2048';
loc.href = loc.href.replace(loc.host, newhost);
}
});
}
else {
//parser 1 command here
CmdUtils.CreateCommand({
name: "uwo",
description: "Access this scientific paper through the University of Western Ontario library",
preview: "Access this scientific paper through the University of Western Ontario library",
icon: "http://www.uwo.ca/local_files/favicon.ico",
execute: function() {
var doc = CmdUtils.getDocument();
var loc = doc.location;
var newhost = loc.host.replace(':','.') + '.proxy2.lib.uwo.ca:2048';
loc.href = loc.href.replace(loc.host, newhost);
}
});
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.