1// Release 6.089 2var com; 3if (!com) com={}; 4else if (typeof com != "object") 5 throw new Error("com already exists and is not an object"); 6 7if (!com.travelpower) com.travelpower = {} 8else if (typeof com.travelpower != "object") 9 throw new Error("com.travelpower already exists and is not an object"); 10 11if (!com.travelpower.TPOnloadHandler) com.travelpower.TPOnloadHandler = {} 12 13// Release 6.076 - make sure we don't initialise twice 14if (!com.travelpower.TPOnloadHandler.funcs) com.travelpower.TPOnloadHandler.funcs = []; // The array of functions to call when the document loads 15com.travelpower.TPOnloadHandler.useConsoleLog = false; // Release 8.075 16com.travelpower.TPOnloadHandler.loaded = false; // The functions have not been run yet. 17com.travelpower.TPOnloadHandler.i = 0; 18 19function TPOnloadHandler(f) 20{ 21 //alert("TPOnloadHandler"); 22 if (com.travelpower.TPOnloadHandler.loaded) f(); // If already loaded, just invoke f() now. 23 else com.travelpower.TPOnloadHandler.funcs.push(f); // Otherwise, store it for later 24} 25 26// Release 8.075 - add optional functionName 27TPOnloadHandler.add = function(f, functionName) 28{ 29 if (!functionName) functionName=""; 30 // Release 8.075 31 if (com.travelpower.TPOnloadHandler.useConsoleLog) 32 com.travelpower.ConsoleLog.LogCheckpoint("TPOnloadHandler.add", functionName); 33 34 if (com.travelpower.TPOnloadHandler.loaded) f(); // If already loaded, just invoke f() now. 35 else com.travelpower.TPOnloadHandler.funcs.push(f); // Otherwise, store it for later 36} 37 38// Run all registered functions in the order in which they were registered. 39// It is safe to call TPOnloadHandler.run() more than once: invocations after the 40// first do nothing. It is safe for an initialization function to call 41// TPOnloadHandler() to register another function. 42TPOnloadHandler.run = function(thisEvent) 43{ 44 // Release 8.075 45 if (com.travelpower.TPOnloadHandler.useConsoleLog) 46 com.travelpower.ConsoleLog.LogEndPoint("TPOnloadHandler.run","Start loaded:" + com.travelpower.TPOnloadHandler.loaded); 47 48 if (com.travelpower.TPOnloadHandler.loaded) return; // If we've already run, do nothing 49 50 com.travelpower.TPOnloadHandler.loaded = true; // Release 4.078 - move this here 51 52 for (com.travelpower.TPOnloadHandler.i = 0; com.travelpower.TPOnloadHandler.i < com.travelpower.TPOnloadHandler.funcs.length; com.travelpower.TPOnloadHandler.i++) { 53 // Release 8.075 54 if (com.travelpower.TPOnloadHandler.useConsoleLog) 55 com.travelpower.ConsoleLog.LogEndPoint("TPOnloadHandler.run","Run"); 56 57 try { com.travelpower.TPOnloadHandler.funcs[com.travelpower.TPOnloadHandler.i](); } 58 catch (e) { console.error("TPOnloadHandler.run:"+e) } 59 } 60 61 //com.travelpower.TPOnloadHandler.loaded = true; // Remember that we've already run once. 62 delete com.travelpower.TPOnloadHandler.funcs; // But don't remember the functions themselves. 63 //delete TPOnloadHandler.run; // And forget about this function too! 64 // Release 8.075 65 if (com.travelpower.TPOnloadHandler.useConsoleLog) 66 com.travelpower.ConsoleLog.LogEndPoint("TPOnloadHandler.run","End"); 67}; 68 69// Release 4.078 - Register TPOnloadHandler.run() as the DOMContentLoaded event handler for the window 70if (document.addEventListener) 71 document.addEventListener("DOMContentLoaded", TPOnloadHandler.run, false) 72//else if (document.all && !window.opera) 73//{
74// document.write('<script type="text/javascript" id="contentloadtag" defer="defer" src="javascript:void(0)"><\/script>') 75// var contentloadtag=document.getElementById("contentloadtag") 76// contentloadtag.onreadystatechange = function () 77// { 78// if (this.readyState == "complete") 79// { 80// TPOnloadHandler.run; 81// } 82// } 83else 84{ 85 // For IE 86 // Code taken from http://ajaxian.com/archives/iecontentloaded-yet-another-domcontentloaded 87 (function() 88 { 89 // check IE's proprietary DOM members 90 if ( ! document.uniqueID && document.expando ) return; 91 92 // you can create any tagName, even customTag like <document :ready /> 93 var tempNode = document.createElement( 'document:ready' ); 94 95 try 96 { 97 // see if it throws errors until after ondocumentready 98 tempNode.doScroll( 'left' ); 99 100 // call ready 101 TPOnloadHandler.run(); 102 } 103 catch ( err ) 104 { 105 setTimeout( arguments.callee, 0 ); 106 } 107 }) 108 (); 109} 110 111// Register TPOnloadHandler.run() as the onload event handler for the window 112// Release 4.078 - this is now the back-stop in case the DOMContentLoaded method doesn't work 113if (window.addEventListener) 114 window.addEventListener("load", TPOnloadHandler.run, false); 115else if (window.attachEvent) window.attachEvent("onload", TPOnloadHandler.run); 116else window.onload = TPOnloadHandler.run; 117 118// Release 9.071 119if (com.travelpower.TPOnloadHandler.useConsoleLog) 120 com.travelpower.ConsoleLog.LogEndPoint("TPOnloadHandler.js", "loaded"); 121 122//alert("TPOnloadHandler OK");
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.