温馨提示:代码在线浏览功能只能做为源码浏览参考,不能展示项目的全部,如果想更进一步了解该代码请下载:NetShopForge网上商店程序(VB)源码
当前文件路径:NetShopForge/Website/js/Boot.js

1var gbN2LibMonMigrated = true; 2
var N2Loaded = false; 3
var n2LMStart = new Date(); 4
var gaN2CSSLibs = new Array(); 5
var gaN2JSLibs = new Array(); 6
var oTheDoc = document; 7
var oTheBody = oTheDoc.body; 8
var oTheHead = document.getElementsByTagName('head').item(0); 9
var n2sRTW1='onload'; 10
var n2sRTWTBS='simplepopoverloaded'; 11
function N2Initializer () { 12
this.aHandlers = new Array(); 13
this.aEventsRun = new Array(); 14
this.bCoreLoaded = false; 15
} 16
new N2Initializer (); 17
N2Initializer.prototype.runThisWhen = function (sWhen, fFn, sComment) { 18
if ( (typeof fFn != 'function') || fFn == null) return false; 19
sWhen = sWhen.toLowerCase(); 20
if ( (sWhen =='inbody' && document.body) || this.aEventsRun[sWhen] ){ 21
fFn(); 22
} else { 23
this.aHandlers[this.aHandlers.length] = { sWhen: sWhen, fFn: fFn, sComment: sComment }; 24
} 25
return true 26
} 27
N2Initializer.prototype.initializeThis = N2Initializer.prototype.runThisWhen 28
N2Initializer.prototype.loadThisWhen = function (sWhen, sURL, sID, sComment) { 29
sWhen = sWhen.toLowerCase(); 30
goN2LibMon.monitorLoad (sID); 31
if ( sWhen =='now' ) { 32
n2LoadScript(sURL, true, sID); 33
} else { 34
this.aHandlers[this.aHandlers.length] = { sWhen: sWhen, sURL: sURL, sID: sID, sComment: sComment }; 35
} 36
return true 37
} 38
N2Initializer.prototype.run = function (sWhen) { 39
sWhen = (typeof sWhen == 'undefined') ? null : sWhen; 40
sWhen = sWhen.toLowerCase(); 41
this.aEventsRun[sWhen] = true; 42
if (sWhen == 'coreloaded') { this.bCoreLoaded=true; } 43
if (window.goN2Debug) goN2Debug.info("N2Initializer called with " + (sWhen ? "'"+sWhen+"'" : "null")); 44
var aH = this.aHandlers; 45
var len = aH.length; 46
for (var i=0;i<len;i++) { 47
var oTmp = aH[i]; 48
if ((oTmp.bCalled != true) && 49
(oTmp.fFn || oTmp.sURL) && 50
( (sWhen == null) || (oTmp.sWhen && (oTmp.sWhen == sWhen))) 51
) { 52
if ((oTmp.sWhen == 'coreloaded') && !this.bCoreLoaded) continue; 53
if (window.goN2Debug) ; 54
if (oTmp.fFn) { 55
oTmp.fFn(); 56
} else if (oTmp.sURL) { 57
n2LoadScript(oTmp.sURL, true, oTmp.sID); 58
} 59
oTmp.bCalled = true; 60
} 61
} 62
} 63
goN2Initializer = new N2Initializer(); 64
function n2RunThisWhen (sWhen, fFn, sComment) { 65
goN2Initializer.runThisWhen(sWhen, fFn, sComment); 66
} 67
function n2LoadThisWhen (sWhen, sURL, sID, sComment) { 68
goN2Initializer.loadThisWhen(sWhen, sURL, sID, sComment); 69
} 70
function n2RunIfLoaded (sLibID, fFn, sComment) { 71
n2RunThisWhen(sLibID+'loaded', fFn, 'sequenced init of '+ sComment); 72
} 73
function n2LoadScript (sURL, bLocalCacheOK, sLibID) { 74
if (sLibID) { goN2LibMon.requestLoad (sLibID); } 75
var e = oTheDoc.createElement("script"); 76
e.type="text/javascript"; 77
if (bLocalCacheOK) { 78
e.src = sURL; 79
} else { 80
e.src = sURL + (sURL.indexOf('?') == -1 ? '?' : '&') + 'lt='+ new Date().getTime(); 81
} 82
oTheHead.appendChild(e); 83
} 84
function N2LibraryMonitor() { 85
this.aLibs = {}; 86
this.bJSLoaded=false; 87
this.bCSSLoaded=false; 88
this.sNotLoaded ='A desirable part of the page did not load. Please refresh the page to try again. \n'; 89
this.nTimer=null; 90
this.nTimeoutMs = 10000; 91
} 92
new N2LibraryMonitor(); 93
N2LibraryMonitorProto = N2LibraryMonitor.prototype; 94
N2LibraryMonitor.prototype.monitorLoad = function (sLibID) { 95
this.aLibs[sLibID] = { sID: sLibID, nDuration: -1 }; 96
} 97
N2LibraryMonitor.prototype.requestLoad = function (sLibID, sFeatureID) { 98
var oTmp = this.aLibs[sLibID]; 99
if (oTmp) { oTmp.nDuration= -2; } 100
this.resetTimer(); 101
} 102
N2LibraryMonitor.prototype.beginLoad = function (sLibID, sFeatureID) { 103
var oTmp = this.aLibs[sLibID]; 104
if (oTmp) { 105
oTmp.sFeature = sFeatureID; 106
oTmp.nBegin = new Date().getTime(); 107
oTmp.nDuration= -3; 108
} 109
}; 110
N2LibraryMonitor.prototype.endLoad = function (sLibID, nStatus) { 111
var oTmp = this.aLibs[sLibID]; 112
if (oTmp) { oTmp.nDuration = new Date().getTime() - oTmp.nBegin; oTmp.bLoaded=true;} 113
var bALL; 114
if (bALL=this.allLibsLoaded()) { 115
this.clearTimer(); 116
} else { 117
this.resetTimer(); 118
} 119
goN2Initializer.run(sLibID+'loaded'); 120
if (bALL) { 121
goN2Initializer.run('lastlibraryloaded'); 122
} 123
} 124
N2LibraryMonitorProto.clearTimer=function() { 125
if (this.nTimer) { 126
clearTimeout(this.nTimer); 127
this.nTimer = null; 128
} 129
} 130
N2LibraryMonitorProto.resetTimer=function() { 131
if (this.nTimer) { 132
clearTimeout(this.nTimer); } 133
this.nTimer = setTimeout(n2LibraryLoadTimeout, this.nTimeoutMs); 134
} 135
function n2LibraryLoadTimeout() { 136
goN2Initializer.run('libraryloadfailed'); 137
} 138
N2LibraryMonitor.prototype.allLibsLoaded = function () { 139
var bAllLoaded=true; 140
for (var key in this.aLibs) { 141
if (this.aLibs[key] && this.aLibs[key].nDuration <0) { bAllLoaded=false; } 142
} 143
this.bJSLoaded = bAllLoaded; 144
return bAllLoaded; 145
} 146
N2LibraryMonitor.prototype.confirmJSLoaded = function() { return this.bJSLoaded; } 147
N2LibraryMonitor.prototype.confirmCSSLoaded = function() { this.bCSSLoaded=true; } 148
N2LibraryMonitor.prototype.isJSLoaded = function() { return this.bJSLoaded; } 149
N2LibraryMonitor.prototype.isCSSLoaded = function() { return this.bCSSLoaded; } 150
N2LibraryMonitor.prototype.status = function() { 151
if (this.bJSLoaded) return "OK!"; 152
else return this.sNotLoaded; 153
} 154
N2LibraryMonitor.prototype.stats = function() { return "N/A"; }; 155
goN2LibMon = new N2LibraryMonitor(); 156
var n2LLStop = new Date(); 157
var n2LMStop = new Date(); 158
function N2ConfigBase() { 159
this.getValue = function(id,d) { 160
if(typeof this[id] != 'undefined') { return this.id; } 161
else { return d; } } } 162
var goN2ConfigBase = new N2ConfigBase(); 163
document.write('<link href="http://www.dangdang.com/css/pop.css" type="text/css" rel="stylesheet">'+ 164
''); 165
goN2LibMon.monitorLoad ("utilities"); 166
goN2LibMon.monitorLoad ("events"); 167
goN2LibMon.monitorLoad ("simplePopover"); 168
document.write('<script language="javascript" src="http://www.dangdang.com/js/a_20051231.js" type="text/javascript"></script><\/script>'+ 169
'<script language="javascript" src="http://www.dangdang.com/js/c_20051231.js" type="text/javascript"></script><\/script>'+ 170
'<script language="javascript" src="http://www.dangdang.com/js/b_20051231.js" type="text/javascript"></script><\/script>'+ 171
''); 172
var goCust = new Object(); 173
goCust.isLoggedIn=function() { return false; } 174
var goN2Explorer; 175
var gaTD; 176
var goN2AC; 177
n2RunThisWhen (n2sRTWTBS, 178
function() { 179
oAllCatPopover = new N2SimplePopover(); 180
goN2Events.registerFeature('two-tabs', 'oAllCatPopover', 'n2MouseOverHotspot', 'n2MouseOutHotspot'); 181
goN2Events.setFeatureDelays('two-tabs',200, 400, 200); 182
oAllCatPopover.initialize('AllCatPopoverDiv', 'oAllCatPopover',null,null,'below','c'); 183
}, 184
'All Categories popover'); 185
n2RunThisWhen(n2sRTW1, 186
function() { 187
if (!window.gaTD) gaTD = new Array(); 188
N2Loaded = goN2LibMon.isJSLoaded(); 189
}, "Last Init" 190
); 191





}

}