Blog
BONIC
Contact Me
Home
On The Web
Projects
Sitemap
Tools
Ubiquity
Erik
Vergobbi
Vold
erikvvold@gmail.com
Vancouver
,
BC
Canada
Ubiquity Command for Sphinn
Command
sphinn: Sphinns the typed url, or highlighted url, or otherwise the current page.
Source
CmdUtils.CreateCommand({ name:"sphinn", takes:{"text":noun_arb_text}, homepage:"http://erikvold.com/tools/ubiquity/sphinn/sphinn.cfm", icon:"http://sphinn.com/favicon.ico", author:{name:"Erik Vergobbi Vold",email: "erikvvold@gmail.com"}, description:"Submit this page or a url string to Sphinn.", help:"Submit this page or a url string to Sphinn.", execute:function(directObject){ var selectedURL=jQuery.trim(directObject.text); if(selectedURL==""){ selectedURL=context.focusedWindow.document.location; } jQuery.ajax({ type:"GET", url:"http://sphinn.com/evb/url.php?url="+selectedURL, error:function(){ //displayMessage("Error"); }, success:function(response){ response=jQuery.trim(response); if(response.match("http://sphinn.com/sphinnit.php?")){ Utils.openUrlInBrowser("http://sphinn.com/sphinnit.php?url="+selectedURL); } else{ Utils.openUrlInBrowser("http://sphinn.com/submit.php?url="+selectedURL); } } }); }, preview:function(pblock,directObject){ var selectedURL = jQuery.trim(directObject.text); if(selectedURL==""){ selectedURL=context.focusedWindow.document.location; } jQuery.ajax({ type:"GET", url:"http://sphinn.com/evb/url.php?url="+selectedURL, error:function(){ pblock.innerHTML = "Sphinn this page."; }, success:function(response){ response=jQuery.trim(response); if(response.match("http://sphinn.com/sphinnit.php?")){ var tempText="Sphinn this page. This page has been Sphinned ${sphinnCount} times."; var previewData={sphinnCount:response.match(/
(\d+)<\/b>/)[1]}; pblock.innerHTML=CmdUtils.renderTemplate(tempText, previewData); } else{ pblock.innerHTML="Sphinn this page."; } } }); return; } });