Every line of 'document onready' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
75 export function documentReady(cb) { 76 77 if (stateIsInteractive() || stateIsComplete()) { 78 cb(); 79 } 80 81 function loadedHandler() { 82 removeHandler(doc, 'DOMContentLoaded', loadedHandler); 83 cb(); 84 } 85 86 addHandler(doc, 'DOMContentLoaded', loadedHandler); 87 }
15 function documentReady(){ 16 fadeInAnim(); 17 socket = io.connect(location.protocol + '//' + document.domain + 18 ':' + location.port + appNamespace); 19 20 socket.on('connect', function() { 21 socket.emit('send_app_args'); 22 }); 23 24 socket.on('cli_args', function(cliArgs) { 25 args = cliArgs.args; 26 for (var i in args){ 27 if (i != 'freq') 28 args[i] = args[i] || 0; 29 } 30 }); 31 }
3 function onDocumentReady(callback) { 4 var state = document.readyState; 5 if (state === 'complete' || state === 'interactive') { 6 return callback(); 7 } 8 document.addEventListener('DOMContentLoaded', function () { 9 callback(); 10 }); 11 }
69 function documentReady() { 70 // Get initial tracking status 71 matomoOptOutStatus(); 72 73 // Add listener for the "do track" button. 74 var doTrackBtn = document.querySelector('.MatomoOptout-button--track'); 75 doTrackBtn.addEventListener('click', function (event) { 76 event.preventDefault(); 77 event.stopPropagation(); 78 79 matomoOptOutTrack(); 80 }); 81 82 // Add listener for the "do not track" button. 83 var doBlockBtn = document.querySelector('.MatomoOptout-button--block'); 84 doBlockBtn.addEventListener('click', function (event) { 85 event.preventDefault(); 86 event.stopPropagation(); 87 88 matomoOptOutStatus(); 89 if (matomoOptOutIsTracked === true) { 90 matomoOptOutBlock(); 91 } 92 }); 93 }
18 function dom_ready(cb) { 19 function dom_ready_cb() { 20 dom_ready_cb = null_function; 21 cb(); 22 } 23 document.addEventListener('DOMContentLoaded', dom_ready_cb, false); 24 var previous_onload = window.onload; 25 window.onload = function() { 26 dom_ready_cb(); 27 previous_onload && previous_onload(); 28 } 29 }
42 function domReady(callback) { 43 const doc = document; 44 const attach = 'addEventListener'; 45 46 if (doc[attach]) { 47 doc[attach]('DOMContentLoaded', callback); 48 } else { 49 window.attachEvent('onload', callback); 50 } 51 }
7 function domReady(callback) { 8 if (doc.readyState === "complete" || (doc.readyState !== "loading" && !doc.documentElement.doScroll)) 9 setTimeout(() => callback && callback(), 0) 10 else { 11 let handler = () => { 12 doc.removeEventListener("DOMContentLoaded", handler, false) 13 win.removeEventListener("load", handler, false) 14 callback && callback() 15 } 16 doc.addEventListener("DOMContentLoaded", handler, false) 17 win.addEventListener("load", handler, false) 18 } 19 }
9 export function domReady(callback) { 10 readyCallbacks.push(callback) 11 }
68 function isDocumentReady(iframe, callback) { 69 if (iframe.contentDocument.readyState === 'loading') { 70 iframe.contentDocument.addEventListener('DOMContentLoaded', function() { 71 callback(); 72 }); 73 } else { 74 callback(); 75 } 76 }
159 function onReady(){ 160 161 $(document).ready(function(){ 162 // alert(1); 163 // alert($(window).width()); // 720 164 // alert($(window).height()); // 1230 165 // alert(0); 166 $('body').css('width',$(window).width() + 'px'); 167 $('body').css('height',$(window).height() + 'px'); 168 App.init(); 169 }); 170 }