Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<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