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