温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:狂人论坛3.0源码
当前文件:
W3AWPMNK1EI77/Style/fader.js[7K,2009-6-12 11:58:00],打开代码结构图
W3AWPMNK1EI77/Style/fader.js[7K,2009-6-12 11:58:00],打开代码结构图1FDRboxWid = 700; 2
FDRboxHgt = 16; 3
FDRborWid = 0; 4
FDRborCol = "#070707"; 5
FDRborSty = "solid"; 6
FDRbackCol = ""; 7
FDRboxPad = 4; 8
9
FDRtxtAln = "center"; 10
FDRlinHgt = "6pt"; 11
FDRfntFam = "Verdana,Arial,Helvetica,sans-serif,宋体"; 12
FDRfntCol = ""; 13
FDRfntSiz = "9pt"; 14
FDRfntWgh = ""; 15
FDRfntSty = "normal"; 16
FDRlnkCol = "#000080"; 17
FDRlnkDec = "underline"; 18
FDRhovCol = "#2f2f4f"; 19
20
FDRgifSrc = "images/fade.gif"; 21
FDRgifInt = 60; 22
23
FDRblendInt = 6; 24
FDRblendDur = 1; 25
FDRmaxLoops = 100; 26
27
FDRendWithFirst = true; 28
FDRreplayOnClick = true; 29
30
FDRjustFlip = false; 31
FDRhdlineCount = 0; 32
33
NS4 = (document.layers); 34
IE4 = (document.all); 35
36
appVer = navigator.appVersion; 37
IEmac = (IE4 && appVer.indexOf("Mac") != -1); 38
IE4mac = (IEmac && appVer.indexOf("MSIE 4") != -1); 39
IE40mac = (IE4mac && appVer.indexOf("4.0;") != -1); 40
IE45mac = (IE4mac && appVer.indexOf("4.5;") != -1); 41
NSpre401 = (NS4 && (parseFloat(appVer) <= 4.01)); 42
NSpre403 = (NS4 && (parseFloat(appVer) <= 4.03)); 43
44
FDRjustFlip = (window.FDRjustFlip) ? FDRjustFlip : false; 45
FDRhdlineCount = (window.FDRhdlineCount) ? FDRhdlineCount : 1; 46
47
FDRfinite = (FDRmaxLoops > 0); 48
FDRisOver = false; 49
FDRloadCount = 0; 50
51
blendTimer = null; 52
53
if (!window.prefix) prefix = ""; 54
window.onload = FDRcountLoads; 55
56
if (NS4) { 57
if(FDRjustFlip || NSpre403) { 58
totalLoads = 1; 59
FDRfadeImg = new Object(); 60
FDRfadeImg.width = FDRboxWid - (FDRborWid*2);; 61
} 62
else { 63
totalLoads = 2; 64
FDRfadeImg = new Image(); 65
FDRfadeImg.onload = FDRcountLoads; 66
FDRfadeImg.onerror = FDRcountLoads; 67
FDRfadeImg.src = FDRgifSrc; 68
} 69
} 70
71
function FDRcountLoads(e) { 72
if (IE4) { 73
setTimeout("FDRinit()",1); 74
} 75
else { 76
if(e.type == "error") FDRjustFlip = true; 77
FDRloadCount++; 78
if (FDRloadCount==totalLoads) { 79
origWidth = innerWidth; 80
origHeight = innerHeight; 81
window.onresize = function(){ 82
if (innerWidth==origWidth && innerHeight==origHeight) return; 83
location.reload(); 84
} 85
FDRinit(); 86
} 87
} 88
} 89
90
function FDRinit(){ 91
if(!window.arNews) { 92
if(!window.arTXT || !window.arURL) return; 93
if(arTXT.length != arURL.length) return; 94
arNews = []; 95
for (i=0;i<arTXT.length;i++){ 96
arNews[arNews.length] = arTXT[i]; 97
arNews[arNews.length] = arURL[i]; 98
} 99
} 100
101
if (NS4) { 102
if (!document.elFader) return; 103
with(document.classes.newslink.A) { 104
textDecoration = FDRlnkDec; 105
color = FDRlnkCol; 106
fontWeight = FDRfntWgh; 107
fontSize = FDRfntSiz; 108
fontStyle = FDRfntSty; 109
fontFamily = FDRfntFam; 110
lineHeight = FDRlinHgt; 111
textAlign = FDRtxtAln; 112
} 113
with(document.classes.nolink.P) { 114
color = FDRfntCol; 115
fontWeight = FDRfntWgh; 116
fontSize = FDRfntSiz; 117
fontStyle = FDRfntSty; 118
fontFamily = FDRfntFam; 119
lineHeight = FDRlinHgt; 120
textAlign = FDRtxtAln; 121
} 122
elFader = document.elFader; 123
with (elFader) { 124
document.write(" "); 125
document.close(); 126
bgColor = FDRborCol; 127
clip.width = FDRboxWid; 128
clip.height = FDRboxHgt; 129
} 130
131
contWidth = FDRboxWid - (FDRborWid*2); 132
contHeight = FDRboxHgt - (FDRborWid*2); 133
elCont = new Layer(contWidth,elFader); 134
with (elCont) { 135
top = FDRborWid; 136
left = FDRborWid; 137
clip.width = contWidth; 138
clip.height = contHeight; 139
bgColor = FDRbackCol; 140
visibility = "inherit"; 141
} 142
143
newsWidth = contWidth - (FDRboxPad*2); 144
newsHeight = contHeight - (FDRboxPad*2); 145
elNews = new Layer(newsWidth,elCont); 146
with (elNews) { 147
top = FDRboxPad; 148
left = FDRboxPad; 149
clip.width = newsWidth ; 150
clip.height = newsHeight; 151
} 152
153
if (!FDRjustFlip) { 154
elGif = new Layer(contWidth,elCont); 155
imStr = "<IMG SRC='" + FDRgifSrc +"' WIDTH="+ Math.max(FDRfadeImg.width,(FDRboxWid - (FDRborWid*2))); 156
imStr += (NSpre403) ? " onError='window.FDRjustFlip = true'>" : ">"; 157
with (elGif) { 158
document.write(imStr); 159
document.close(); 160
moveAbove(elNews); 161
} 162
163
imgHeight = elGif.document.height; 164
slideInc = (imgHeight/(FDRblendDur*1000/FDRgifInt)); 165
startTop = -(imgHeight - FDRboxHgt); 166
} 167
168
elFader.visibility = "show"; 169
} 170
else { 171
if (!window.elFader) return; 172
elFader.innerHTML =""; 173
if(IE4mac) { 174
document.body.insertAdjacentHTML("BeforeBegin","<STYLE></STYLE>"); 175
} 176
else { 177
if (!document.styleSheets.length) document.createStyleSheet(); 178
} 179
with (document.styleSheets(document.styleSheets.length-1)) { 180
addRule("A.newslink","text-decoration:"+FDRlnkDec+";color:"+ FDRlnkCol); 181
addRule("A.newslink:hover","color:"+ FDRhovCol); 182
} 183
184
with (elFader.style) { 185
errorOffset = (IE4mac) ? (FDRboxPad + FDRborWid) : 0; 186
width = FDRboxWid - (errorOffset * 2); 187
height = FDRboxHgt - (errorOffset * 2); 188
if(IE4mac && !IE45mac){ 189
pixelLeft = elFader.offsetLeft + errorOffset; 190
pixelTop = elFader.offsetTop + errorOffset; 191
} 192
193
backgroundColor = FDRbackCol; 194
overflow = "hidden"; 195
color = FDRfntCol; 196
fontWeight = FDRfntWgh; 197
fontSize = FDRfntSiz; 198
fontStyle = FDRfntSty; 199
fontFamily = FDRfntFam; 200
lineHeight = FDRlinHgt; 201
textAlign = FDRtxtAln; 202
cursor = "default"; 203
visibility = "visible"; 204
borderWidth = FDRborWid; 205
borderStyle = FDRborSty; 206
borderColor = FDRborCol; 207
padding = FDRboxPad; 208
209
if(!FDRjustFlip) filter = "blendTrans(duration=" + FDRblendDur + ")"; 210
} 211
elFader.onselectstart = function(){return false}; 212
213
IEhasFilters = (elFader.filters.blendTrans) ? true : false; 214
215
} 216
217
if (!NSpre401) { 218
elFader.onmouseover = function (){ 219
FDRisOver = true; 220
} 221
elFader.onmouseout = function(){ 222
FDRisOver = false; 223
status = ""; 224
} 225
} 226
227
FDRstart(0); 228
} 229
230
function FDRstart(ind){ 231
newsCount = ind; 232
if (FDRfinite) loopCount = 0; 233
FDRdo(); 234
blendTimer = setInterval("FDRdo()",FDRblendInt*1000) 235
} 236
237
function FDRdo() { 238
if(!blendTimer && loopCount>0) return; 239
240
if (FDRfinite && loopCount==FDRmaxLoops) { 241
FDRend(); 242
return; 243
} 244
FDRfade(); 245
246
if (newsCount == arNews.length) { 247
newsCount = 0; 248
if (FDRfinite) loopCount++; 249
} 250
} 251
252
function FDRmakeStr(){ 253
tempStr = ""; 254
for (i=0;i<FDRhdlineCount;i++){ 255
if(newsCount>=arNews.length)break; 256
dispStr = arNews[newsCount]; 257
linkStr = arNews[newsCount+1]; 258
isLink = linkStr.length; 259
if (isLink) { 260
tempStr += "<P><A CLASS=newslink " 261
+ "HREF='" + prefix + linkStr + "'>" 262
+ dispStr + "</A></P>" 263
} 264
else { 265
tempStr += ((NS4) ? "<P CLASS=nolink>" : "<P>") +dispStr+"</P>"; 266
267
} 268
if(IE40mac) tempStr +="<BR>"; 269
newsCount += 2; 270
} 271
return tempStr; 272
} 273
274
function FDRfade(){ 275
newsStr = FDRmakeStr(); 276
277
if (NS4) { 278
if (!FDRjustFlip) { 279
elGif.top = startTop; 280
elGif.visibility = "inherit"; 281
} 282
283
elNews.visibility = "hide"; 284
with (elNews.document) { 285
write(newsStr); 286
close(); 287
} 288
elNews.visibility = "inherit"; 289
} 290
else { 291
if(IEhasFilters)elFader.filters.blendTrans.Apply(); 292
elFader.innerHTML = newsStr; 293
if(IEhasFilters)elFader.filters.blendTrans.Play(); 294
} 295
296
if(FDRhdlineCount==1) window.status = (FDRisOver && isLink) ? (prefix + linkStr) : ""; 297
298
if (NS4 && !FDRjustFlip) FDRslide(); 299
} 300
301
function FDRslide(){ 302
elGif.top += slideInc; 303
if (elGif.top >= 0) {elGif.visibility = "hide";return} 304
setTimeout("FDRslide()",FDRgifInt); 305
} 306
307
function FDRdblClickNS(){ 308
elFader.releaseEvents(Event.DBLCLICK); 309
FDRstart(startIndex); 310
return false; 311
} 312
313
function FDRend(){ 314
clearInterval(blendTimer); 315
316
blendTimer = null; 317
318
if (FDRendWithFirst) { 319
newsCount = 0; 320
FDRfade(); 321
} 322
if (FDRreplayOnClick) { 323
324
startIndex = FDRendWithFirst ? (FDRhdlineCount * 2) : 0; 325
if (IE4) { 326
elFader.title = "Double click to replay"; 327
elFader.ondblclick = function(){ 328
this.ondblclick = null; 329
this.title = ""; 330
FDRstart(startIndex); 331
} 332
} 333
else { 334
elFader.captureEvents(Event.DBLCLICK); 335
336
elFader.ondblclick = FDRdblClickNS; 337
338
} 339
} 340
} 341
342
343






totalLoads
}
}