\
Tools
\
Ubiquity
\
Blog
BOINC
Contact Me
Home
On The Web
Projects
Sitemap
Tools
Ubiquity
Wish List
Erik
Vergobbi
Vold
erikvvold@gmail.com
Vancouver
,
BC
Canada
RevCanonical Ubiquity Command
Command
revcanonical: Uses the
RevCanonical
API to check and see if the link provided has published a shortened version of the given page using a HTML link element with rev="canonical".
Source
CmdUtils.CreateCommand({ name: "revcanonical", homepage: "http://www.erikvold.com/tools/ubiquity/revcanonical/revcanonical.cfm", icon:"", description:'Checks if the link provided has published a shortened version of the given page using a HTML link element with rev="canonical".', help:"", author: { name: "Erik Vold", email: "erikvvold@gmail.com"}, contributors: ["Erik Vold"], license: "MPL", version: "0.1", takes: {"word": noun_arb_text}, preview: function (pblock, directObject) { // Display immediate preview message. pblock.innerHTML = "Replaces the selected url with "; // get selected url var selectedURL=jQuery.trim(directObject.text); if(selectedURL==""){ selectedURL=context.focusedWindow.document.location; } // get revcanonical url jQuery.ajax({ type:"GET", dataType:"text", url:"http://revcanonical.appspot.com/api?url="+selectedURL, error:function(){ displayMessage("There was an error."); }, success:function(response){ var shortURLString = jQuery.trim(response+""); // display the revcanonical url pblock.innerHTML = "Replaces the selected url with "+shortURLString; return; } }); return; }, execute: function( directObject ) { // get selected url var selectedURL=jQuery.trim(directObject.text); if(selectedURL==""){ selectedURL=context.focusedWindow.document.location; } // get revcanonical url jQuery.ajax({ type:"GET", dataType:"text", url:"http://revcanonical.appspot.com/api?url="+selectedURL, error:function(){ displayMessage("There was an error."); }, success:function(response){ var shortURLString = jQuery.trim(response+""); // set the selection to the revcanonical url CmdUtils.setSelection(shortURLString); return; } }); return; } });