Created
December 9, 2013 22:35
-
-
Save tylermenezes/7882226 to your computer and use it in GitHub Desktop.
Adds a personal Typekit kit to Draft
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
// ==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