1(function ($, window, i) { 2 $.fn.responsiveSlides = function (options) { 3 var settings = $.extend({ 4 "auto": false, 5 "speed": 500, 6 "timeout": 4000, 7 "pager": false, 8 "nav": false, 9 "controller": false, 10 "random": false, 11 "pause": false, 12 "pauseControls": true, 13 "prevText": "<span>Previous</span>", 14 "nextText": "<span>Next</span>", 15 "autoText": "<span>Play/Pause</span>", 16 "maxwidth": "", 17 "navContainer": "", 18 "autoController": "", 19 "manualControls": "", 20 "namespace": "rslides", 21 "before": $.noop, 22 "after": $.noop 23 }, options); 24 return this.each(function () { 25 i++; 26 var $this = $(this), 27 vendor, selectTab, startCycle, restartCycle, rotate, $tabs, index = 0, 28 $slide = $this.children(), 29 length = $slide.length, 30 fadeTime = parseFloat(settings.speed), 31 waitTime = parseFloat(settings.timeout), 32 maxw = parseFloat(settings.maxwidth), 33 namespace = settings.namespace, 34 namespaceIdx = namespace, 35 navClass = namespace + "_nav ", 36 activeClass = namespace + "_here", 37 autoClass = namespace + "_auto ", 38 visibleClass = namespaceIdx + "_on", 39 slideClassPrefix = namespaceIdx, 40 $pager = $("<ul class='" + namespace + "_tabs " + namespaceIdx + "_tabs' />"), 41 visible = { 42 "float": "left", 43 "position": "relative", 44 "opacity": 1, 45 "zIndex": 2 46 }, 47 hidden = { 48 "float": "none", 49 "position": "absolute", 50 "opacity": 0, 51 "zIndex": 1 52 }, 53 supportsTransitions = (function () { 54 var docBody = document.body || document.documentElement; 55 var styles = docBody.style; 56 var prop = "transition"; 57 if (typeof styles[prop] === "string") { 58 return true; 59 } 60 vendor = ["webkit", "khtml", "moz", "ms", "o"]; 61 prop = prop.charAt(0).toUpperCase() + prop.substr(1); 62 var i; 63 for (i = 0; i < vendor.length; i++) { 64 if (typeof styles[vendor[i] + prop] === "string") { 65 return true; 66 } 67 } 68 return false; 69 })(), 70 slideTo = function (idx) { 71 settings.before(idx); 72 if (supportsTransitions) { 73 $slide.removeClass(visibleClass).css(hidden).eq(idx).addClass(visibleClass).css(visible); 74 index = idx; 75 setTimeout(function () { 76 settings.after(idx); 77 }, fadeTime); 78 } else { 79 $slide.stop().fadeOut(fadeTime, function () { 80 $(this).removeClass(visibleClass).css(hidden).css("opacity", 1); 81 }).eq(idx).fadeIn(fadeTime, function () { 82 $(this).addClass(visibleClass).css(visible); 83 settings.after(idx); 84 index = idx; 85 }); 86 } 87 }; 88 if (settings.random) { 89 $slide.sort(function () { 90 return (Math.round(Math.random()) - 0.5); 91 }); 92 $this.empty().append($slide); 93 } 94 $slide.each(function (i) { 95 this.id = slideClassPrefix + i; 96 }); 97 $this.addClass(namespace + " " + namespaceIdx); 98 if (options && options.maxwidth) { 99 $this.css("max-width", maxw); 100 } 101 $slide.hide().css(hidden).eq(0).addClass(visibleClass).css(visible).show(); 102 if (supportsTransitions) { 103 $slide.show().css({ 104 "-webkit-transition": "opacity " + fadeTime + "ms ease-in-out", 105 "-moz-transition": "opacity " + fadeTime + "ms ease-in-out", 106 "-o-transition": "opacity " + fadeTime + "ms ease-in-out", 107 "transition": "opacity " + fadeTime + "ms ease-in-out" 108 }); 109 } 110 if ($slide.length > 1) { 111 if (waitTime < fadeTime + 100) { 112 return; 113 }
114 if (settings.pager && !settings.manualControls) { 115 var tabMarkup = []; 116 $slide.each(function (i) { 117 var n = i + 1; 118 tabMarkup += "<li>" + "<a href='javascript:void(0);' class='" + slideClassPrefix + n + "'>" + n + "</a>" + "</li>"; 119 }); 120 $pager.append(tabMarkup); 121 if (options.navContainer) { 122 $(settings.navContainer).append($pager); 123 } else { 124 $this.after($pager); 125 } 126 } 127 if (settings.manualControls) { 128 $pager = $(settings.manualControls); 129 $pager.addClass(namespace + "_tabs " + namespaceIdx + "_tabs"); 130 } 131 if (settings.pager || settings.manualControls) { 132 $pager.find('li').each(function (i) { 133 $(this).addClass(slideClassPrefix + (i + 1)); 134 }); 135 } 136 if (settings.pager || settings.manualControls) { 137 $tabs = $pager.find('a'); 138 selectTab = function (idx) { 139 $tabs.closest("li").removeClass(activeClass).eq(idx).addClass(activeClass); 140 }; 141 } 142 if (settings.auto) { 143 startCycle = function () { 144 rotate = setInterval(function () { 145 $slide.stop(true, true); 146 var idx = index + 1 < length ? index + 1 : 0; 147 if (settings.pager || settings.manualControls) { 148 selectTab(idx); 149 } 150 slideTo(idx); 151 }, waitTime); 152 }; 153 startCycle(); 154 } 155 restartCycle = function () { 156 if (settings.auto) { 157 clearInterval(rotate); 158 startCycle(); 159 } 160 }; 161 if (settings.pause) { 162 $this.hover(function () { 163 clearInterval(rotate); 164 }, function () { 165 restartCycle(); 166 }); 167 } 168 if (settings.pager || settings.manualControls) { 169 $tabs.bind("mouseover", function (e) { 170 e.preventDefault(); 171 if (!settings.pauseControls) { 172 restartCycle(); 173 } 174 var idx = $tabs.index(this); 175 if (index === idx || $("." + visibleClass).queue('fx').length) { 176 return; 177 } 178 selectTab(idx); 179 slideTo(idx); 180 }).eq(0).closest("li").addClass(activeClass); 181 if (settings.pauseControls) { 182 $tabs.hover(function () { 183 clearInterval(rotate); 184 }, function () { 185 restartCycle(); 186 }); 187 } 188 } 189 if (settings.nav) { 190 var navMarkup = "<a href='javascript:void(0);' title='Previous Slide' class='" + navClass + " slidePrev'>" + settings.prevText + "</a>" + "<a href='javascript:void(0);' title='Next Slide' class='" + navClass + " slideNext'>" + settings.nextText + "</a>"; 191 if (options.navContainer) { 192 $(settings.navContainer).append(navMarkup); 193 } else { 194 $this.after(navMarkup); 195 } 196 var $trigger = $("." + namespaceIdx + "_nav"), 197 $prev = $trigger.filter(".prev"); 198 $trigger.bind("click", function (e) { 199 e.preventDefault(); 200 var $visibleClass = $("." + visibleClass); 201 if ($visibleClass.queue('fx').length) { 202 return; 203 } 204 var idx = $slide.index($visibleClass), 205 prevIdx = idx - 1, 206 nextIdx = idx + 1 < length ? index + 1 : 0; 207 slideTo($(this)[0] === $prev[0] ? prevIdx : nextIdx); 208 if (settings.pager || settings.manualControls) { 209 selectTab($(this)[0] === $prev[0] ? prevIdx : nextIdx); 210 } 211 if (!settings.pauseControls) { 212 restartCycle(); 213 } 214 }); 215 if (settings.pauseControls) { 216 $trigger.hover(function () { 217 clearInterval(rotate); 218 }, function () { 219 restartCycle(); 220 }); 221 } 222 } 223 if (settings.controller) { 224 var autoMarkup = "<a href='javascript:void(0);' title='Pause' class='" + autoClass + " autoPlay slidePause'>" + settings.autoText + "</a>"; 225 if (options.autoController) { 226 $(settings.autoController).append(autoMarkup); 227 } else { 228 $this.after(autoMarkup); 229 } 230 var $trigger = $("." + namespace + "_auto"); 231 var count = 0; 232 $trigger.bind("click", function (e) { 233 e.preventDefault(); 234 count++; 235 var isEven = function (someNumber) { 236 return (someNumber % 2 === 0) ? true : false; 237 }; 238 if (isEven(count) === false) { 239 $(this).removeClass('slidePause'); 240 $(this).addClass('slidePlay'); 241 $(this).html('<span>Play</span>'); 242 if (settings.auto || settings.pauseControls || settings.pause || settings.pager || settings.manualControls || settings.nav) { 243 clearInterval(rotate); 244 $this.mouseleave(function () { 245 clearInterval(rotate); 246 }); 247 } 248 } else if (isEven(count) === true) { 249 $(this).removeClass('slidePlay'); 250 $(this).addClass('slidePause'); 251 $(this).html('<span>
251Pause</span>'); 252 if (settings.auto || settings.pauseControls || settings.pause || settings.pager || settings.manualControls || settings.nav) { 253 restartCycle(); 254 $this.mouseleave(function () { 255 restartCycle(); 256 }); 257 } 258 } 259 }); 260 } 261 } 262 if (typeof document.body.style.maxWidth === "undefined" && options.maxwidth) { 263 var widthSupport = function () { 264 $this.css("width", "100%"); 265 if ($this.width() > maxw) { 266 $this.css("width", maxw); 267 } 268 }; 269 widthSupport(); 270 $(window).bind("resize", function () { 271 widthSupport(); 272 }); 273 } 274 }); 275 }; 276})(jQuery, this, 0);
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.