1var RotateEls = function (selector,childSelector,navSelector,extNavSelector,startSlide,updateURL) { 2 this.selector = selector; 3 this.elSize = $(selector).find(childSelector).length; 4 this.firstLoad = true; 5 if(typeof(navSelector) !== "undefined"){ 6 this.navEl = navSelector; 7 } else { 8 this.navEl = null; 9 } 10 if(typeof(startSlide) !== "undefined"){ 11 this.curr = startSlide; 12 } else { 13 this.curr = 1; 14 } 15 var scopeThis = this; 16 17 this.next = function(){ 18 var temp = this.curr + 1; 19 if(temp > this.elSize){ 20 temp = 1; 21 } 22 this.curr = temp; 23 this.updateDOM(); 24 }; 25 this.prev = function(){ 26 var temp = this.curr - 1; 27 if(temp < 1){ 28 temp = this.elSize; 29 } 30 this.curr = temp; 31 this.updateDOM(); 32 }; 33 this.goto = function(index){ 34 this.curr = index; 35 this.updateDOM(); 36 }; 37 38 $('.next').on("click",function(){ 39 scopeThis.next(); 40 clearInterval(scopeThis.rotateGalTimer); 41 $(selector).removeClass("isCyclingAuto"); 42 }); 43 $(selector + ' img').on("click",function(){ 44 scopeThis.next(); 45 clearInterval(scopeThis.rotateGalTimer); 46 $(selector).removeClass("isCyclingAuto"); 47 }); 48 $('.prev').on("click",function(){ 49 scopeThis.prev(); 50 clearInterval(scopeThis.rotateGalTimer); 51 $(selector).removeClass("isCyclingAuto"); 52 }); 53 $(selector + ' .nav-dot, ' + extNavSelector).on("click",function(){ 54 scopeThis.goto($(this).index()+1); 55 clearInterval(scopeThis.rotateGalTimer); 56 $(selector).removeClass("isCyclingAuto"); 57 $(selector).addClass("userClicked"); 58 }); 59 60 scopeThis.rotateGalTimer = null; 61 scopeThis.startTimer = function(timingDuration){ 62 $(selector).addClass("isCyclingAuto"); 63 scopeThis.rotateGalTimer = setInterval(function(){ 64 scopeThis.next(); 65 },timingDuration); 66 }; 67 68 this.updateDOM = function(){ 69 $(selector + ' .active').removeClass("active"); 70 $(selector).find(childSelector).eq(scopeThis.curr-1).addClass("active"); 71 if(scopeThis.navEl !== null){ 72 $(scopeThis.navEl).eq(scopeThis.curr-1).addClass("active"); 73 } 74 if(scopeThis.navEl !== null){ 75 $(selector).find(scopeThis.extNavEl+'.active').removeClass("active"); 76 $(selector).find(scopeThis.extNavEl).eq(scopeThis.curr-1).addClass("active"); 77 } 78 79 $(".gal-curr").html(scopeThis.curr); 80 if(typeof(updateURL) !== "undefined" && updateURL === true){ 81 // window.location.hash = scopeThis.curr; 82 if(history.replaceState) { 83 if(scopeThis.firstLoad === true){ 84 scopeThis.firstLoad = false; 85 } else { 86 history.replaceState(null, null, '#'+scopeThis.curr); 87 } 88 } 89 } 90 }; 91 if(typeof(extNavSelector) !== "undefined"){ 92 this.extNavEl = extNavSelector; 93 $(this.extNavEl).addClass("hasNav"); 94 $(this.extNavEl).eq(0).addClass("active"); 95 $(extNavSelector).on("click",function(){ 96 scopeThis.curr = $(this).index() + 1; 97 scopeThis.updateDOM(); 98 $(".gallery-content").removeClass("grid-mode"); 99 }); 100 } else { 101 this.extNavEl = null; 102 } 103 this.updateDOM(); 104 105 $(document).on("keypress keydown", function(e){ 106 // console.log(e.which, e.keyCode); 107 if(e.keyCode === 39) { 108 scopeThis.next(); 109 clearInterval(scopeThis.rotateGalTimer); 110 $(selector).removeClass("isCyclingAuto"); 111 } else if (e.keyCode == 37) { 112 scopeThis.prev(); 113 clearInterval(scopeThis.rotateGalTimer); 114 $(selector).removeClass("isCyclingAuto"); 115 } 116 }); 117}; 118 119 120var RotatePls = function (selector,childSelector,captionSelector,pauseBtn,resumeBtn,timingDuration) { 121 this.selector = selector; 122 this.pauseBtn = $(selector).find(pauseBtn); 123 this.resumeBtn = $(selector).find(resumeBtn); 124 this.elSize = $(selector).find(childSelector).length; 125 126 this.curr = 1; 127 128 var scopeThis = this; 129 130 this.next = function(){ 131 var temp = this.curr + 1; 132 if(temp > this.elSize){ 133 temp = 1; 134 } 135 this.curr = temp; 136 this.updateDOM(); 137 }; 138 139 $(scopeThis.pauseBtn).on("click",function(){ 140 $(selector).addClass("paused"); 141 clearInterval(scopeThis.rotateGalTimer); 142 }); 143 144 $(scopeThis.resumeBtn).on("click",function(){ 145 $(selector).removeClass("paused"); 146 scopeThis.startTimer(timingDuration); 147 }); 148 149 scopeThis.rotateGalTimer = null; 150 scopeThis.startTimer = function(timingDuration){ 151 scopeThis.rotateGalTimer = setInterval(function(){ 152 scopeThis.next(); 153 },timingDuration); 154 }; 155 156 this.updateDOM = function(){ 157 $(selector).find('.active').removeClass("active"); 158 $(selector).find('.activeCaption').removeClass("activeCaption"); 159 // $(selector + ' .active').removeClass("active"); 160 $(selector).find(childSelector).eq(scopeThis.curr-1).addClass("active"); 161 $(selector).find(captionSelector).eq(scopeThis.curr-1).addClass("activeCaption"); 162 }; 163 164 this.updateDOM(); 165};
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.