1//alert('responsive'); 2/*! ResponsiveSlides.js v1.55 3 * http://responsiveslides.com 4 * https://arie.ls 5 * 6 * Copyright (c) 2011-2023 @arielsalminen 7 * Available under the MIT license 8 */ 9 10/*jslint browser: true, sloppy: true, vars: true, plusplus: true, indent: 2 */ 11 12(function ($, window, i) { 13 $.fn.responsiveSlides = function (options) { 14 15 // Default settings 16 var settings = $.extend({ 17 "auto": true, // Boolean: Animate automatically, true or false 18 "speed": 500, // Integer: Speed of the transition, in milliseconds 19 "timeout": 4000, // Integer: Time between slide transitions, in milliseconds 20 "pager": false, // Boolean: Show pager, true or false 21 "nav": false, // Boolean: Show navigation, true or false 22 "random": false, // Boolean: Randomize the order of the slides, true or false 23 "pause": false, // Boolean: Pause on hover, true or false 24 "pauseControls": true, // Boolean: Pause when hovering controls, true or false 25 "prevText": "Previous", // String: Text for the "previous" button 26 "nextText": "Next", // String: Text for the "next" button 27 "maxwidth": "", // Integer: Max-width of the slideshow, in pixels 28 "navContainer": "", // Selector: Where auto generated controls should be appended to, default is after the <ul> 29 "manualControls": "", // Selector: Declare custom pager navigation 30 "namespace": "rslides", // String: change the default namespace used 31 "before": $.noop, // Function: Before callback 32 "after": $.noop // Function: After callback 33 }, options); 34 35 return this.each(function () { 36 37 // Index for namespacing 38 i++; 39 40 var $this = $(this), 41 42 // Local variables 43 vendor, 44 selectTab, 45 startCycle, 46 restartCycle, 47 rotate, 48 $tabs, 49 50 // Helpers 51 index = 0, 52 $slide = $this.children(), 53 length = $slide.length, 54 fadeTime = parseFloat(settings.speed), 55 waitTime = parseFloat(settings.timeout), 56 maxw = parseFloat(settings.maxwidth), 57 58 // Namespacing 59 namespace = settings.namespace, 60 namespaceIdx = namespace + i, 61 62 // Classes 63 navClass = namespace + "_nav " + namespaceIdx + "_nav", 64 activeClass = namespace + "_here", 65 visibleClass = namespaceIdx + "_on", 66 slideClassPrefix = namespaceIdx + "_s", 67 68 // Pager 69 $pager = $("<ul class='" + namespace + "_tabs " + namespaceIdx + "_tabs' />"), 70 71 // Styles for visible and hidden slides 72 visible = {"float": "left", "position": "relative", "opacity": 1, "zIndex": 2},
73 hidden = {"float": "none", "position": "absolute", "opacity": 0, "zIndex": 1}, 74 75 // Detect transition support 76 supportsTransitions = (function () { 77 var docBody = document.body || document.documentElement; 78 var styles = docBody.style; 79 var prop = "transition"; 80 if (typeof styles[prop] === "string") { 81 return true; 82 } 83 // Tests for vendor specific prop 84 vendor = ["Moz", "Webkit", "Khtml", "O", "ms"]; 85 prop = prop.charAt(0).toUpperCase() + prop.substr(1); 86 var i; 87 for (i = 0; i < vendor.length; i++) { 88 if (typeof styles[vendor[i] + prop] === "string") { 89 return true; 90 } 91 } 92 return false; 93 })(), 94 95 // Fading animation 96 slideTo = function (idx) { 97 settings.before(idx); 98 // If CSS3 transitions are supported 99 if (supportsTransitions) { 100 $slide 101 .removeClass(visibleClass) 102 .css(hidden) 103 .eq(idx) 104 .addClass(visibleClass) 105 .css(visible); 106 index = idx; 107 setTimeout(function () { 108 settings.after(idx); 109 }, fadeTime); 110 // If not, use jQuery fallback 111 } else { 112 $slide 113 .stop() 114 .fadeOut(fadeTime, function () { 115 $(this) 116 .removeClass(visibleClass) 117 .css(hidden) 118 .css("opacity", 1); 119 }) 120 .eq(idx) 121 .fadeIn(fadeTime, function () { 122 $(this) 123 .addClass(visibleClass) 124 .css(visible); 125 settings.after(idx); 126 index = idx; 127 }); 128 } 129 }; 130 131 // Random order 132 if (settings.random) { 133 $slide.sort(function () { 134 return (Math.round(Math.random()) - 0.5); 135 }); 136 $this 137 .empty() 138 .append($slide); 139 } 140 141 // Add ID's to each slide 142 $slide.each(function (i) { 143 this.id = slideClassPrefix + i; 144 }); 145 146 // Add max-width and classes 147 $this.addClass(namespace + " " + namespaceIdx); 148 if (options && options.maxwidth) { 149 $this.css("max-width", maxw); 150 } 151 152 // Hide all slides, then show first one 153 $slide 154 .hide() 155 .css(hidden) 156 .eq(0) 157 .addClass(visibleClass) 158 .css(visible) 159 .show(); 160 161 // CSS transitions 162 if (supportsTransitions) { 163 $slide 164 .show() 165 .css({ 166 // -ms prefix isn't needed as IE10 uses prefix free version 167 "-webkit-transition": "opacity " + fadeTime + "ms ease-in-out", 168 "-moz-transition": "opacity " + fadeTime + "ms ease-in-out", 169 "-o-transition": "opacity " + fadeTime + "ms ease-in-out", 170 "transition": "opacity " + fadeTime + "ms ease-in-out" 171 }); 172 } 173 174 // Only run if there's more than one slide 175 if ($slide.length > 1) { 176 177 // Make sure the timeout is at least 100ms longer than the fade 178 if (waitTime < fadeTime + 100) { 179 return; 180 } 181 182 // Pager 183 if (settings.pager && !settings.manualControls) { 184 var tabMarkup = []; 185 $slide.each(function (i) { 186 var n = i + 1; 187 tabMarkup += 188 "<li>" + 189 "<a href='#' class='" + slideClassPrefix + n + "'>" + n + "</a>" + 190 "</li>"; 191 }); 192 $pager.append(tabMarkup); 193 194 // Inject pager 195 if (options.navContainer) { 196 $(settings.navContainer).append($pager); 197 } else { 198 $this.after($pager); 199 } 200 } 201 202 // Manual pager controls 203 if (settings.manualControls) { 204 $pager = $(settings.manualControls); 205 $pager.addClass(namespace + "_tabs " + namespaceIdx + "_tabs"); 206 } 207 208 // Add pager slide class prefixes 209 if (settings.pager || settings.manualControls) { 210 $pager.find('li').each(function (i) { 211 $(this).addClass(slideClassPrefix + (i + 1)); 212 }); 213 } 214 215 // If we have a pager, we need to set up the selectTab function 216 if (settings.pager || settings.manualControls) { 217 $tabs = $pager.find('a'); 218 219 // Select pager item 220 selectTab = function (idx) { 221 $tabs 222 .closest("li") 223 .removeClass(activeClass) 224 .eq(idx) 225 .addClass(activeClass); 226 }; 227 } 228 229 // Auto cycle 230 if (settings.auto) { 231 232 startCycle = function () { 233 rotate = setInterval(function () { 234 235 // Clear the event queue 236 $slide.stop(true, true); 237 238 var idx = index + 1 < length ? index + 1 : 0; 239 240 // Remove active state and set new if pager is set 241 if (settings.pager || settings.manualControls) { 242 selectTab(idx); 243 } 244 245 slideTo(idx); 246 }, waitTime); 247 }; 248 249 // Init cycle 250 startCycle(); 251 } 252 253 // Restarting cycle 254 restartCycle = function () { 255 if (settings.auto) { 256 // Stop 257 clearInterval(rotate); 258 // Restart 259 startCycle(); 260 } 261 }; 262 263 // Pause on hover 264 if (settings.pause) { 265 $this.hover(function () { 266 clearInterval(rotate); 267 }, function () { 268 restartCycle(); 269 }); 270 } 271 272 // Pager click event handler 273 if (settings.pager || settings.manualControls) { 274 $tabs.bind("click", function (e) { 275 e.preventDefault(); 276 277 if (!settings.pauseControls) { 278 restartCycle(); 279 } 280 281 // Get index of clicked tab 282 var idx = $tabs.index(this); 283 284 // Break if element is already active or currently animated 285 if (index === idx || $("." + visibleClass).queue('fx').length) { 286 return; 287 } 288 289 // Remove active state from old tab and set new one 290 selectTab(idx); 291 292 // Do the animation 293 slideTo(idx); 294 }) 295 .eq(0) 296 .closest("li") 297 .addClass(activeClass); 298 299 // Pause when hovering pager 300 if (settings.pauseControls) { 301 $tabs.hover(function () { 302 clearInterval(rotate); 303 }, function () { 304 restartCycle(); 305 }); 306 } 307 } 308 309 // Navigation 310 if (settings.nav) { 311 var navMarkup = 312 "<a href='#' class='" + navClass + " prev'>" + settings.prevText + "</a>" + 313 "<a href='#' class='" + navClass + " next'>" + settings.nextText + "</a>"; 314 315 // Inject navigation 316 if (options.navContainer) { 317 $(settings.navContainer).append(navMarkup); 318 } else { 319 $this.after(navMarkup); 320 } 321 322 var $trigger = $("." + namespaceIdx + "_nav"), 323 $prev = $trigger.filter(".prev"); 324 325 // Click event handler 326 $trigger.bind("click", function (e) { 327 e.preventDefault(); 328 329 var $visibleClass = $("." + visibleClass); 330 331 // Prevent clicking if currently animated 332 if ($visibleClass.queue('fx').length) { 333 return; 334 } 335 336 // Adds active class during slide animation 337 // $(this) 338 // .addClass(namespace + "_active") 339 // .delay(fadeTime) 340 // .queue(function (next) { 341 // $(this).removeClass(namespace + "_active"); 342 // next(); 343 // }); 344 345 // Determine where to slide 346 var idx = $slide.index($visibleClass), 347 prevIdx = idx - 1, 348 nextIdx = idx + 1 < length ? index + 1 : 0; 349 350 // Go to slide 351 slideTo($(this)[0] === $prev[0] ? prevIdx : nextIdx); 352 if (settings.pager || settings.manualControls) { 353 selectTab($(this)[0] === $prev[0] ? prevIdx : nextIdx); 354 } 355 356 if (!settings.pauseControls) { 357 restartCycle(); 358 } 359 }); 360 361 // Pause when hovering navigation 362 if (settings.pauseControls) { 363 $trigger.hover(function () { 364 clearInterval(rotate); 365 }, function () { 366 restartCycle(); 367 }); 368 } 369 } 370 371 } 372 373 // Max-width fallback 374 if (typeof document.body.style.maxWidth === "undefined" && options.maxwidth) { 375 var widthSupport = function () { 376 $this.css("width", "100%"); 377 if ($this.width() > maxw) { 378 $this.css("width", maxw); 379 } 380 }; 381 382 // Init fallback 383 widthSupport(); 384 $(window).bind("resize", function () { 385 widthSupport(); 386 }); 387 } 388 389 }); 390 391 }; 392})(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.