(function() { /* widget load functions */ var w = { DOMContentLoaded: function() { if ( document.addEventListener ) { document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); } else if ( document.readyState === "complete" ) { document.detachEvent( "onreadystatechange", DOMContentLoaded ); } }, ready: function() { var d = document.getElementById('tpt-widget'); if (!d) { return false; } var frame = ''; d.innerHTML = frame; } } /** * Catch cases where $(document).ready() is called after the browser event has already occurred. * we once tried to use readyState "interactive" here, but it caused issues like the one * discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 */ if ( document.readyState === "complete" ) { w.ready(); /* Standards-based browsers support DOMContentLoaded */ } else if ( document.addEventListener ) { /* Use the handy event callback */ /* document.addEventListener( "DOMContentLoaded", w.DOMContentLoaded, false ); */ /* A fallback to window.onload, that will always work */ window.addEventListener( "load", w.ready, false ); /* If IE event model is used */ } else { /* Ensure firing before onload, maybe late but safe also for iframes */ /* document.attachEvent( "onreadystatechange", w.DOMContentLoaded ); */ /* A fallback to window.onload, that will always work */ window.attachEvent( "onload", w.ready ); } })();