Skip to content

Instantly share code, notes, and snippets.

@endreszabo
Created August 27, 2013 11:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save endreszabo/6352192 to your computer and use it in GitHub Desktop.
Save endreszabo/6352192 to your computer and use it in GitHub Desktop.
unshortr url submit bookmarklet
#!/usr/bin/perl
local$/;$_='javascript:'.<DATA>;$_=~s/\) \{\n/){\n/g;$_=~s/\n\s*//g;print;
__DATA__
USSw=open('','unshorten_url_submit','width=400,height=200,scrollbars,resizable,menubar');
OSUl=document.links;
with(USSw.document) {
write('<base target=_self><p>Ushorten Bookmarklet has ');
if(OSUl.length>0) {
write('found the following URLs. Click on any of these to submit to Unshorten delvelopers.</p>');
for(USi=0;USi<OSUl.length;USi++) {
if(OSUl[USi].toString().substr(0,4)=='http') {
write(OSUl[USi].toString().link('http://unshortr.hsbp.org/submit/?'+OSUl[USi]));
if(OSUl[USi].text.trim().length>0) {
write(' ('+OSUl[USi].text.trim().replace(/[<>]/g, function(match) {
if(match==='<')
return'&lt;'
else
return'&gt;';
})+')')
}
write('<br>')
}
}
} else
write('not found any usable URLs.');
void(close())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment