Created
January 13, 2016 23:39
-
-
Save rafaelrosafu/cba327da597ddeccdd93 to your computer and use it in GitHub Desktop.
Stupid bookmarklet to get page URLs in different formats. Unfortunately I lost the link for the original author, I just adapted it.
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
javascript:!function(){function m(a){return a.replace("<","<")}function n(a,b){return b.replace(/{([a-z]+)}/g,function(b,c){return a[c]})}var a=[["www.2ality.com",{func:function(a){a.ttitle="\u201c"+a.ttitle+"\u201d by @rauschma #2ality",a.thref=a.thref+" ^ar"}}],["451research.com",{twit:"@451Research",source:"451 Research"}],["addyosmani.com",{twit:"@addyosmani",source:"addyosmani"}],["angel.co",{twit:"@angellist",source:"AngelList"}],["www.allthingsdistributed.com",{twit:"@werner",source:"Werner Voguel's Blog"}],["arstechnica.com",{twit:"@arstechnica",source:"Ars Technica"}],["aws.typepad.com",{twit:"@awscloud",source:"AWS Blog"}],["badassjs.com",{twit:"@badass_js",source:"Badass JS"}],["blog.chromium.org",{twit:"@ChromiumDev",source:"Chromium Blog"}],["blog.gardeviance.org",{twit:"@swardley",source:"Simon Wardley's Blog"}],["blog.mozilla.com",{twit:"@firefox",source:"Mozilla Blog"}],["blog.nodejs.org",{twit:"@nodejs",source:"Node JS Blog"}],["www.cloudscaling.com",{twit:"@cloudscaling",source:"Cloudscaling"}],["www.crunchbase.com",{twit:"@techcrunch",source:"Crunchbase"}],["dailyjs.com",{twit:"@dailyjs",source:"Daily JS"}],["daringfireball.net",{twit:"@daringfireball",source:"Daring Fireball"}],["www.datacenterknowledge.com",{twit:"@datacenter",source:"Data Center Knowledge"}],["developer.palm.com",{twit:"@hpnews",source:"Palm"}],["developers.google.com",{twit:"@googledevs",source:"Google Developers"}],["www.digitalocean.com",{twit:"@digitalocean",source:"DigitalOcean"}],["functionsource.com",{twit:"@functionsource",source:"FunctionSource"}],["gigaom.com",{twit:"@gigaom",source:"GigaOm"}],["googlecloudplatform.blogspot.ca",{twit:"@googlecloud",source:"Google Cloud Platform blog"}],["hacks.mozilla.org",{twit:"@mozhacks",source:"Mozilla Hacks"}],["www.html5rocks.com",{twit:"@ChromiumDev",source:"HTML5 Rocks"}],["www.macrumors.com",{twit:"@MacRumors",source:"MacRumors"}],["www.marco.org",{twit:"@marcoarment",source:"Marco Arment's Blog"}],["mashable.com",{twit:"@mashable",source:"Mashable"}],["www.nczonline.net",{twit:"@slicknet",source:"NCZ Online"}],[/^.*nytimes.com$/,{twit:"@nytimes",source:"NY Times"}],["pandodaily.com",{twit:"@PandoDaily",source:"PandoDaily"}],["ovh.com",{twit:"@ovh",source:"OVH"}],["www.rackspace.com",{twit:"@rackspace",source:"Rackspace"}],["www.remotesynthesis.com",{twit:"@remotesynth",source:"Remote Synthesis"}],[/^.*smashingmagazine.com$/,{twit:"@smashingmag",source:"Smashing Magazine"}],["spinoff.comicbookresources.com",{twit:"@SpinoffOnline",source:"Spinoff Online"}],["structureresearch.net",{twit:"@StructureRes",source:"Structure Research"}],["tagneto.blogspot.ca",{twit:"@jrburke",source:"Tagneto's Blog"}],["techcrunch.com",{twit:"@techcrunch",source:"Techcrunch"}],["thenextweb.com",{twit:"@TheNextWeb",source:"The Next Web"}],["www.theregister.co.uk",{twit:"@theregister",source:"The Register"}],["www.thewhir.com",{twit:"@thewhir",source:"The WHIR"}],["www.theverge.com",{twit:"@verge",source:"The Verge"}],["unscriptable.com",{twit:"@unscriptable",source:"Unscriptable"}]],b={},c=window.getSelection?String(window.getSelection()):"";b.title=document.title.replace(/(\s*[\u2014\u2022|].*)$/g,""),b.href=document.location.href;var d;a.some(function(a){var b=a[0];if(b instanceof RegExp){if(b.test(document.location.host))return d=a[1],!0}else if(b===document.location.host)return d=a[1],!0}),d&&(d.func?d.func(b):d.twit&&(b.twit=d.twit,b.source=d.source));var e=n(b,'<html><head><title>Copy link: {title}</title></head><body><textarea id="text" cols="80" rows="20">'),f="";htmlTemplate=void 0===b.twit?"{title}\n{href}":"\u201c{title}\u201d by {twit}\n{href}",f+=n(b,htmlTemplate),f+="\n\n",f+=n(b,'<a href="{href}">{title}</a>'),f+=n(b,"\n\n{href}{title}");var g="";g=void 0===b.twit?'["{title}" on ]({href})':'["{title}" on {source}]({href})',f+="\n\n";var h=f.length;f+=n(b,g);var i=f.length;c&&(f+="\n\n"+c);var j=n(b,"</textarea></body></html>"),k=window.open().document;k.write(e+m(f)+j),k.close();var l=k.getElementById("text");l.focus(),l.selectionStart=h,l.selectionEnd=i}(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment