1/** 2 * wp image slideshow 3 * Copyright (C) 2011 - 2013 www.gopiplus.com 4 * http://www.gopiplus.com/work/2011/05/06/wordpress-plugin-wp-image-slideshow/ 5 * 6 * This program is free software: you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation, either version 3 of the License, or 9 * (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20var _wpiscount=0 21 22function wpis(wpis_imgarray, w, h, delay){ 23 this.id="_dropslide"+(++_wpiscount) //Generate unique ID for this slideshow instance (automated) 24 this.createcontainer(parseInt(w), parseInt(h)) 25 this.delay=delay 26 this.wpis_imgarray=wpis_imgarray 27 var preloadimages=[] 28 for (var i=0; i<wpis_imgarray.length; i++){ 29 preloadimages[i]=new Image() 30 preloadimages[i].src=wpis_imgarray[i][0] 31 } 32 this.animatestartpos=parseInt(h)*(-1) //Starting "top" position of an image before it drops in 33 this.wpis_slidedegree=10 //Slide degree (> is faster) 34 this.wpis_slidedelay=30 //Delay between slide animation (< is faster) 35 this.wpis_activecanvasindex=0 //Current "active" canvas- Two canvas DIVs in total 36 this.wpis_curimageindex=0 37 this.zindex=100 38 this.isMouseover=0 39 this.init() 40} 41 42 43wpis.prototype.createcontainer=function(w, h){
44 document.write('<div id="'+this.id+'" style="position:relative; width:'+w+'px; height:'+h+'px; overflow:hidden">') 45 document.write('<div style="position:absolute; width:'+w+'px; height:'+h+'px; top:0;"></div>') 46 document.write('<div style="position:absolute; width:'+w+'px; height:'+h+'px; top:-'+h+'px;"></div>') 47 document.write('</div>') 48 this.wpis_slideshowref=document.getElementById(this.id) 49 this.wpis_canvases=[] 50 this.wpis_canvases[0]=this.wpis_slideshowref.childNodes[0] 51 this.wpis_canvases[1]=this.wpis_slideshowref.childNodes[1] 52} 53 54wpis.prototype.populatecanvas=function(wpis_canvas, imageindex){ 55 var imageHTML='<img src="'+this.wpis_imgarray[imageindex][0]+'" style="border: 0" />' 56 if (this.wpis_imgarray[imageindex][1]!="") 57 imageHTML='<a href="'+this.wpis_imgarray[imageindex][1]+'" target="'+this.wpis_imgarray[imageindex][2]+'">'+imageHTML+'</a>' 58 wpis_canvas.innerHTML=imageHTML 59} 60 61 62wpis.prototype.animateslide=function(){ 63 if (this.curimagepos<0){ //if image hasn't fully dropped in yet 64 this.curimagepos=this.curimagepos+this.wpis_slidedegree 65 this.activecanvas.style.top=this.curimagepos+"px" 66 } 67 else{ 68 clearInterval(this.animatetimer) 69 this.activecanvas.style.top=0 70 this.setupnextslide() 71 var slideshow=this 72 setTimeout(function(){slideshow.rotateslide()}, this.delay) 73 } 74} 75 76 77wpis.prototype.setupnextslide=function(){ 78 this.wpis_activecanvasindex=(this.wpis_activecanvasindex==0)? 1 : 0 79 this.activecanvas=this.wpis_canvases[this.wpis_activecanvasindex] 80 this.activecanvas.style.top=this.animatestartpos+"px" 81 this.curimagepos=this.animatestartpos 82 this.activecanvas.style.zIndex=(++this.zindex) 83 this.wpis_curimageindex=(this.wpis_curimageindex<this.wpis_imgarray.length-1)? this.wpis_curimageindex+1 : 0 84 this.populatecanvas(this.activecanvas, this.wpis_curimageindex) 85} 86 87wpis.prototype.rotateslide=function(){ 88 var slideshow=this 89 if (this.isMouseover) 90 setTimeout(function(){slideshow.rotateslide()}, 50) 91 else 92 this.animatetimer=setInterval(function(){slideshow.animateslide()}, this.wpis_slidedelay) 93} 94 95wpis.prototype.init=function(){ 96 var slideshow=this 97 this.populatecanvas(this.wpis_canvases[this.wpis_activecanvasindex], 0
97) 98 this.setupnextslide() 99 this.wpis_slideshowref.onmouseover=function(){slideshow.isMouseover=1} 100 this.wpis_slideshowref.onmouseout=function(){slideshow.isMouseover=0} 101 setTimeout(function(){slideshow.rotateslide()}, this.delay) 102} 103
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.