Skip to content

Instantly share code, notes, and snippets.

@tylermenezes
Created December 9, 2013 22:35
Show Gist options
  • Save tylermenezes/7882226 to your computer and use it in GitHub Desktop.
Save tylermenezes/7882226 to your computer and use it in GitHub Desktop.
Adds a personal Typekit kit to Draft
// ==UserScript==
// @name Draft Typekitizer
// @namespace http://tyler.menez.es/
// @version 1
// @description Adds Typekit to Draft
// @match http*://*.draftin.com/*
// @copyright 2013 Tyler Menezes
// ==/UserScript==
(function() {
var config = {
kitId: 'zzc6rez', // Change this to your kit ID (or leave it if you want to use proxima-nova)
scriptTimeout: 3000
};
console.log('Registering personal Typekit library');
var h=document.getElementsByTagName("html")[0];h.className+=" wf-loading";var t=setTimeout(function(){h.className=h.className.replace(/(\s|^)wf-loading(\s|$)/g," ");h.className+=" wf-inactive"},config.scriptTimeout);var tk=document.createElement("script"),d=false;tk.src='//use.typekit.net/'+config.kitId+'.js';tk.type="text/javascript";tk.async="true";tk.onload=tk.onreadystatechange=function(){var a=this.readyState;if(d||a&&a!="complete"&&a!="loaded")return;d=true;clearTimeout(t);try{Typekit.load(config)}catch(b){}};var s=document.getElementsByTagName("script")[0];s.parentNode.insertBefore(tk,s)
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment