Last active
January 3, 2018 14:52
-
-
Save anasnakawa/770a37ecda3a023e41b5104391535ce1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<script type="text/javascript"> | |
(function() { | |
'use strict'; | |
/** | |
* hook method to be executed as soon as shortpoint | |
* is available in the page | |
*/ | |
function initHook() { | |
// exit on edit mode | |
if( window.shortPointInserter ) { | |
return; | |
} | |
setTimeout(function() { | |
// shortpoint is ready and rendered on the page | |
var jsElm = document.createElement("script"); | |
// set the type attribute | |
jsElm.type = "application/javascript"; | |
// make the script element load file | |
jsElm.src = "//platform.twitter.com/widgets.js"; | |
// finally insert the element to the body element in order to load the script | |
document.body.appendChild(jsElm); | |
}, 500); | |
}; | |
// shortpoint not yet available in the page | |
// wait for shortpoint ready dom event | |
document.addEventListener( 'shortpoint-render-above-fold', initHook ); | |
})(); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment