1 2/* 3 ================================================ 4 PVII Image Rotator Magic 2 scripts 5 Copyright (c) 2014 Project Seven Development 6 www.projectseven.com 7 Version: 2.1.5 -build 09 8 ================================================ 9 10*/ 11 12var p7IR2={ 13 ctl: [], 14 status: false, 15 once: false, 16 prf: 'none', 17 boxAnimDuration: 400, 18 swipeDuration: 400, 19 animDelay: (1000/60) 20}; 21function P7_IR2set(){ 22 var i,h,sh='',ie=P7_IR2getIEver(); 23 if(!document.getElementById || (ie>4 && ie<6)){ 24 return; 25 } 26 sh+='div.p7ir2-box {overflow:hidden;padding:0;margin:0;border:0;}\n'; 27 sh+='div.p7ir2-slide {height:auto;width:100%;top:0;left:0;overflow:hidden;padding:0;margin:0;}\n'; 28 sh+='.p7ir2-image {filter:inherit;}\n'; 29 sh+='.p7ir2-paginator {display:block !important;}\n'; 30 sh+='.p7ir2-toolbar {display:block !important;}\n'; 31 sh+='.p7ir2-arrows {display:block !important;}\n'; 32 sh+='.p7ir2-image.p7ir2-max {width:auto !important;max-width:100%;margin:auto;}\n'; 33 sh+='.p7ir2-pointer {touch-action: pan-y pinch-zoom;}\n'; 34 sh+='.p7ir2-ms-pointer {ms-touch-action: pan-y pinch-zoom;}\n'; 35 p7IR2.prf=P7_IR2getCSSPre(); 36 if(document.styleSheets){ 37 if(ie>4 && ie<8){ 38 } 39 h='\n<st' + 'yle type="text/css">\n'+sh+'\n</s' + 'tyle>'; 40 document.write(h); 41 } 42 else{ 43 P7_HLSaddSheet(sh); 44 } 45} 46P7_IR2set(); 47function P7_IR2op(){ 48 if(!document.getElementById){ 49 return; 50 } 51 p7IR2.ctl[p7IR2.ctl.length]=arguments; 52} 53function P7_IR2bb(){ 54} 55function P7_IR2addLoad(){ 56 var ie=P7_IR2getIEver(); 57 if(!document.getElementById || (ie>4 && ie<6)){ 58 return; 59 } 60 if(window.addEventListener){ 61 window.addEventListener("load",P7_IR2init,false); 62 window.addEventListener("unload",P7_IR2bb,false); 63 window.addEventListener("resize",P7_IR2rsz,false); 64 } 65 else if(window.attachEvent){ 66 document.write("<script id=p7ie_ir2 defer src=\"//:\"><\/script>"); 67 document.getElementById("p7ie_ir2").onreadystatechange=function(){ 68 if (this.readyState=="complete"){ 69 if(p7IR2.ctl.length>0){ 70 P7_IR2init(); 71 } 72 } 73 }; 74 window.attachEvent("onload",P7_IR2init); 75 window.attachEvent("onunload",P7_IR2bb); 76 window.attachEvent("onresize",P7_IR2rsz); 77 } 78} 79P7_IR2addLoad(); 80function P7_IR2init(){ 81 var i,j,k,tD,bx,el,tU,tA,tC,ie,pli=0,cN,tR,cl,md; 82 if(p7IR2.once){ 83 return; 84 } 85 p7IR2.once=true; 86 document.p7ir2pre=[]; 87 ie=P7_IR2getIEver(); 88 for(j=0;j<p7IR2.ctl.length;j++){ 89 tD=document.getElementById(p7IR2.ctl[j][0]); 90 if(tD){ 91 tD.p7opt=p7IR2.ctl[j]; 92 el=document.createElement('div'); 93 el.setAttribute('id',tD.id.replace('_','ldg_')); 94 el.className='p7ir2-loading'; 95 tD.ir2Loading=el; 96 tD.appendChild(el); 97 if(p7IR2.prf=='none' && tD.p7opt[1]>3){ 98 tD.p7opt[1]=1; 99 } 100 if(tD.p7opt[1]!=2 && ie>4 && ie<8){ 101 tD.p7opt[1]=0; 102 } 103 tD.ir2ShowMode='pause'; 104 bx=document.getElementById(tD.id.replace('_','box_')); 105 tD.ir2Box=bx; 106 bx.ir2Div=tD; 107 tD.ir2Controls=[]; 108 tD.ir2Slides=[]; 109 tD.ir2CurrentSlideNum=0; 110 tD.ir2NumPlays=1; 111 tU=document.getElementById(tD.id.replace('_','list_')); 112 if(tD.p7opt[3]===0){ 113 P7_IR2randomizer(tU); 114 tD.p7opt[3]=1; 115 } 116 tA=tU.getElementsByTagName('A'); 117 k=0; 118 for(i=0;i<tA.length;i++){ 119 if(tA[i].parentNode.nodeName=="LI"){ 120 k++; 121 tD.ir2Slides[k]=tA[i]; 122 tA[i].ir2Div=tD.id; 123 tA[i].ir2SlideNum=k; 124 tD.ir2SlideNums=tD.ir2Slides.length-1; 125 document.p7ir2pre[pli]=new Image(); 126 document.p7ir2pre[pli].cmp=false; 127 document.p7ir2pre[pli].ir2Div=tD.id; 128 tA[i].ir2PreIndex=pli; 129 tA[i].ir2PreImage=document.p7ir2pre[pli]; 130 if(k<2){ 131 document.p7ir2pre[pli].src=tA[i].href; 132 } 133 pli++; 134 tA[i].ir2Desc=false; 135 cN=tA[i].parentNode.childNodes; 136 for(var kk=0;kk<cN.length;kk++){ 137 cl=cN[kk].className; 138 if(cl && /ir2_desc/i.test(cl)){ 139 tA[i].ir2Desc=cN[kk].innerHTML; 140 tA[i].ir2DescClass='p7ir2-description'+cl.replace('p7ir2_desc',''); 141 } 142 if(cl && /ir2_link/i.test(cl)){ 143 el=cN[kk].getElementsByTagName('A'); 144 if(el && el[0]){ 145 tA[i].ir2Link=el[0]; 146 } 147 } 148 } 149 } 150 } 151 tD.ir2Swipe=false; 152 P7_IR2bindSwipe(tD.ir2Box,function(dir){ 153 var tD=this.ir2Div; 154 tD.ir2Swipe=true; 155 if(dir=='left'){ 156 P7_IR2control(tD.id,'next',null,true); 157 } 158 else if(dir=='right'){ 159 P7_IR2control(tD.id,'prev',null,true); 160 } 161 } 162 ); 163 tD.ir2Paginators=[]; 164 el=document.getElementById(tD.id.replace('_','pg_'));
165 if(el){ 166 tA=el.getElementsByTagName('A'); 167 if(tA){ 168 for(k=0;k<tA.length;k++){ 169 if(tA[k].id && tA[k].id.indexOf('p7IR2pg')===0 && tA[k].id.indexOf('p7IR2pgpp_')==-1){ 170 tA[k].ir2Div=tD.id; 171 tA[k].ir2SlideNum=P7_IR2parsePN(tA[k].id); 172 tD.ir2Paginators[tD.ir2Paginators.length]=tA[k]; 173 tA[k].onclick=function(){ 174 return P7_IR2paginator(this); 175 }; 176 } 177 } 178 } 179 } 180 el=document.getElementById(tD.id.replace('_','pgpp_')); 181 if(el){ 182 el.p7state='pause'; 183 el.ir2Div=tD.id; 184 tD.ir2Controls[7]=el; 185 el.onclick=function(){ 186 var ac=(this.p7state=='play')?'pause':'play'; 187 P7_IR2control(this.ir2Div,ac); 188 return false; 189 }; 190 el.ir2SetButtonState=function(st){ 191 var tx; 192 if(st=='play'){ 193 tx='Pause'; 194 P7_IR2remClass(this,'play'); 195 } 196 else{ 197 tx='Play'; 198 P7_IR2setClass(this,'play'); 199 } 200 this.innerHTML=tx; 201 this.setAttribute('title',tx); 202 }; 203 } 204 tD.ir2Controls[0]=P7_IR2setCC(tD.id,'bp_','prev'); 205 tD.ir2Controls[1]=P7_IR2setCC(tD.id,'bn_','next'); 206 tD.ir2Controls[3]=P7_IR2setCC(tD.id,'rp_','prev'); 207 tD.ir2Controls[5]=P7_IR2setCC(tD.id,'rn_','next'); 208 el=document.getElementById(tD.id.replace('_','rpp_')); 209 if(el){ 210 el.p7state='pause'; 211 el.ir2Div=tD.id; 212 tD.ir2Controls[4]=el; 213 el.onclick=function(){ 214 var ac=(this.p7state=='play')?'pause':'play'; 215 P7_IR2control(this.ir2Div,ac); 216 return false; 217 }; 218 el.ir2SetButtonState=function(st){ 219 var tx; 220 if(st=='play'){ 221 tx='Pause'; 222 P7_IR2remClass(this,'play'); 223 } 224 else{ 225 tx='Play'; 226 P7_IR2setClass(this,'play'); 227 } 228 this.setAttribute('title',tx); 229 }; 230 } 231 if(tD.p7opt[10]==1){ 232 tD.ir2ShowResume=false; 233 tD.ir2Box.onmouseover=function(){ 234 var tD,d=this.id.replace('box',''); 235 tD=document.getElementById(d); 236 if(tD.ir2ShowMode=='play'){ 237 tD.ir2ShowResume=true; 238 P7_IR2pause(d); 239 } 240 }; 241 tD.onmouseout=function(evt){ 242 if(this.ir2ShowResume){ 243 var tg,pp,m=true,d; 244 d=this.id; 245 evt=(evt)?evt:event; 246 tg=(evt.toElement)?evt.toElement:evt.relatedTarget; 247 if(tg){ 248 pp=tg; 249 while(pp){ 250 if(pp.id&&pp.id.indexOf(d)===0){ 251 m=false; 252 break; 253 } 254 pp=pp.parentNode; 255 } 256 } 257 if(m){ 258 this.ir2ShowResume=false; 259 if(this.ir2ShowTimer){ 260 clearTimeout(this.ir2ShowTimer); 261 } 262 this.ir2ShowMode='play'; 263 if(this.ir2ShowTimer){ 264 clearTimeout(this.ir2ShowTimer); 265 } 266 this.ir2ShowTimer=setTimeout("P7_IR2control('"+this.id+"','play')",1000); 267 } 268 } 269 }; 270 } 271 tD.ir2CurrentSlideNum=tD.p7opt[3]; 272 P7_IR2url(tD.id); 273 if(tD.ir2CurrentSlideNum<0 || tD.ir2CurrentSlideNum>tD.ir2Slides.length){ 274 tD.ir2CurrentSlideNum=1; 275 } 276 tD.ir2Init=true; 277 if(tD.p7opt[4]==1){ 278 tD.ir2ShowMode='play'; 279 if(tD.ir2Controls[4]){ 280 tD.ir2Controls[4].p7state='play'; 281 tD.ir2Controls[4].ir2SetButtonState('play'); 282 } 283 if(tD.ir2Controls[7]){ 284 tD.ir2Controls[7].p7state='play'; 285 tD.ir2Controls[7].ir2SetButtonState('play'); 286 } 287 } 288 P7_IR2showImage(tD.id,tD.ir2CurrentSlideNum,1); 289 } 290 } 291} 292function P7_IR2ctrl(dv,ac){ 293 return P7_IR2control(dv,ac); 294} 295function P7_IR2control(dv,ac,bp,tch){ 296 var i,tD,cs,ts,op,sn,eI,eC,eD,tm=0,pauseOnAction,rs=false,m=false; 297 tD=document.getElementById(dv); 298 if(tD&&tD.ir2Slides){ 299 if(tD.ir2ShowTimer){ 300 clearTimeout(tD.ir2ShowTimer); 301 } 302 pauseOnAction=(tD.p7opt[8]==1)?true:false; 303 cs=tD.ir2CurrentSlideNum; 304 ts=tD.ir2SlideNums; 305 if(ac=='pause'){ 306 P7_IR2pause(dv); 307 return m; 308 } 309 if(!bp && pauseOnAction){ 310 P7_IR2pause(dv); 311 tD.ir2ShowResume=false; 312 } 313 if(ac=='play'){ 314 tD.ir2ShowMode='play'; 315 tD.ir2ShowResume=false; 316 if(tD.ir2Controls[4]){ 317 tD.ir2Controls[4].p7state='play'; 318 tD.ir2Controls[4].ir2SetButtonState('play'); 319 } 320 if(tD.ir2Controls[7]){
321 tD.ir2Controls[7].p7state='play'; 322 tD.ir2Controls[7].ir2SetButtonState('play'); 323 } 324 ac='next'; 325 rs=true; 326 } 327 if(ac=='first'){ 328 tD.ir2Direction='left'; 329 sn=1; 330 } 331 else if(ac=='prev'){ 332 tD.ir2Direction='left'; 333 sn=cs-1; 334 if(sn<1){ 335 sn=ts; 336 } 337 } 338 else if(ac=='next'){ 339 sn=cs+1; 340 tD.ir2Direction='right'; 341 if(tD.ir2ShowMode=='play'){ 342 if(sn>ts){ 343 tD.ir2NumPlays++; 344 if(tD.p7opt[6]>0 && tD.ir2NumPlays>tD.p7opt[6]){ 345 tD.ir2NumPlays=0; 346 sn=(tD.p7opt[7]==1)?1:tD.ir2SlideNums; 347 P7_IR2pause(tD.id); 348 } 349 else{ 350 sn=1; 351 } 352 } 353 } 354 else{ 355 if(sn>ts){ 356 sn=1; 357 } 358 } 359 } 360 else if(ac=='last'){ 361 tD.ir2Direction='right'; 362 sn=ts; 363 } 364 else{ 365 tD.ir2Direction='right'; 366 sn=ac; 367 } 368 sn=(sn<1)?1:sn; 369 sn=(sn>tD.ir2SlideNums)?tD.ir2SlideNums:sn; 370 if(sn==tD.ir2CurrentSlideNum&&bp!=1){ 371 return m; 372 } 373 if(rs){ 374 tm=100; 375 setTimeout("P7_IR2showImage('"+tD.id+"',"+sn+","+bp+")",tm ); 376 } 377 else{ 378 P7_IR2showImage(tD.id,sn,bp,tch); 379 } 380 } 381 return false; 382} 383function P7_IR2pause(d){ 384 var cD,tD=document.getElementById(d); 385 if(tD){ 386 tD.ir2ShowMode='pause'; 387 if(tD.ir2ShowTimer){ 388 clearTimeout(tD.ir2ShowTimer); 389 } 390 if(tD.ir2Controls[4]){ 391 tD.ir2Controls[4].p7state='pause'; 392 tD.ir2Controls[4].ir2SetButtonState('pause'); 393 } 394 if(tD.ir2Controls[7]){ 395 tD.ir2Controls[7].p7state='pause'; 396 tD.ir2Controls[7].ir2SetButtonState('pause'); 397 } 398 } 399} 400function P7_IR2paginator(a){ 401 P7_IR2control(a.ir2Div,a.ir2SlideNum); 402 return false; 403} 404function P7_IR2setPaginators(d){ 405 var i,tD,tA; 406 tD=document.getElementById(d); 407 tA=tD.ir2Paginators; 408 for(i=0;i<tA.length;i++){ 409 if(tA[i]){ 410 P7_IR2remClass(tA[i],'down'); 411 if(tA[i].ir2SlideNum==tD.ir2CurrentSlideNum){ 412 P7_IR2setClass(tA[i],'down'); 413 } 414 } 415 } 416} 417function P7_IR2showImage(dv,sn,bp,tch){ 418 var i,tD,tA,tB,sW,iM,aM,el; 419 bp=(bp)?bp:null; 420 tD=document.getElementById(dv); 421 if(tD.ir2CurrentSlideNum==sn && bp!=1){ 422 return false; 423 } 424 if(tD.ir2ShowTimer){ 425 clearTimeout(tD.ir2ShowTimer); 426 } 427 if(tD.ir2Wait){ 428 clearTimeout(tD.ir2Wait); 429 } 430 tD.ir2CurrentSlideNum=sn; 431 P7_IR2setPaginators(tD.id); 432 tA=tD.ir2Slides[sn]; 433 tB=tD.ir2Box; 434 tB.style.height= P7_IR2getDim(tB,'height')+'px'; 435 sW=document.createElement('div'); 436 sW.className='p7ir2-slide'; 437 sW.ir2Div=tD; 438 sW.ir2Box=tB; 439 sW.style.position='absolute'; 440 sW.style.visibility='hidden'; 441 aM=document.createElement('A'); 442 aM.className='p7ir2-image-link'; 443 if(tA.ir2Link){ 444 aM.setAttribute('href',tA.ir2Link.getAttribute('href')); 445 aM.setAttribute('title',tA.ir2Link.innerHTML); 446 if(tA.ir2Link.target && tA.ir2Link.target!==''){ 447 aM.setAttribute('target',tA.ir2Link.target); 448 } 449 } 450 iM=document.createElement('IMG'); 451 iM.className='p7ir2-image'; 452 P7_IR2setImage(iM); 453 iM.ir2Cnt=0; 454 iM.src=tA.href; 455 if(tD.p7opt[11]>0){ 456 P7_IR2setClass(iM,'p7ir2-max'); 457 iM.style.maxHeight=tD.p7opt[11]+'px'; 458 } 459 iM.oncontextmenu=function(){ 460 return false; 461 }; 462 aM.appendChild(iM); 463 sW.appendChild(aM); 464 sW.ir2Desc=tA.ir2Desc; 465 if(sW.ir2Desc){ 466 el=document.createElement('div'); 467 el.className=tA.ir2DescClass; 468 sW.appendChild(el); 469 sW.ir2Description=el; 470 sW.ir2Description.innerHTML=sW.ir2Desc; 471 } 472 tB.appendChild(sW); 473 sW.ir2Image=iM; 474tD.ir2Wait=setInterval(function(){ 475 P7_IR2loadImage(tD,sW,iM,sn,bp,tch); 476} 477,60); 478} 479function P7_IR2loadImage(tD,sW,im,sn,bp,tch){ 480 im.ir2Cnt++; 481 if(im.cmp && im.complete && im.height>10 && im.width > 10){ 482 clearTimeout(tD.ir2Wait); 483 tD.ir2Loading.style.display='none'; 484 P7_IR2dispA(tD.id,sn,sW,bp,tch); 485 } 486 else{ 487 if(im.ir2Cnt>3){ 488 tD.ir2Loading.style.display='block'; 489 } 490 } 491 if(im.ir2Cnt>100){ 492 clearTimeout(tD.ir2Wait); 493 if(tD.ir2ShowMode=='play'){ 494 if(tD.ir2ShowTimer){ 495 clearTimeout(tD.ir2ShowTimer); 496 } 497 tD.ir2ShowTimer=setTimeout("P7_IR2control('"+tD.id+"','next',2)",200); 498 } 499 } 500} 501function P7_IR2setImage(im){ 502 this.p7Status=''; 503 im.onload=function(){ 504 this.cmp=true; 505 }; 506 im.onerror=function(){ 507 this.p7Status='load_error'; 508 }; 509} 510function P7_IR2dispA(dv,sn,sW,bp,tch){ 511 var tD,bX,an,x,dur,fh,th,trsnd; 512 tD=document.getElementById(dv); 513 bX=tD.ir2Box; 514 if(tD.ir2CurrentSlideNum!=sn){ 515 return false; 516 } 517 an=(bp && bp==1)?0:tD.p7opt[1];
518 dur=tD.p7opt[2]; 519 trsnd=(p7IR2.prf=='-webkit-'?'webkitTransitionEnd':'transitionend'); 520 sW.ir2ImgHeight=sW.ir2Image.height; 521 sW.ir2ImgWidth=sW.ir2Image.width; 522 sW.ir2State='current'; 523 P7_IR2setClass(sW,'current-slide'); 524 bX.ir2CurrentSlide=sW; 525 if(an>0){ 526 bX.ir2AdjH=false; 527 fh=P7_IR2getDim(sW.ir2Box,'height'); 528 th=P7_IR2getDim(sW,'height'); 529 bX.ir2StartHeight=fh; 530 bX.ir2FinHeight=th; 531 if(Math.abs(th-fh)>1){ 532 if(th>fh){ 533 bX.ir2AdjH=true; 534 } 535 else if (fh!=th){ 536 P7_IR2animate(bX,'height','px',fh,th,300,'linear'); 537 } 538 } 539 } 540 if(tch){ 541 an=2; 542 dur=p7IR2.swipeDuration; 543 } 544 if(an==1){ 545 P7_IR2fade(sW,5,100,dur,'quad',function(){ 546 P7_IR2dispB(this); 547 } 548 ); 549 P7_IR2dispFin(dv,sn,bp); 550 } 551 else if(an==2){ 552 x=sW.offsetWidth; 553 if(tD.ir2Direction=='left'){ 554 x=x*-1; 555 } 556 sW.style.left=x+'px'; 557 P7_IR2animate(sW,'left','px',x,0,dur,'quad',function(){ 558 P7_IR2dispB(this); 559 } 560 ); 561 P7_IR2dispFin(dv,sn,bp); 562 } 563 else if(an==3){ 564 x=sW.offsetHeight; 565 if(tD.ir2Direction=='left'){ 566 x=x*-1; 567 } 568 sW.style.top=x+'px'; 569 P7_IR2animate(sW,'top','px',x,0,dur,'quad',function(){ 570 P7_IR2dispB(this); 571 } 572 ); 573 P7_IR2dispFin(dv,sn,bp); 574 } 575 else if(an==4){ 576 x=100; 577 if(tD.ir2Direction=='left'){ 578 x=x*-1; 579 } 580 sW.style.left=x+'px'; 581 sW.style.opacity=0; 582 sW.style.visibility='visible'; 583 sW.offsetWidth = sW.offsetWidth; 584 sW.style[p7IR2.prf+'transition']='all '+dur+'ms ease-out'; 585 if(sW.ir2animB){ 586 clearTimeout(sW.ir2animB); 587 } 588sW.ir2animB=setTimeout(function(){ 589 P7_IR2dispB(sW); 590} 591,dur); 592sW.style.left='0px'; 593sW.style.opacity=1; 594P7_IR2dispFin(dv,sn,bp); 595} 596else if(an==5){ 597sW.style[p7IR2.prf+'transform']='scale(0.1,1)'; 598sW.style.opacity=1; 599sW.style.visibility='visible'; 600sW.offsetWidth = sW.offsetWidth; 601sW.style[p7IR2.prf+'transition']='all '+dur+'ms linear'; 602if(sW.ir2animB){ 603 clearTimeout(sW.ir2animB); 604} 605sW.ir2animB=setTimeout(function(){ 606 P7_IR2dispB(sW); 607} 608,dur); 609sW.style[p7IR2.prf+'transform']='scale(1,1)'; 610P7_IR2dispFin(dv,sn,bp); 611} 612else if(an==6){ 613sW.style[p7IR2.prf+'transform']='scale(0.1,0.1)'; 614sW.style.opacity=1; 615sW.style.visibility='visible'; 616sW.offsetWidth = sW.offsetWidth; 617sW.style[p7IR2.prf+'transition']='all '+dur+'ms linear'; 618if(sW.ir2animB){ 619 clearTimeout(sW.ir2animB); 620} 621sW.ir2animB=setTimeout(function(){ 622 P7_IR2dispB(sW); 623} 624,dur); 625sW.style[p7IR2.prf+'transform']='scale(1,1)'; 626P7_IR2dispFin(dv,sn,bp); 627} 628else{ 629sW.style.visibility='visible'; 630tD.ir2Box.style.height=P7_IR2getDim(tD.ir2Box.ir2CurrentSlide,'height')+'px'; 631P7_IR2dispFin(dv,sn,bp); 632} 633P7_IR2hideSlide(tD,null,tch,bp); 634} 635function P7_IR2dispB(sW){ 636 var fh,th; 637 if(!sW || sW.parentNode.ir2CurrentSlide != sW){ 638 return; 639 } 640 if(sW.parentNode.ir2AdjH){ 641 fh=sW.ir2Box.ir2StartHeight; 642 th=sW.ir2Box.ir2FinHeight; 643 if(Math.abs(fh-th)>1){ 644 P7_IR2animate(sW.ir2Box,'height','px',fh,th,300,'linear',function(){ 645 } 646 ); 647 } 648 } 649} 650function P7_IR2getDim(el,d){ 651 var b,x; 652 b=el.getBoundingClientRect(); 653 x=b.bottom-b.top; 654 return x; 655} 656function P7_IR2dispFin(dv,sn,bp){ 657 var tD,ns,tA,tm; 658 tD=document.getElementById(dv); 659 if(tD.ir2CurrentSlideNum!=sn){ 660 return false; 661 } 662 tm=tD.p7opt[5]*1000; 663 if(tD.ir2Init){ 664 tD.ir2Init=false; 665 tm=tD.p7opt[9]*1000; 666 } 667 ns=tD.ir2CurrentSlideNum+1; 668 ns=(ns<=tD.ir2Slides.length-1)?ns:1; 669 tA=tD.ir2Slides[ns]; 670 if(!tA.ir2PreImage.cmp){ 671 tA.ir2PreImage.src=tA.href; 672 } 673 if(tD.ir2ShowMode=='play'){ 674 tD.ir2ShowMode='play'; 675 tD.ir2ShowResume=false; 676 if(tD.ir2ShowTimer){ 677 clearTimeout(tD.ir2ShowTimer); 678 } 679 tD.ir2ShowTimer=setTimeout("P7_IR2control('"+tD.id+"','next',2)",tm); 680 } 681} 682function P7_IR2removeSlide(bX,op){ 683 op=(op>-1)?op:1; 684 if(bX.hasChildNodes()){ 685 while(bX.childNodes.length>op){ 686 bX.removeChild(bX.childNodes[0]); 687 } 688 } 689} 690function P7_IR2hideSlide(tD,ac,tch,bp){ 691 var x,bX,sW,trsnd,op,an,dur,dV; 692 an=(tch)?2:tD.p7opt[1]; 693 an=(bp==1)?0:an; 694 dur=(tch)?p7IR2.swipeDuration:tD.p7opt[2]; 695 op=(ac=='all')?0:1; 696 trsnd=(p7IR2.prf=='-webkit-'?'webkitTransitionEnd':'transitionend'); 697 bX=tD.ir2Box; 698 dV=bX.getElementsByTagName('div'); 699 if(dV && dV.length > op){ 700 sW=dV[0]; 701 sW.ir2State='closed'; 702 sW.style.position='absolute'; 703 P7_IR2setClass(sW,'closed-slide'); 704 if(an==1){ 705 P7_IR2fade(sW,100,0,dur,'quad',function(){ 706 P7_IR2removeSlide(bX,op); 707 } 708 ); 709 } 710 else if (an==2){ 711 x=bX.offsetWidth*-1; 712 if(tD.ir2Direction=='left'){ 713 x=x*-1; 714 } 715 P7_IR2animate(sW,'left','px',0,x,dur,'quad',function(){ 716 P7_IR2removeSlide(bX,op); 717 } 718 ); 719 } 720 else if (an==3){ 721 x=bX.offsetHeight*-1; 722 if(tD.ir2Direction=='left'){ 723 x=x*-1; 724 } 725 P7_IR2animate(sW,'top','px',0,x,dur,'quad',function(){ 726 P7_IR2removeSlide(bX,op); 727 } 728 ); 729 } 730 else if (an==4){ 731 x=-100; 732 if(tD.ir2Direction=='left'){ 733 x=x*-1; 734 } 735 sW.offsetWidth=sW.offsetWidth; 736 sW.style[p7IR2.prf+'transition']='all '+dur+'ms ease-out'; 737 if(sW.ir2animB){ 738 clearTimeout(sW.ir2animB);
739 } 740sW.ir2animB=setTimeout(function(){ 741 P7_IR2removeSlide(bX,op); 742} 743,dur); 744sW.style.left=x+'px'; 745sW.style.opacity=0.6; 746} 747else if (an==5){ 748sW.offsetWidth=sW.offsetWidth; 749sW.style[p7IR2.prf+'transition']='all '+dur+'ms ease-out'; 750if(sW.ir2animB){ 751 clearTimeout(sW.ir2animB); 752} 753sW.ir2animB=setTimeout(function(){ 754 P7_IR2removeSlide(bX,op); 755} 756,dur); 757sW.style.opacity=0.2; 758} 759else if (an==6){ 760sW.offsetWidth=sW.offsetWidth; 761sW.style[p7IR2.prf+'transition']='all '+dur+'ms ease-out'; 762if(sW.ir2animB){ 763 clearTimeout(sW.ir2animB); 764} 765sW.ir2animB=setTimeout(function(){ 766 P7_IR2removeSlide(bX,op); 767} 768,dur); 769sW.style.opacity=0.2; 770} 771else{ 772P7_IR2removeSlide(bX,op); 773} 774} 775} 776function P7_IR2getTime(st){ 777 var d = new Date(); 778 return d.getTime() - st; 779} 780function P7_IR2anim(tp,t,b,c,d){ 781 if(tp=='quad'){ 782 if((t/=d/2)<1){ 783 return c/2*t*t+b; 784 } 785 else{ 786 return -c/2*((--t)*(t-2)-1)+b; 787 } 788 } 789 else{ 790 return (c*(t/d))+b; 791 } 792} 793function P7_IR2fade(ob,from,to,dur,typ,cb){ 794 if(ob.p7FadeRunning){ 795 clearInterval(ob.p7Fade); 796 ob.p7FadeRunning=false; 797 } 798 typ=(!typ)?'quad':typ; 799 ob.p7fadeType=typ; 800 ob.p7StartFade=from; 801 ob.p7FinishFade=to; 802 ob.p7CurrentFade=ob.p7StartFade; 803 if(ob.filters){ 804 ob.style.filter='alpha(opacity='+ob.p7CurrentFade+')'; 805 } 806 else{ 807 ob.style.opacity=ob.p7CurrentFade/100; 808 } 809 ob.style.visibility='visible'; 810 ob.fadeStartTime=P7_IR2getTime(0); 811 ob.fadeDuration=dur; 812 ob.p7FadeRunning=true; 813ob.p7Fade=setInterval(function(){ 814 P7_IR2fader(ob,cb); 815} 816,p7IR2.animDelay); 817} 818function P7_IR2fader(el,cb){ 819 var i,tC,tA,op,et,cet,m=false; 820 et=P7_IR2getTime(el.fadeStartTime); 821 if(et>=el.fadeDuration){ 822 et=el.fadeDuration; 823 m=true; 824 } 825 if(el.p7CurrentFade!=el.p7FinishFade){ 826 op=P7_IR2anim(el.p7fadeType,et,el.p7StartFade,el.p7FinishFade-el.p7StartFade,el.fadeDuration); 827 el.p7CurrentFade=op; 828 if(el.filters){ 829 el.style.filter='alpha(opacity='+el.p7CurrentFade+')'; 830 } 831 else{ 832 el.style.opacity=el.p7CurrentFade/100; 833 } 834 } 835 if(m){ 836 el.p7FadeRunning=false; 837 clearInterval(el.p7Fade); 838 if(el.filters){ 839 el.style.filter=''; 840 } 841 else{ 842 el.style.opacity=1; 843 } 844 if(cb && typeof(cb) === "function"){ 845 cb.call(el); 846 } 847 } 848} 849function P7_IR2animate(ob,prop,un,fv,tv,dur,typ,cb){ 850 if(ob.p7AnimRunning){ 851 ob.p7AnimRunning=false; 852 clearInterval(ob.p7IR2anim); 853 } 854 typ=(!typ)?'quad':typ; 855 ob.p7animType=typ; 856 ob.p7animProp=prop; 857 ob.p7animUnit=un; 858 ob.p7animStartVal=fv; 859 ob.p7animCurrentVal=ob.p7animStartVal; 860 ob.p7animFinishVal=tv; 861 ob.style[ob.p7animProp]=ob.p7animCurrentVal+ob.p7animUnit; 862 ob.style.visibility='visible'; 863 ob.p7animStartTime=P7_IR2getTime(0); 864 ob.p7animDuration=dur; 865 if(!ob.p7AnimRunning){ 866 ob.p7AnimRunning=true; 867ob.p7IR2anim=setInterval(function(){ 868 P7_IR2animator(ob,cb); 869} 870, p7IR2.animDelay); 871} 872} 873function P7_IR2animator(el,cb,op){ 874 var i,tB,tA,tS,et,nv,m=false; 875 et=P7_IR2getTime(el.p7animStartTime); 876 if(et>=el.p7animDuration){ 877 et=el.p7animDuration; 878 m=true; 879 } 880 if(el.p7animCurrentVal!=el.p7animFinishVal){ 881 nv=P7_IR2anim(el.p7animType, et, el.p7animStartVal, el.p7animFinishVal-el.p7animStartVal, el.p7animDuration); 882 el.p7animCurrentVal=nv; 883 el.style[el.p7animProp]=nv+el.p7animUnit; 884 } 885 if(m){ 886 el.p7AnimRunning=false; 887 clearInterval(el.p7IR2anim); 888 if(cb && typeof(cb) === "function"){ 889 cb.call(el); 890 } 891 } 892} 893function P7_IR2rsz(bp){ 894 var j,tD; 895 for(j=0;j<p7IR2.ctl.length;j++){ 896 tD=document.getElementById(p7IR2.ctl[j][0]); 897 if(tD && tD.ir2Box){ 898 P7_IR2resizer(tD); 899 } 900 } 901} 902function P7_IR2resizer(tD){ 903 var bX,th; 904 bX=tD.ir2Box; 905 if(bX.ir2CurrentSlide){ 906 if(bX.p7AnimRunning){ 907 bX.p7AnimRunning=false; 908 clearInterval(bX.p7IR2anim); 909 } 910 th=P7_IR2getDim(bX.ir2CurrentSlide,'height'); 911 bX.style.height=th+'px'; 912 } 913} 914var p7IR2tch={ 915 el: null, 916 fCnt: 0, 917 startX: 0, 918 startY: 0, 919 curX: 0, 920 curY: 0 921}; 922function P7_IR2tchStart(evt){ 923 if(evt.pointerType){ 924 p7IR2tch.fCnt=1; 925 p7IR2tch.startX=evt.clientX; 926 p7IR2tch.startY=evt.clientY; 927 if(!p7IR2tch.el){ 928 p7IR2tch.el=this; 929 } 930 } 931 else if(evt.touches.length==1){ 932 p7IR2tch.fCnt=evt.touches.length; 933 p7IR2tch.startX=evt.touches[0].pageX; 934 p7IR2tch.startY=evt.touches[0].pageY; 935 if(!p7IR2tch.el){ 936 p7IR2tch.el=this; 937 } 938 } 939 else{ 940 P7_IR2tchCancel(evt); 941 } 942}
943function P7_IR2tchMove(evt){ 944 var x; 945 if(p7IR2tch.startX!==0){ 946 if(evt.pointerType){ 947 x=Math.abs(evt.clientX-p7IR2tch.startX); 948 if(x>4 || navigator.maxTouchPoints || navigator.msMaxTouchPoints){ 949 evt.stopPropagation(); 950 evt.preventDefault(); 951 p7IR2tch.curX=evt.clientX; 952 p7IR2tch.curY=evt.clientY; 953 } 954 else{ 955 P7_IR2tchCancel(evt); 956 } 957 } 958 else if(evt.touches.length==1){ 959 x=Math.abs(evt.touches[0].pageX-p7IR2tch.startX); 960 if(x>4){ 961 evt.stopPropagation(); 962 evt.preventDefault(); 963 p7IR2tch.curX=evt.touches[0].pageX; 964 p7IR2tch.curY=evt.touches[0].pageY; 965 } 966 else{ 967 P7_IR2tchCancel(evt); 968 } 969 } 970 else{ 971 P7_IR2tchCancel(evt); 972 } 973 } 974 else{ 975 P7_IR2tchCancel(evt); 976 } 977} 978function P7_IR2tchEnd(evt){ 979 var swl,swa,swd,x,y,z,r; 980 if(p7IR2tch.fCnt==1 && p7IR2tch.curX!==0){ 981 evt.preventDefault(); 982 swl=Math.round(Math.sqrt(Math.pow(p7IR2tch.curX - p7IR2tch.startX,2) + Math.pow(p7IR2tch.curY - p7IR2tch.startY,2))); 983 if(swl>=72){ 984 x=p7IR2tch.startX-p7IR2tch.curX; 985 y=p7IR2tch.curY-p7IR2tch.startY; 986 r=Math.atan2(y,x); 987 swa=Math.round(r*180/Math.PI); 988 if(swa<0){ 989 swa=360-Math.abs(swa); 990 } 991 if((swa<=45)&&(swa>=0)){ 992 swd='left'; 993 } 994 else if((swa<=360)&&(swa>=315)){ 995 swd='left'; 996 } 997 else if((swa>=135)&&(swa<=225)){ 998 swd='right'; 999 } 1000 else if((swa>45)&&(swa<135)){ 1001 swd='down'; 1002 } 1003 else{ 1004 swd='up'; 1005 } 1006 p7IR2tch.el.onSwiped(swd); 1007 P7_IR2tchCancel(evt); 1008 } 1009 else{ 1010 P7_IR2tchCancel(evt); 1011 } 1012 } 1013 else{ 1014 P7_IR2tchCancel(evt); 1015 } 1016} 1017function P7_IR2tchCancel(evt){ 1018 p7IR2tch.fCnt=0; 1019 p7IR2tch.startX=0; 1020 p7IR2tch.startY=0; 1021 p7IR2tch.curX=0; 1022 p7IR2tch.curY=0; 1023 p7IR2tch.el=null; 1024} 1025function P7_IR2bindSwipe(ob,fn){ 1026 if(ob.addEventListener){ 1027 ob.onSwiped=fn; 1028 if(navigator.maxTouchPoints){ 1029 ob.addEventListener('pointerdown',P7_IR2tchStart,false); 1030 ob.addEventListener('pointerup',P7_IR2tchEnd,false); 1031 ob.addEventListener('pointermove',P7_IR2tchMove,false); 1032 P7_IR2setClass(ob,'p7ir2-pointer'); 1033 } 1034 else if(navigator.msMaxTouchPoints){ 1035 ob.addEventListener('MSPointerDown',P7_IR2tchStart,false); 1036 ob.addEventListener('MSPointerUp',P7_IR2tchEnd,false); 1037 ob.addEventListener('MSPointerMove',P7_IR2tchMove,false); 1038 P7_IR2setClass(ob,'p7ir2-ms-pointer'); 1039 } 1040 else{ 1041 ob.addEventListener('touchstart',P7_IR2tchStart,false); 1042 ob.addEventListener('touchend',P7_IR2tchEnd,false); 1043 ob.addEventListener('touchmove',P7_IR2tchMove,false); 1044 ob.addEventListener('touchcancel',P7_IR2tchCancel,false); 1045 } 1046 } 1047} 1048function P7_IR2url(dv){ 1049 var i,h,s,x,k,d='ir2',pn,tD,n=dv.replace('p7IR2_',''); 1050 tD=document.getElementById(dv); 1051 h=document.location.search; 1052 if(h){ 1053 h=h.replace('?',''); 1054 s=h.split(/[=&]/g); 1055 if(s&&s.length){ 1056 for(i=0;i<s.length;i+=2){ 1057 if(s[i]==d){ 1058 x=s[i+1]; 1059 if(n!=x.charAt(0)){ 1060 x=false; 1061 } 1062 if(x&&x.length>2){ 1063 tD.ir2CurrentSlideNum=P7_IR2parsePN(x); 1064 } 1065 } 1066 } 1067 } 1068 } 1069 h=document.location.hash; 1070 if(h){ 1071 x=h.substring(1,h.length); 1072 if(n!=x.charAt(3)){ 1073 x=false; 1074 } 1075 if(x&&x.indexOf(d)===0&&x.length>5){ 1076 tD.ir2CurrentSlideNum=P7_IR2parsePN(x); 1077 } 1078 } 1079} 1080function P7_IR2parsePN(d){ 1081 var x=d.lastIndexOf('_'); 1082 return parseInt(d.substr(x+1),10); 1083} 1084function P7_IR2randomize(){ 1085 return 0.5-Math.random(); 1086} 1087function P7_IR2randomizer(ul){ 1088 var i,tI=[],cn,k=0,rn; 1089 cn=ul.childNodes; 1090 for(i=0;i<cn.length;i++){ 1091 tI[i]=cn[i]; 1092 } 1093 tI.sort(P7_IR2randomize); 1094 while(k<tI.length){ 1095 ul.appendChild(tI[k]); 1096 k++; 1097 } 1098} 1099function P7_IR2addSheet(sh){ 1100 var h,hd; 1101 h=document.createElement('style'); 1102 h.type='text/css'; 1103 h.appendChild(document.createTextNode(sh)); 1104 hd=document.getElementsByTagName('head'); 1105 hd[0].appendChild(h); 1106} 1107function P7_IR2getIEver(){ 1108 var j,v=-1,nv,m=false; 1109 nv=navigator.userAgent.toLowerCase(); 1110 j=nv.indexOf("msie"); 1111 if(j>-1){ 1112 v=parseFloat(nv.substring(j+4,j+8)); 1113 if(document.documentMode){ 1114 v=document.documentMode; 1115 } 1116 } 1117 return v; 1118} 1119function P7_IR2getCSSPre(){ 1120 var i,dV,pre=['animationDuration','WebkitAnimationDuration']; 1121 var c='none',cssPre=['','-webkit-']; 1122 dV=document.createElement('div'); 1123 for(i=0;i<pre.length;i++){ 1124 if(dV.style[pre[i]]!==undefined){ 1125 c=cssPre[i]; 1126 break; 1127 } 1128 } 1129 p7IR2prf=c; 1130 return c; 1131} 1132function P7_IR2setCC(dd,rp,ac){ 1133 var d,tC; 1134 d=dd.replace('_',rp); 1135 tC=document.getElementById(d); 1136 if(tC){ 1137 tC.onclick=function(){ 1138 return P7_IR2control(dd,ac); 1139 }; 1140 } 1141 return tC; 1142} 1143function P7_IR2setClass(ob,cl){ 1144 if(ob){ 1145 var cc,nc,r=/\s+/g; 1146 cc=ob.className; 1147 nc=cl; 1148 if(cc&&cc.length>0){ 1149 if(cc.indexOf(cl)==-1){ 1150 nc=cc+' '+cl; 1151 } 1152 else{ 1153 nc=cc; 1154 } 1155 } 1156 nc=nc.replace(r,' '); 1157 ob.className=nc; 1158 } 1159} 1160function P7_IR2remClass(ob,cl){ 1161 if(ob){ 1162 var cc,nc; 1163 cc=ob.className; 1164 if(cc&&cc.indexOf(cl>-1)){ 1165 nc=cc.replace(cl,''); 1166 nc=nc.replace(/\s+/g,' '); 1167 nc=nc.replace(/\s$/,''); 1168 nc=nc.replace(/^\s/,''); 1169 ob.className=nc; 1170 } 1171 } 1172}
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.