Skip to content

Instantly share code, notes, and snippets.

@pdokas
Forked from capndesign/typekit-colophon.js
Created November 13, 2010 16:35
Show Gist options
  • Save pdokas/675469 to your computer and use it in GitHub Desktop.
Save pdokas/675469 to your computer and use it in GitHub Desktop.
javascript:%20(function(){var%20a=document.getElementsByTagName('script'),i,l,result,rurl=/^http:\/\/use\.typekit\.com\/([0-9A-Za-z]+)\.js/;for(i=0,l=a.length-1;i<l;i++){if(result=rurl.exec(a[i].getAttribute('src'))){window.location.assign('http://typekit.com/colophons/'+result[1]);break;}}%20if(!result){alert('This%20site%20doesn\'t%20use%20Typekit!');}})();
(function() {
var a = document.getElementsByTagName('script'),
i, l, result,
rurl = /^http:\/\/use\.typekit\.com\/([0-9A-Za-z]+)\.js/;
for (i = 0, l = a.length - 1; i < l; i++) {
if (result = rurl.exec(a[i].getAttribute('src'))) {
window.location.assign('http://typekit.com/colophons/' + result[1]);
break;
}
}
if (!result) {
alert('This site doesn\'t use Typekit!');
}
})();
@capndesign
Copy link

Awesome! I'm definitely going to replace my code with yours. Works great!

This is also why I posted it as a gist. I knew someone who had a better-than-hacky knowledge of JS would write something better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment