Guest User

Untitled

a guest
Jul 25th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. tinymce.PluginManager.add('typekit', function(editor) {
  2. editor.on('init', function() {
  3.  
  4. // Get the DOM document object for the IFRAME
  5. var doc = this.getDoc();
  6.  
  7. // Create the script we will add to the header asynchronously
  8. var jscript = "(function(d) {\n\
  9. var config = {\n\
  10. kitId: 'xxxxxxx',\n\
  11. scriptTimeout: 3000\n\
  12. },\n\
  13. h=d.documentElement,t=setTimeout(function(){h.className=h.className.replace(/\bwf-loading\b/g,'')+' wf-inactive';},config.scriptTimeout),tk=d.createElement('script'),f=false,s=d.getElementsByTagName('script')[0],a;h.className+=' wf-loading';tk.src='//use.typekit.net/'+config.kitId+'.js';tk.async=true;tk.onload=tk.onreadystatechange=function(){a=this.readyState;if(f||a&&a!='complete'&&a!='loaded')return;f=true;clearTimeout(t);try{Typekit.load(config)}catch(e){}};s.parentNode.insertBefore(tk,s)\n\})(document);\n\
  14. ";
  15.  
  16. // Create a script element and insert the TypeKit code into it
  17. var script = doc.createElement("script");
  18. script.type = "text/javascript";
  19. script.appendChild(doc.createTextNode(jscript));
  20.  
  21. // Add the script to the header
  22. doc.getElementsByTagName('head')[0].appendChild(script);
  23. });
  24. });
Add Comment
Please, Sign In to add comment