Skip to content

Instantly share code, notes, and snippets.

@capndesign
Forked from markpasc/bookmarklet.js
Created November 16, 2010 04:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save capndesign/701397 to your computer and use it in GitHub Desktop.
Save capndesign/701397 to your computer and use it in GitHub Desktop.
Install this as a bookmarklet and it will show the site's colophon if it uses TypeKit.
javascript:(function(){s=document.createElement('script');s.type='text/javascript';s.src='https://gist.github.com/raw/701397/typekit-colophon.js';document.getElementsByTagName('head').item(0).appendChild(s);void('')})();
(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
Author

This code is based on markpasc's and pdokas' gists, which is a great improvement over mine. I combined the two for exponential awesomeness.

@rungta
Copy link

rungta commented May 14, 2013

Fails when a kit is served from use.typekit.net instead of use.typekit.com. Time for an update?

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