1$alertcount=0; 2 3 var ua = navigator.userAgent; 4 var $IE = (navigator.appName == "Microsoft Internet Explorer"); 5 var $IE5 = $IE && (ua.indexOf('MSIE 5') != -1); 6 var $IE5_0 = $IE && (ua.indexOf('MSIE 5.0') != -1); 7 var $Gecko = ua.indexOf('Gecko') != -1; 8 var $Safari = ua.indexOf('Safari') != -1; 9 var $Opera = ua.indexOf('Opera') != -1; 10 var $Mac = ua.indexOf('Mac') != -1; 11 var $NS7 = ua.indexOf('Netscape/7') != -1; 12 var $NS71 = ua.indexOf('Netscape/7.1') != -1; 13 14 if ($Opera) { 15 $IE = true; 16 $Gecko = false; 17 $Safari = false; 18 } 19 if ($IE5) { 20 $IE = true; 21 $Gecko = false; 22 $Safari = false; 23 } 24 //alert(ua); 25 //alert($IE); 26function $_t(root,tag,id){ 27 var ar=root.getElementsByTagName(tag); 28 for (var i=0;i<ar.length;i++){ 29 if (ar[i].id==id) return ar[i]; 30 } 31 return null; 32} 33function _(root){ 34 35 var ids=arguments; 36 var i0=0; 37 38 if (typeof(root) == 'string') root = document; 39 else i0=1; 40 41 for (var i=i0;i<ids.length;i++){ 42 var s=root.getElementsByTagName("*"); 43 44 var has=false; 45 for (var j=0;j<s.length;j++){ 46 if (s[j].id==ids[i]){ 47 root=s[j]; 48 has=true; 49 break; 50 } 51 } 52 if (!has) return null; 53 } 54 return root; 55} 56//util 57 58 59function $dele(o,fn,rv){ 60 61 var r = function (){ 62 63 var s=arguments.callee; 64 65 var args = []; 66 for (var i=0;i<s.length;i++) args[i]=s[i]; 67 var argStr = args.join(","); 68 if (argStr.length > 0) argStr=","+argStr; 69 70 var callStr="s.thiz[s.fn]("+argStr+")"; 71 var v=eval(callStr); 72 73 74 if (s.rv!=null) { 75 return s.rv; 76 } else { 77 return v; 78 } 79 } 80 81 r.thiz=o; 82 r.fn=fn; 83 r.rv=rv; 84 85 return r; 86} 87 88function $ge(e){ 89 if (e!=null) return e; 90 if ($IE) { 91 return window.event; 92 } else return e; 93} 94 95/** 96* get event for a element; 97*/ 98function $gte(e,ev){ 99 if (!e.getElementById) e=e.ownerDocument; 100 if ($IE) { 101 return ev!=null ? ev : e.parentWindow.event; 102 } else { 103 return ev; 104 throw new Error("this method can only execute in IE"); 105 } 106} 107function $addEL(n,e,l,b){ 108 109 if ($IE){ 110 if (n["$__listener_"+e]==null){ 111 var lst=function (e){ 112 113 var f=arguments.callee; 114 var ar=f.fList; 115 116 e=$ge(e); 117 for (var i=0;i<ar.length;i++){ 118 ar[i](e); 119 } 120 } 121 lst.fList=[]; 122 n["$__listener_"+e]=lst; 123 n["on"+e]=n["$__listener_"+e]; 124 125 } 126 var fList=n["$__listener_"+e].fList; 127 fList[fList.length]=l; 128 129 } else { 130 n.addEventListener(e,l,b); 131 } 132} 133function $cancelEvent (e) { 134 if ($IE) { 135 e.returnValue = false; 136 e.cancelBubble = true; 137 138 } else 139 e.preventDefault(); 140}; 141 142function $cancelEventtan (e) { 143 window.open('#','','') 144}; 145 146function $cpAttr(o,p){ 147 for (var i in p){ 148 var s=p[i]; 149 o[i]=s; 150 } 151 return o; 152} 153function $getValue(v,d){ 154 return v==null ? d : v; 155} 156var $gv=$getValue; 157 158var $dom={ 159 parseInt : function(s) { 160 if (s == null || s == '' || typeof(s)=='undefined') 161 return 0; 162 163 return parseInt(s); 164 }, 165 getClientSize : function(n){ 166 if ($IE){ 167 //ts("this is ie"); 168 var s= {x:n.clientLeft,y:n.clientTop}; 169 s.l=s.x; 170 s.t=s.y; 171 s.r=n.clientRight; 172 s.b=n.clientBottom; 173 174 s.w=n.clientWidth; 175 s.h=n.clientHeight; 176 177 //tr("calculated client size"); 178 179 return s; 180 } else { 181 var t=n.style; 182 if (t.borderLeftWidth.length==0 || t.borderTopWidth.length==0 || t.borderRightWidth.length==0 || t.borderBottomWidth.length==0){ 183 184 var l=n.offsetWidth; 185 t.borderLeftWidth="0px"; 186 l-=n.offsetWidth; 187 188 var r=n.offsetWidth; 189 t.borderRightWidth="0px"; 190 r-=n.offsetWidth; 191 192 var o=n.offsetHeight; 193 t.borderTopWidth="0px"; 194 o-=n.offsetHeight; 195 196 var b=n.offsetHeight; 197 t.borderBottomWidth="0px"; 198 b-=n.offsetHeight; 199 200 t.borderLeftWidth=l+"px"; 201 t.borderTopWidth=o+"px"; 202 t.borderRightWidth=r+"px"; 203 t.borderBottomWidth=b+"px"; 204 205 var s={l:l,r:r,t:o,b:b,x:l,y:o}; 206 207 208 return s; 209 } else { 210 var s= { 211 x: this.parseInt(n.style.borderLeftWidth), 212 y: this.parseInt(n.style.borderTopWidth), 213 r: this.parseInt(n.style.borderRightWidth), 214 b: this.parseInt(n.style.borderBottomWidth) 215 }; 216 s.l=s.x; 217 s.t=s.y; 218 return s; 219 } 220 } 221 }, 222 223 224 225 getSize : function (n,withMargin){ 226 var c={ 227 x : n.offsetWidth != null ? n.offsetWidth : 0, 228 y : n.offsetHeight != null ? n.offsetHeight : 0 229 }; 230 231 //c.x=this.parseInt(c.x); 232 //c.y=this.parseInt(c.y); 233 234 //tr("get size for : "+n.id); 235 //tra(c); 236 if (withMargin) { 237 var m=this.getMargin(n); 238 c.x+=m.l+m.r; 239 c.y+=m.t+m.b; 240 } 241 //tra(m); 242 //tr("get size for : "+n.id); 243 //tra(c); 244 return c; 245 }, 246 247 setSize : function(elmt,x,y,withMargin){ 248 //tf("$dom::setSize"); 249 //if (elmt==undefined || elmt.style.display=="none") return; 250 if ($IE){ 251 if (withMargin){ 252 var m=this.getMargin(elmt); 253 x-=m.l+m.r; 254 y-=m.t+m.b; 255 } 256 elmt.style.width=x; 257 elmt.style.height=y; 258 } else { 259 var clientSize=this.getClientSize(elmt); 260 var dx=clientSize.l+clientSize.r; 261 262 var dy=clientSize.t+clientSize.b; 263 264 elmt.style.width=x-dx+"px"; 265 elmt.style.height=y-dy+"px"; 266 } 267 }, 268 269 /** 270 * get the context position relative to its parent. 271 */ 272 getPosition : function (elmt,withMargin){ 273 var c; 274 275 c={ 276 x:elmt.offsetLeft, 277 y:elmt.offsetTop 278 }; 279 //c.x=this.parseInt(c.x); 280 //c.y=this.parseInt(c.y); 281 if (withMargin){ 282 var m=this.getMargin(elmt); 283 c.x-=m.l; 284 c.y-=m.t; 285 } 286 287 return c; 288 }, 289 setPosition : function (elmt,x,y,withMargin){ 290 //tf("$dom::setPosition"); 291 if (withMargin){ 292 //var m=this.getMargin(elmt); 293 //x-=m.l; 294 //y-=m.t; 295 } 296 elmt.style.left=x+"px"; 297 elmt.style.top=y+"px"; 298 }, 299 300 301 setAlpha : function (n,a){ 302 return; 303 n.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity="+a*100+");"; 304 n.style.opacity = a; 305 n.style.MozOpacity = a; 306 } 307 308} 309var $motion={ 310 smooth : function (s, e, t){ 311 if (t>1) t=1; 312 return (e - s) * t + s; 313 } 314} 315 316// this is a default config object. 317/* 318var $config={ 319 width : 300, 320 height : 200, 321 bottom : 0, 322 right : 10,
323 display : true, 324 contentUrl : "/includes/pop/blogdaily.jsp", 325 time : { 326 slideIn : 10, 327 hold : 10, 328 slideOut : 10 329 } 330} 331*/ 332 333/** 334* PopUp class used to pop a message up. 335* Usage : 336* var pp = new PopUp(id, popup_config_obj); 337* pp.create(); 338* .... 339* pp.show(); 340*/ 341function PopUp(id, config){ 342 this.id=id; 343 344 var c = this.config = config; 345 c.width = $gv(c.width,300); 346 c.height = $gv(c.height,200); 347 c.bottom = $gv(c.bottom,0); 348 c.right = $gv(c.right,20); 349 c.display = $gv(c.display,true); 350 c.contentUrl= $gv(c.contentUrl,""); 351 c.motionFunc= $gv(c.motionFunc,$motion.smooth); 352 c.position = {x:0,y:0}; 353 354 var t=c.time; 355 t.slideIn = $gv(t.slideIn,10); 356 t.hold = $gv(t.hold,10); 357 t.slideOut = $gv(t.slideOut,10); 358 359 t.slideIn *= 1000; 360 t.hold *= 1000; 361 t.slideOut *= 1000; 362 363 this.container = document.body; 364 this.popup = null; 365 this.content = null; 366 this.switchButton = null; 367 368 this.moveTargetPosition = 0; 369 this.startMoveTime = null; 370 this.startPosition = null; 371 372 this.status = PopUp.STOP; 373 this.intervalHandle = null; 374 375 this.mm = "max"; 376 377 this.imgMin = "http://www.bokee.net/includes/pop/images/min.gif"; 378 this.imgMax = "http://www.bokee.net/includes/pop/images/max.gif"; 379} 380 381//static members 382PopUp.STOP = 0; 383PopUp.MOVE_DOWN = 1; 384PopUp.MOVE_UP = 2; 385PopUp.SWITCH_TO_MIN = PopUp.MOVE_DOWN | 4; 386PopUp.SWITCH_TO_MAX = PopUp.MOVE_UP | 8; 387 388var __o={ 389 create : function (){ 390 391 var doc=document; 392 var c=this.config; 393 394 //create popup holder & config it. 395 var p = this.popup = doc.createElement("div"); 396 this.container.appendChild(p); 397 398 p.id=this.id; 399 p.style.cssText="position:absolute;\ 400 z-index:9000;\ 401 overflow:hidden;\ 402 border:0px solid #f00;\ 403 "; 404 $dom.setSize(p, c.width, c.height); 405 406 407 408 //create popup content holder & config it. 409 var t = this.content = doc.createElement("div"); 410 p.appendChild(t); 411 412 t.id = this.id+"_content"; 413 t.style.cssText="position:absolute;\ 414 z-index:1;\ 415 overflow:hidden;"; 416 $dom.setSize(t, c.width, c.height); 417 $dom.setPosition(t,0,0);//add 418 419 c.position.y = c.height;//add 420 this.onresize();//add 421 //$dom.setPosition(t, 0, c.height);//hide it at first 422 423 424 // create content holder's content. 425 // a close button & an iframe for loading external content. 426 t.innerHTML = "<a id='closeButton' href='#'></a>"+ 427 "<a id='switchButton' href='#'></a>"+ 428 "<iframe id='"+this.id+"_content_iframe' src="+c.contentUrl+" frameborder=0 scrolling=no width='100%' height='100%'></iframe>"; 429 430 431 432 var sBtn = this.switchButton = $_t(t,'a',"switchButton"); 433 sBtn.style.cssText='position:absolute;\ 434 z-index:2;\ 435 \ 436 font-size:0px;\ 437 line-height:0px;\ 438 \ 439 left:228px;\ 440 top:4px;\ 441 width:17px;\ 442 height:15px;\ 443 \ 444 background-image:url("http://www.bokee.net/includes/pop/images/min.gif");'; 445 446 $addEL(sBtn,"click",$dele(this,"switchMode"),true); 447 $addEL(sBtn,"click",$cancelEvent,true); 448 //$addEL(sBtn,"click",$cancelEventtan,true); 449 450 451 var btn = $_t(t,'a',"closeButton"); 452 453 btn.style.cssText='position:absolute;\ 454 z-index:2;\ 455 \ 456 font-size:0px;\ 457 line-height:0px;\ 458 \ 459 left:248px;\ 460 top:4px;\ 461 width:17px;\ 462 height:15px;\ 463 \ 464 background-image:url("http://www.bokee.net/includes/pop/images/close.gif");'; 465 466 467 468 $addEL(btn,"mouseover",function (e){ 469 $dom.setAlpha(this,0.4); 470 },true); 471 472 $addEL(btn,"mouseout",function (e){ 473 $dom.setAlpha(this,1); 474 },true); 475 476 477 478 $addEL(btn,"click",$dele(this,"hide"),true); 479 $addEL(btn,"click",$cancelEvent,true); 480 //$addEL(btn,"click",$cancelEventtan,true); 481 482 483 var container=$IE ? document.body : document.documentElement; 484 485 $addEL(document.body,"resize",$dele(this,"onresize"),true); 486 487 this.__hackTimer=window.setInterval("__popup.onresize()",50); 488 489 490 $addEL(container,"scroll",$dele(this,"onresize"),true); 491 492 //initialize position at once. 493 this.onresize(); 494 495 }, 496 497 show : function (){ 498 499 if (!this.config.display) return; 500 501 this.moveTargetPosition = 0; 502 this.status = PopUp.MOVE_UP; 503 this.startMove(); 504 }, 505 506 hide : function (){ 507 508 this.moveTargetPosition = this.config.height; 509 this.status = PopUp.MOVE_DOWN; 510 this.startMove(); 511 }, 512 513 minimize : function (){ 514 //alert("minimize"); 515 this.mm = "min"; 516 this.moveTargetPosition = this.config.height - 24; 517 this.status = PopUp.SWITCH_TO_MIN; 518 this.startMove(); 519 520 var s = this.switchButton.style; 521 var bg = s.backgroundImage; 522 523 if (bg.indexOf(this.imgMin) > -1) { 524 bg = bg.replace(this.imgMin,this.imgMax); 525 s.backgroundImage = bg; 526 } 527 }, 528 529 maximize : function (){ 530 //alert("maximize"); 531 if (!this.config.display) return; 532 533 this.mm = "max"; 534 this.moveTargetPosition = 0; 535 this.status = PopUp.SWITCH_TO_MAX; 536 this.startMove(); 537 538 539 var s = this.switchButton.style; 540 var bg = s.backgroundImage; 541 542 if (bg.indexOf(this.imgMax) > -1) { 543 bg = bg.replace(this.imgMax,this.imgMin); 544 s.backgroundImage = bg; 545 } 546 }, 547 548 delayHide : function (){ 549 window.setTimeout("__popup.hide()",this.config.time.hold); 550 }, 551 552 delayMin : function (){ 553 window.setTimeout("__popup.minimize()",this.config.time.hold); 554 }, 555 556 switchMode : function (){ 557 //alert("switch"); 558 if (this.mm == "min"){ 559 this.maximize(); 560 } else { 561 this.minimize(); 562 } 563 }, 564 565 startMove : function (){ 566 this.stopMove(); 567 568 this.intervalHandle = window.setInterval("__popup.move()",100); 569 570 this.startMoveTime = new Date().getTime(); 571 //this.startPosition = $dom.getPosition(this.content).y;//parseInt(this.content.style.top); 572 this.startPosition = this.config.position.y; 573 }, 574 575 stopMove : function (){ 576 if (this.intervalHandle != null) window.clearInterval(this.intervalHandle); 577 this.intervalHandle = null; 578 }, 579 580 581 move : function (){ 582 583 584 var t = new Date().getTime(); 585 t = t - this.startMoveTime; 586 587 var total = this.status & PopUp.MOVE_UP ? 588 this.config.time.slideIn : 589 this.config.time.slideOut; 590 591 var y = this.config.motionFunc(this.startPosition, this.moveTargetPosition, t/total); 592 //this.content.style.top = y + "px"; 593 this.config.position.y = y; 594 this.onresize(); 595 596 if (t >= total){ 597 this.onFinishMove(); 598 } 599 }, 600 601 onFinishMove : function (){ 602 this.stopMove(); 603 //this.content.style.top = this.moveTargetPosition + "px"; 604 605 if (this.status == PopUp.MOVE_UP && this.config.time.hold > 0 ){ 606 this.delayMin(); 607 } else {
608 if (this.__hackTimer!=null) window.clearInterval(this.__hackTimer); 609 } 610 this.status = PopUp.STOP; 611 }, 612 613 onresize : function (){ 614 var c=this.config; 615 var t=document.documentElement; 616 //var t=document.body; 617 618 var dx=t.clientWidth + t.scrollLeft; 619 var dy=t.clientHeight + t.scrollTop; 620 621 var x = dx - c.right - c.width ; 622 var y = dy - c.bottom - c.height + c.position.y; 623 if($alertcount <5) { 624 $alertcount=$alertcount+1; 625 // alert("t.clientHeight="+t.clientHeight); 626 // alert("t.scrollTop="+t.scrollTop); 627 // alert("dy="+dy); 628 629 } 630 //alert(x); 631 //alert(y); 632 $dom.setPosition(this.popup, x, y); 633 $dom.setSize(this.popup, c.width, c.height-c.position.y); 634 } 635} 636 637$cpAttr(PopUp.prototype,__o); 638 639/*---------------------------------------*/ 640 641function readCookie(cookieName) 642{ 643var cookieString = document.cookie; 644 var start = cookieString.indexOf(cookieName + '='); 645 if (start == -1) 646 return null; 647 start += cookieName.length + 1; 648 var end = cookieString.indexOf(';', start); 649 if (end == -1) return unescape(cookieString.substring(start)); 650 return unescape(cookieString.substring(start, end)); 651} 652 653function writeCookie(cookieName, value, hours) 654{ 655 var expire = ""; 656 /** 657 if(hours != null) 658 { 659 expire = new Date((new Date()).getTime() + hours * 3600000); 660 expire = "; expires=" + expire.toGMTString(); 661 } 662 document.cookie = name + "=" + escape(value) + expire + ";path=/"; 663*/ 664 var expires = new Date(); 665 expires.setTime(expires.getTime() + 2*60*60*1000); 666 var the_cookie = cookieName+"=viewed;path=/;domain=.bokee.net;expires=" + expires.toGMTString(); 667 document.cookie = the_cookie; 668 669} 670 671/** 672* main function to config the pop-up window & run it. 673* web deployer change codes here to manipulte popups performance. 674* & should not change codes out of this function. 675*/ 676function job(){ 677 678 /** 679 * config object 680 */ 681 var cfg={ 682 //width & height of the popup window ,these values should be determined debpended on inner contents. 683 width : 270, 684 height : 160, 685 686 //distance to the bottom & the right edge. 687 bottom : 0, 688 right : 0, 689 690 //switch of displaying the popup 691 display : true, 692 693 //content url 694 contentUrl : "http://www.bokee.net/includes/pop/blogdaily.jsp", 695 696 //time configuration,in seconds 697 time : { 698 slideIn : 1, 699 hold : 60, 700 slideOut : 1 701 } 702 } 703 704 //at what time the popup should display,in hours : 0~23, 705 //the number after add symbol means after how many the hours to display popup for the next time. 706 var displayTimeList = ["7+7"]; 707 708 // the popup displays each time thie page reload or only once at the first time page loaded. 709 // once / eachTime 710var displayMode = "once"; 711// var displayMode = "eachTime"; 712 713 //cookie name storing the next time to display popup 714 var cookieName="bokeenet_blog_popup_next_display_time"; 715 716 717 718 /** 719 * --------------------- from here below, the codes should NOT be modified. 720 */ 721 var hours={}; 722 var delays=[]; 723 for (var i=0;i<displayTimeList.length;i++) { 724 var o = displayTimeList[i]; 725 var ar = o.split("+"); 726 var t = parseInt(ar[0]); 727 for (var m=0;m<ar.length-1;m++){ 728 ar[m]=ar[m+1]; 729 } 730 hours[t]=true; 731 for (var j=0;j<ar.length;j++){ 732 hours[t + parseInt(ar[j])]=true; 733 } 734 } 735 displayTimeList=[]; 736 for (var i in hours){ 737 var s = parseInt(i); 738 if (isNaN(s)) continue; 739 displayTimeList[displayTimeList.length]=s; 740 } 741 displayTimeList = displayTimeList.sort(); 742 //alert(displayTimeList); 743 744 745 var pp = new PopUp("xp", cfg); 746 window.__popup=pp; 747 pp.create(); 748 749 750 751 //display: 752 753 var n=readCookie(cookieName); 754 755 if (displayMode=="eachTime") 756 pp.show(); 757 else { 758 var tm=new Date().getTime(); 759 if (n==null || tm>n) { 760 pp.show(); 761 762 //get next display time 763 writeCookie(cookieName, "", ""); 764 } 765 } 766} 767 768function doit(){ 769 if (document.body == null) { 770 window.setTimeout(doit,500); 771 return; 772 } 773 774 job(); 775} 776 777//var dbg=document.getElementById("dbg"); 778 779//window.alert=function (m){ 780 //dbg.value+=m+"\n"; 781//} 782 783//doit(); 784function neoneo() { 785//if (document.all){ 786window.onload = job; 787//} 788} 789neoneo();
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.