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
tinymce.PluginManager.add('typekit', function(editor) { | |
editor.on('init', function() { | |
var typekitId = editor.settings.typekitId; | |
// Get the iframe. | |
var doc = editor.getDoc(); | |
// Create the script to inject into the header asynchronously. | |
var jscript = "(function() { var config = { kitId: '"+typekitId+"' }; var d = false, tk = document.createElement('script'); tk.src = '//use.typekit.net/' + config.kitId + '.js'; tk.type = 'text/javascript'; tk.async = 'true'; tk.onload = tk.onreadystatechange = function() { var rs = this.readyState; if (d || rs && rs != 'complete' && rs != 'loaded') return; d = true; try { Typekit.load(config); } catch (e) {} }; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(tk, s); })();"; | |
// Create a DOM script element and insert the code inside of it. | |
var script = doc.createElement("script"); | |
script.type = "text/javascript"; |