1var _____WB$wombat$assign$function_____ = function(name) {return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name)) || self[name]; }; 2if (!self.__WB_pmw) { self.__WB_pmw = function(obj) { this.__WB_source = obj; return this; } } 3{ 4 let window = _____WB$wombat$assign$function_____("window"); 5 let self = _____WB$wombat$assign$function_____("self"); 6 let document = _____WB$wombat$assign$function_____("document"); 7 let location = _____WB$wombat$assign$function_____("location"); 8 let top = _____WB$wombat$assign$function_____("top"); 9 let parent = _____WB$wombat$assign$function_____("parent"); 10 let frames = _____WB$wombat$assign$function_____("frames"); 11 let opener = _____WB$wombat$assign$function_____("opener"); 12 13/** 14 * BxSlider v4.1.1 - Fully loaded, responsive content slider 15 * http://bxslider.com 16 * 17 * Copyright 2013, Steven Wanderski - http://stevenwanderski.com - http://bxcreative.com 18 * Written while drinking Belgian ales and listening to jazz 19 * 20 * Released under the MIT license - http://opensource.org/licenses/MIT 21 */ 22 23;(function($){ 24 25 var plugin = {}; 26 27 var defaults = { 28 29 // GENERAL 30 mode: 'horizontal', 31 slideSelector: '', 32 infiniteLoop: true, 33 hideControlOnEnd: false, 34 speed: 500, 35 easing: null, 36 slideMargin: 0, 37 startSlide: 0, 38 randomStart: false, 39 captions: false, 40 ticker: false, 41 tickerHover: false, 42 adaptiveHeight: false, 43 adaptiveHeightSpeed: 500, 44 video: false, 45 useCSS: false, //default=true 46 preloadImages: 'visible', 47 responsive: true, 48 49 // TOUCH 50 touchEnabled: true, 51 swipeThreshold: 50, 52 oneToOneTouch: true, 53 preventDefaultSwipeX: true, 54 preventDefaultSwipeY: false, 55 56 // PAGER 57 pager: false, //default=true 58 pagerType: 'full', 59 pagerShortSeparator: ' / ', 60 pagerSelector: null, 61 buildPager: null, 62 pagerCustom: null, 63 64 // CONTROLS 65 controls: true, 66 nextText: 'Next', 67 prevText: 'Prev', 68 nextSelector: null, 69 prevSelector: null, 70 autoControls: false, 71 startText: 'Start', 72 stopText: 'Stop', 73 autoControlsCombine: false, 74 autoControlsSelector: null, 75 76 // AUTO 77 auto: true, //default=false 78 pause: 4000, 79 autoStart: true, 80 autoDirection: 'next', 81 autoHover: false, 82 autoDelay: 0, 83 84 // CAROUSEL 85 minSlides: 4, //default=1 86 maxSlides: 4, //default=1 87 moveSlides: 1, //default=0 88 slideWidth: 200, //default=0 89 90 // CALLBACKS 91 onSliderLoad: function() {}, 92 onSlideBefore: function() {}, 93 onSlideAfter: function() {}, 94 onSlideNext: function() {}, 95 onSlidePrev: function() {} 96 } 97 98 $.fn.bxSlider = function(options){ 99 100 if(this.length == 0) return this; 101 102 // support mutltiple elements 103 if(this.length > 1){ 104 this.each(function(){$(this).bxSlider(options)}); 105 return this; 106 } 107 108 // create a namespace to be used throughout the plugin 109 var slider = {}; 110 // set a reference to our slider element 111 var el = this; 112 plugin.el = this; 113 114 /** 115 * Makes slideshow responsive 116 */ 117 // first get the original window dimens (thanks alot IE) 118 var windowWidth = $(window).width(); 119 var windowHeight = $(window).height(); 120 121 122 123 /** 124 * =================================================================================== 125 * = PRIVATE FUNCTIONS 126 * =================================================================================== 127 */ 128 129 /** 130 * Initializes namespace settings to be used throughout plugin 131 */ 132 var init = function(){ 133 // merge user-supplied options with the defaults 134 slider.settings = $.extend({}, defaults, options); 135 // parse slideWidth setting 136 slider.settings.slideWidth = parseInt(slider.settings.slideWidth); 137 // store the original children 138 slider.children = el.children(slider.settings.slideSelector); 139 // check if actual number of slides is less than minSlides / maxSlides 140 if(slider.children.length < slider.settings.minSlides) slider.settings.minSlides = slider.children.length; 141 if(slider.children.length < slider.settings.maxSlides) slider.settings.maxSlides = slider.children.length; 142 // if random start, set the startSlide setting to random number 143 if(slider.settings.randomStart) slider.settings.startSlide = Math.floor(Math.random() * slider.children.length); 144 // store active slide information 145 slider.active = { index: slider.settings.startSlide }
146 // store if the slider is in carousel mode (displaying / moving multiple slides) 147 slider.carousel = slider.settings.minSlides > 1 || slider.settings.maxSlides > 1; 148 // if carousel, force preloadImages = 'all' 149 if(slider.carousel) slider.settings.preloadImages = 'all'; 150 // calculate the min / max width thresholds based on min / max number of slides 151 // used to setup and update carousel slides dimensions 152 slider.minThreshold = (slider.settings.minSlides * slider.settings.slideWidth) + ((slider.settings.minSlides - 1) * slider.settings.slideMargin); 153 slider.maxThreshold = (slider.settings.maxSlides * slider.settings.slideWidth) + ((slider.settings.maxSlides - 1) * slider.settings.slideMargin); 154 // store the current state of the slider (if currently animating, working is true) 155 slider.working = false; 156 // initialize the controls object 157 slider.controls = {}; 158 // initialize an auto interval 159 slider.interval = null; 160 // determine which property to use for transitions 161 slider.animProp = slider.settings.mode == 'vertical' ? 'top' : 'left'; 162 // determine if hardware acceleration can be used 163 slider.usingCSS = slider.settings.useCSS && slider.settings.mode != 'fade' && (function(){ 164 // create our test div element 165 var div = document.createElement('div'); 166 // css transition properties 167 var props = ['WebkitPerspective', 'MozPerspective', 'OPerspective', 'msPerspective']; 168 // test for each property 169 for(var i in props){ 170 if(div.style[props[i]] !== undefined){ 171 slider.cssPrefix = props[i].replace('Perspective', '').toLowerCase(); 172 slider.animProp = '-' + slider.cssPrefix + '-transform'; 173 return true; 174 } 175 } 176 return false; 177 }()); 178 // if vertical mode always make maxSlides and minSlides equal 179 if(slider.settings.mode == 'vertical') slider.settings.maxSlides = slider.settings.minSlides; 180 // save original style data 181 el.data("origStyle", el.attr("style")); 182 el.children(slider.settings.slideSelector).each(function() { 183 $(this).data("origStyle", $(this).attr("style")); 184 }); 185 // perform all DOM / CSS modifications 186 setup(); 187 } 188 189 /** 190 * Performs all DOM and CSS modifications 191 */ 192 var setup = function(){ 193 // wrap el in a wrapper 194 el.wrap('<div class="bx-wrapper"><div class="bx-viewport"></div></div>'); 195 // store a namspace reference to .bx-viewport 196 slider.viewport = el.parent(); 197 // add a loading div to display while images are loading 198 slider.loader = $('<div class="bx-loading" />'); 199 slider.viewport.prepend(slider.loader); 200 // set el to a massive width, to hold any needed slides 201 // also strip any margin and padding from el 202 el.css({ 203 width: slider.settings.mode == 'horizontal' ? (slider.children.length * 100 + 215) + '%' : 'auto', 204 position: 'relative' 205 }); 206 // if using CSS, add the easing property 207 if(slider.usingCSS && slider.settings.easing){ 208 el.css('-' + slider.cssPrefix + '-transition-timing-function', slider.settings.easing); 209 // if not using CSS and no easing value was supplied, use the default JS animation easing (swing) 210 }else if(!slider.settings.easing){ 211 slider.settings.easing = 'swing'; 212 } 213 var slidesShowing = getNumberSlidesShowing(); 214 // make modifications to the viewport (.bx-viewport) 215 slider.viewport.css({ 216 width: '100%', 217 overflow: 'hidden', 218 position: 'relative' 219 }); 220 slider.viewport.parent().css({ 221 maxWidth: getViewportMaxWidth() 222 }); 223 // make modification to the wrapper (.bx-wrapper) 224 if(!slider.settings.pager) { 225 slider.viewport.parent().css({ 226 margin: '0 auto 0px' 227 }); 228 } 229 // apply css to all slider children 230 slider.children.css({ 231 'float': slider.settings.mode == 'horizontal' ? 'left' : 'none', 232 listStyle: 'none', 233 position: 'relative' 234 }); 235 // apply the calculated width after the float is applied to prevent scrollbar interference 236 slider.children.css('width', getSlideWidth()); 237 // if slideMargin is supplied, add the css 238 if(slider.settings.mode == 'horizontal' && slider.settings.slideMargin > 0) slider.children.css('marginRight', slider.settings.slideMargin); 239 if(slider.settings.mode == 'vertical' && slider.settings.slideMargin > 0) slider.children.css('marginBottom', slider.settings.slideMargin); 240 // if "fade" mode, add positioning and z-index CSS 241 if(slider.settings.mode == 'fade'){ 242 slider.children.css({ 243 position: 'absolute', 244 zIndex: 0, 245 display: 'none' 246 }); 247 // prepare the z-index on the showing element 248 slider.children.eq(slider.settings.startSlide).css({zIndex: 50, display: 'block'}); 249 } 250 // create an element to contain all slider controls (pager, start / stop, etc) 251 slider.controls.el = $('<div class="bx-controls" />'); 252 // if captions are requested, add them
253 if(slider.settings.captions) appendCaptions(); 254 // check if startSlide is last slide 255 slider.active.last = slider.settings.startSlide == getPagerQty() - 1; 256 // if video is true, set up the fitVids plugin 257 if(slider.settings.video) el.fitVids(); 258 // set the default preload selector (visible) 259 var preloadSelector = slider.children.eq(slider.settings.startSlide); 260 if (slider.settings.preloadImages == "all") preloadSelector = slider.children; 261 // only check for control addition if not in "ticker" mode 262 if(!slider.settings.ticker){ 263 // if pager is requested, add it 264 if(slider.settings.pager) appendPager(); 265 // if controls are requested, add them 266 if(slider.settings.controls) appendControls(); 267 // if auto is true, and auto controls are requested, add them 268 if(slider.settings.auto && slider.settings.autoControls) appendControlsAuto(); 269 // if any control option is requested, add the controls wrapper 270 if(slider.settings.controls || slider.settings.autoControls || slider.settings.pager) slider.viewport.after(slider.controls.el); 271 // if ticker mode, do not allow a pager 272 }else{ 273 slider.settings.pager = false; 274 } 275 // preload all images, then perform final DOM / CSS modifications that depend on images being loaded 276 loadElements(preloadSelector, start); 277 } 278 279 var loadElements = function(selector, callback){ 280 var total = selector.find('img, iframe').length; 281 if (total == 0){ 282 callback(); 283 return; 284 } 285 var count = 0; 286 selector.find('img, iframe').each(function(){ 287 $(this).one('load', function() { 288 if(++count == total) callback(); 289 }).each(function() { 290 if(this.complete) $(this).load(); 291 }); 292 }); 293 } 294 295 /** 296 * Start the slider 297 */ 298 var start = function(){ 299 // if infinite loop, prepare additional slides 300 if(slider.settings.infiniteLoop && slider.settings.mode != 'fade' && !slider.settings.ticker){ 301 var slice = slider.settings.mode == 'vertical' ? slider.settings.minSlides : slider.settings.maxSlides; 302 var sliceAppend = slider.children.slice(0, slice).clone().addClass('bx-clone'); 303 var slicePrepend = slider.children.slice(-slice).clone().addClass('bx-clone'); 304 el.append(sliceAppend).prepend(slicePrepend); 305 } 306 // remove the loading DOM element 307 slider.loader.remove(); 308 // set the left / top position of "el" 309 setSlidePosition(); 310 // if "vertical" mode, always use adaptiveHeight to prevent odd behavior 311 if (slider.settings.mode == 'vertical') slider.settings.adaptiveHeight = true; 312 // set the viewport height 313 slider.viewport.height(getViewportHeight()); 314 // make sure everything is positioned just right (same as a window resize) 315 el.redrawSlider(); 316 // onSliderLoad callback 317 slider.settings.onSliderLoad(slider.active.index); 318 // slider has been fully initialized 319 slider.initialized = true;
320 // bind the resize call to the window 321 if (slider.settings.responsive) $(window).bind('resize', resizeWindow); 322 // if auto is true, start the show 323 if (slider.settings.auto && slider.settings.autoStart) initAuto(); 324 // if ticker is true, start the ticker 325 if (slider.settings.ticker) initTicker(); 326 // if pager is requested, make the appropriate pager link active 327 if (slider.settings.pager) updatePagerActive(slider.settings.startSlide); 328 // check for any updates to the controls (like hideControlOnEnd updates) 329 if (slider.settings.controls) updateDirectionControls(); 330 // if touchEnabled is true, setup the touch events 331 if (slider.settings.touchEnabled && !slider.settings.ticker) initTouch(); 332 } 333 334 /** 335 * Returns the calculated height of the viewport, used to determine either adaptiveHeight or the maxHeight value 336 */ 337 var getViewportHeight = function(){ 338 var height = 0; 339 // first determine which children (slides) should be used in our height calculation 340 var children = $(); 341 // if mode is not "vertical" and adaptiveHeight is false, include all children 342 if(slider.settings.mode != 'vertical' && !slider.settings.adaptiveHeight){ 343 children = slider.children; 344 }else{ 345 // if not carousel, return the single active child 346 if(!slider.carousel){ 347 children = slider.children.eq(slider.active.index); 348 // if carousel, return a slice of children 349 }else{ 350 // get the individual slide index 351 var currentIndex = slider.settings.moveSlides == 1 ? slider.active.index : slider.active.index * getMoveBy(); 352 // add the current slide to the children 353 children = slider.children.eq(currentIndex); 354 // cycle through the remaining "showing" slides 355 for (i = 1; i <= slider.settings.maxSlides - 1; i++){ 356 // if looped back to the start 357 if(currentIndex + i >= slider.children.length){ 358 children = children.add(slider.children.eq(i - 1)); 359 }else{ 360 children = children.add(slider.children.eq(currentIndex + i)); 361 } 362 } 363 } 364 } 365 // if "vertical" mode, calculate the sum of the heights of the children 366 if(slider.settings.mode == 'vertical'){ 367 children.each(function(index) { 368 height += $(this).outerHeight(); 369 }); 370 // add user-supplied margins 371 if(slider.settings.slideMargin > 0){ 372 height += slider.settings.slideMargin * (slider.settings.minSlides - 1); 373 } 374 // if not "vertical" mode, calculate the max height of the children 375 }else{ 376 height = Math.max.apply(Math, children.map(function(){ 377 return $(this).outerHeight(false); 378 }).get()); 379 } 380 return height; 381 } 382 383 /** 384 * Returns the calculated width to be used for the outer wrapper / viewport 385 */ 386 var getViewportMaxWidth = function(){ 387 var width = '100%'; 388 if(slider.settings.slideWidth > 0){ 389 if(slider.settings.mode == 'horizontal'){ 390 width = (slider.settings.maxSlides * slider.settings.slideWidth) + ((slider.settings.maxSlides - 1) * slider.settings.slideMargin); 391 }else{ 392 width = slider.settings.slideWidth; 393 } 394 } 395 return width; 396 } 397 398 /** 399 * Returns the calculated width to be applied to each slide 400 */ 401 var getSlideWidth = function(){ 402 // start with any user-supplied slide width 403 var newElWidth = slider.settings.slideWidth; 404 // get the current viewport width 405 var wrapWidth = slider.viewport.width(); 406 // if slide width was not supplied, or is larger than the viewport use the viewport width 407 if(slider.settings.slideWidth == 0 || 408 (slider.settings.slideWidth > wrapWidth && !slider.carousel) || 409 slider.settings.mode == 'vertical'){ 410 newElWidth = wrapWidth; 411 // if carousel, use the thresholds to determine the width 412 }else if(slider.settings.maxSlides > 1 && slider.settings.mode == 'horizontal'){ 413 if(wrapWidth > slider.maxThreshold){ 414 // newElWidth = (wrapWidth - (slider.settings.slideMargin * (slider.settings.maxSlides - 1))) / slider.settings.maxSlides; 415 }else if(wrapWidth < slider.minThreshold){ 416 newElWidth = (wrapWidth - (slider.settings.slideMargin * (slider.settings.minSlides - 1))) / slider.settings.minSlides; 417 } 418 } 419 return newElWidth; 420 } 421 422 /** 423 * Returns the number of slides currently visible in the viewport (includes partially visible slides) 424 */ 425 var getNumberSlidesShowing = function(){ 426 var slidesShowing = 1; 427 if(slider.settings.mode == 'horizontal' && slider.settings.slideWidth > 0){ 428 // if viewport is smaller than minThreshold, return minSlides 429 if(slider.viewport.width() < slider.minThreshold){ 430 slidesShowing = slider.settings.minSlides; 431 // if viewport is larger than minThreshold, return maxSlides 432 }else if(slider.viewport.width() > slider.maxThreshold){ 433 slidesShowing = slider.settings.maxSlides; 434 // if viewport is between min / max thresholds, divide viewport width by first child width 435 }else{ 436 var childWidth = slider.children.first().width(); 437 slidesShowing = Math.floor(slider.viewport.width() / childWidth); 438 } 439 // if "vertical" mode, slides showing will always be minSlides 440 }else if(slider.settings.mode == 'vertical'){ 441 slidesShowing = slider.settings.minSlides; 442 } 443 return slidesShowing; 444 } 445 446 /** 447 * Returns the number of pages (one full viewport of slides is one "page") 448 */ 449 var getPagerQty = function(){ 450 var pagerQty = 0; 451 // if moveSlides is specified by the user 452 if(slider.settings.moveSlides > 0){ 453 if(slider.settings.infiniteLoop){ 454 pagerQty = slider.children.length / getMoveBy(); 455 }else{ 456 // use a while loop to determine pages 457 var breakPoint = 0; 458 var counter = 0 459 // when breakpoint goes above children length, counter is the number of pages 460 while (breakPoint < slider.children.length){ 461 ++pagerQty; 462 breakPoint = counter + getNumberSlidesShowing(); 463 counter += slider.settings.moveSlides <= getNumberSlidesShowing() ? slider.settings.moveSlides : getNumberSlidesShowing(); 464 } 465 }
466 // if moveSlides is 0 (auto) divide children length by sides showing, then round up 467 }else{ 468 pagerQty = Math.ceil(slider.children.length / getNumberSlidesShowing()); 469 } 470 return pagerQty; 471 } 472 473 /** 474 * Returns the number of indivual slides by which to shift the slider 475 */ 476 var getMoveBy = function(){ 477 // if moveSlides was set by the user and moveSlides is less than number of slides showing 478 if(slider.settings.moveSlides > 0 && slider.settings.moveSlides <= getNumberSlidesShowing()){ 479 return slider.settings.moveSlides; 480 } 481 // if moveSlides is 0 (auto) 482 return getNumberSlidesShowing(); 483 } 484 485 /** 486 * Sets the slider's (el) left or top position 487 */ 488 var setSlidePosition = function(){ 489 // if last slide, not infinite loop, and number of children is larger than specified maxSlides 490 if(slider.children.length > slider.settings.maxSlides && slider.active.last && !slider.settings.infiniteLoop){ 491 if (slider.settings.mode == 'horizontal'){ 492 // get the last child's position 493 var lastChild = slider.children.last(); 494 var position = lastChild.position(); 495 // set the left position 496 setPositionProperty(-(position.left - (slider.viewport.width() - lastChild.width())), 'reset', 0); 497 }else if(slider.settings.mode == 'vertical'){ 498 // get the last showing index's position 499 var lastShowingIndex = slider.children.length - slider.settings.minSlides; 500 var position = slider.children.eq(lastShowingIndex).position(); 501 // set the top position 502 setPositionProperty(-position.top, 'reset', 0); 503 } 504 // if not last slide 505 }else{ 506 // get the position of the first showing slide 507 var position = slider.children.eq(slider.active.index * getMoveBy()).position(); 508 // check for last slide 509 if (slider.active.index == getPagerQty() - 1) slider.active.last = true; 510 // set the repective position 511 if (position != undefined){ 512 if (slider.settings.mode == 'horizontal') setPositionProperty(-position.left, 'reset', 0); 513 else if (slider.settings.mode == 'vertical') setPositionProperty(-position.top, 'reset', 0); 514 } 515 } 516 } 517 518 /** 519 * Sets the el's animating property position (which in turn will sometimes animate el). 520 * If using CSS, sets the transform property. If not using CSS, sets the top / left property. 521 * 522 * @param value (int) 523 * - the animating property's value 524 * 525 * @param type (string) 'slider', 'reset', 'ticker' 526 * - the type of instance for which the function is being 527 * 528 * @param duration (int) 529 * - the amount of time (in ms) the transition should occupy 530 * 531 * @param params (array) optional 532 * - an optional parameter containing any variables that need to be passed in 533 */ 534 var setPositionProperty = function(value, type, duration, params){ 535 // use CSS transform 536 if(slider.usingCSS){ 537 // determine the translate3d value 538 var propValue = slider.settings.mode == 'vertical' ? 'translate3d(0, ' + value + 'px, 0)' : 'translate3d(' + value + 'px, 0, 0)'; 539 // add the CSS transition-duration 540 el.css('-' + slider.cssPrefix + '-transition-duration', duration / 1000 + 's'); 541 if(type == 'slide'){ 542 // set the property value 543 el.css(slider.animProp, propValue); 544 // bind a callback method - executes when CSS transition completes 545 el.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function(){ 546 // unbind the callback 547 el.unbind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd'); 548 updateAfterSlideTransition(); 549 }); 550 }else if(type == 'reset'){ 551 el.css(slider.animProp, propValue); 552 }else if(type == 'ticker'){ 553 // make the transition use 'linear' 554 el.css('-' + slider.cssPrefix + '-transition-timing-function', 'linear'); 555 el.css(slider.animProp, propValue); 556 // bind a callback method - executes when CSS transition completes 557 el.bind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd', function(){ 558 // unbind the callback 559 el.unbind('transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd'); 560 // reset the position 561 setPositionProperty(params['resetValue'], 'reset', 0); 562 // start the loop again 563 tickerLoop(); 564 }); 565 } 566 // use JS animate 567 }else{ 568 var animateObj = {}; 569 animateObj[slider.animProp] = value; 570 if(type == 'slide'){ 571 el.animate(animateObj, duration, slider.settings.easing, function(){ 572 updateAfterSlideTransition(); 573 }); 574 }else if(type == 'reset'){ 575 el.css(slider.animProp, value) 576 }else if(type == 'ticker'){ 577 el.animate(animateObj, speed, 'linear', function(){ 578 setPositionProperty(params['resetValue'], 'reset', 0); 579 // run the recursive loop after animation 580 tickerLoop(); 581 }); 582 } 583 } 584 } 585 586 /** 587 * Populates the pager with proper amount of pages 588 */ 589 var populatePager = function(){ 590 var pagerHtml = ''; 591 var pagerQty = getPagerQty(); 592 // loop through each pager item 593 for(var i=0; i < pagerQty; i++){ 594 var linkContent = ''; 595 // if a buildPager function is supplied, use it to get pager link value, else use index + 1 596 if(slider.settings.buildPager && $.isFunction(slider.settings.buildPager)){ 597 linkContent = slider.settings.buildPager(i); 598 slider.pagerEl.addClass('bx-custom-pager'); 599 }else{ 600 linkContent = i + 1; 601 slider.pagerEl.addClass('bx-default-pager'); 602 } 603 // var linkContent = slider.settings.buildPager && $.isFunction(slider.settings.buildPager) ? slider.settings.buildPager(i) : i + 1; 604 // add the markup to the string 605 pagerHtml += '<div class="bx-pager-item">
vendor: 3,648 bytes, lines 605-687
605<a href="" data-slide-index="' + i + '" class="bx-pager-link">' + linkContent + '</a></div>'; 606 }; 607 // populate the pager element with pager links 608 slider.pagerEl.html(pagerHtml); 609 } 610 611 /** 612 * Appends the pager to the controls element 613 */ 614 var appendPager = function(){ 615 if(!slider.settings.pagerCustom){ 616 // create the pager DOM element 617 slider.pagerEl = $('<div class="bx-pager" />'); 618 // if a pager selector was supplied, populate it with the pager 619 if(slider.settings.pagerSelector){ 620 $(slider.settings.pagerSelector).html(slider.pagerEl); 621 // if no pager selector was supplied, add it after the wrapper 622 }else{ 623 slider.controls.el.addClass('bx-has-pager').append(slider.pagerEl); 624 } 625 // populate the pager 626 populatePager(); 627 }else{ 628 slider.pagerEl = $(slider.settings.pagerCustom); 629 } 630 // assign the pager click binding 631 slider.pagerEl.delegate('a', 'click', clickPagerBind); 632 } 633 634 /** 635 * Appends prev / next controls to the controls element 636 */ 637 var appendControls = function(){ 638 slider.controls.next = $('<a class="bx-next" href="">' + slider.settings.nextText + '</a>'); 639 slider.controls.prev = $('<a class="bx-prev" href="">' + slider.settings.prevText + '</a>'); 640 // bind click actions to the controls 641 slider.controls.next.bind('click', clickNextBind); 642 slider.controls.prev.bind('click', clickPrevBind); 643 // if nextSlector was supplied, populate it 644 if(slider.settings.nextSelector){ 645 $(slider.settings.nextSelector).append(slider.controls.next); 646 } 647 // if prevSlector was supplied, populate it 648 if(slider.settings.prevSelector){ 649 $(slider.settings.prevSelector).append(slider.controls.prev); 650 } 651 // if no custom selectors were supplied 652 if(!slider.settings.nextSelector && !slider.settings.prevSelector){ 653 // add the controls to the DOM 654 slider.controls.directionEl = $('<div class="bx-controls-direction" />'); 655 // add the control elements to the directionEl 656 slider.controls.directionEl.append(slider.controls.prev).append(slider.controls.next); 657 // slider.viewport.append(slider.controls.directionEl); 658 slider.controls.el.addClass('bx-has-controls-direction').append(slider.controls.directionEl); 659 } 660 } 661 662 /** 663 * Appends start / stop auto controls to the controls element 664 */ 665 var appendControlsAuto = function(){ 666 slider.controls.start = $('<div class="bx-controls-auto-item"><a class="bx-start" href="">' + slider.settings.startText + '</a></div>'); 667 slider.controls.stop = $('<div class="bx-controls-auto-item"><a class="bx-stop" href="">' + slider.settings.stopText + '</a></div>'); 668 // add the controls to the DOM 669 slider.controls.autoEl = $('<div class="bx-controls-auto" />'); 670 // bind click actions to the controls 671 slider.controls.autoEl.delegate('.bx-start', 'click', clickStartBind); 672 slider.controls.autoEl.delegate('.bx-stop', 'click', clickStopBind); 673 // if autoControlsCombine, insert only the "start" control 674 if(slider.settings.autoControlsCombine){ 675 slider.controls.autoEl.append(slider.controls.start); 676 // if autoControlsCombine is false, insert both controls 677 }else{ 678 slider.controls.autoEl.append(slider.controls.start).append(slider.controls.stop); 679 } 680 // if auto controls selector was supplied, populate it with the controls 681 if(slider.settings.autoControlsSelector){ 682 $(slider.settings.autoControlsSelector).html(slider.controls.autoEl); 683 // if auto controls selector was not supplied, add it after the wrapper 684 }else{ 685 slider.controls.el.addClass('bx-has-controls-auto').append(slider.controls.autoEl); 686 } 687 // update the auto controls
688 updateAutoControls(slider.settings.autoStart ? 'stop' : 'start'); 689 } 690 691 /** 692 * Appends image captions to the DOM 693 */ 694 var appendCaptions = function(){ 695 // cycle through each child 696 slider.children.each(function(index){ 697 // get the image title attribute 698 var title = $(this).find('img:first').attr('title'); 699 // append the caption 700 if (title != undefined && ('' + title).length) { 701 $(this).append('<div class="bx-caption"><span>' + title + '</span></div>'); 702 } 703 }); 704 } 705 706 /** 707 * Click next binding 708 * 709 * @param e (event) 710 * - DOM event object 711 */ 712 var clickNextBind = function(e){ 713 // if auto show is running, stop it 714 if (slider.settings.auto) el.stopAuto(); 715 el.goToNextSlide(); 716 e.preventDefault(); 717 } 718 719 /** 720 * Click prev binding 721 * 722 * @param e (event) 723 * - DOM event object 724 */ 725 var clickPrevBind = function(e){ 726 // if auto show is running, stop it 727 if (slider.settings.auto) el.stopAuto(); 728 el.goToPrevSlide(); 729 e.preventDefault(); 730 } 731 732 /** 733 * Click start binding 734 * 735 * @param e (event) 736 * - DOM event object 737 */ 738 var clickStartBind = function(e){ 739 el.startAuto(); 740 e.preventDefault(); 741 } 742 743 /** 744 * Click stop binding 745 * 746 * @param e (event) 747 * - DOM event object 748 */ 749 var clickStopBind = function(e){ 750 el.stopAuto(); 751 e.preventDefault(); 752 } 753 754 /** 755 * Click pager binding 756 * 757 * @param e (event) 758 * - DOM event object 759 */ 760 var clickPagerBind = function(e){ 761 // if auto show is running, stop it 762 if (slider.settings.auto) el.stopAuto(); 763 var pagerLink = $(e.currentTarget); 764 var pagerIndex = parseInt(pagerLink.attr('data-slide-index')); 765 // if clicked pager link is not active, continue with the goToSlide call 766 if(pagerIndex != slider.active.index) el.goToSlide(pagerIndex); 767 e.preventDefault(); 768 } 769 770 /** 771 * Updates the pager links with an active class 772 * 773 * @param slideIndex (int) 774 * - index of slide to make active 775 */ 776 var updatePagerActive = function(slideIndex){ 777 // if "short" pager type 778 var len = slider.children.length; // nb of children 779 if(slider.settings.pagerType == 'short'){ 780 if(slider.settings.maxSlides > 1) { 781 len = Math.ceil(slider.children.length/slider.settings.maxSlides); 782 } 783 slider.pagerEl.html( (slideIndex + 1) + slider.settings.pagerShortSeparator + len); 784 return; 785 } 786 // remove all pager active classes 787 slider.pagerEl.find('a').removeClass('active'); 788 // apply the active class for all pagers 789 slider.pagerEl.each(function(i, el) { $(el).find('a').eq(slideIndex).addClass('active'); }); 790 } 791 792 /** 793 * Performs needed actions after a slide transition 794 */ 795 var updateAfterSlideTransition = function(){ 796 // if infinte loop is true 797 if(slider.settings.infiniteLoop){ 798 var position = ''; 799 // first slide 800 if(slider.active.index == 0){ 801 // set the new position 802 position = slider.children.eq(0).position(); 803 // carousel, last slide 804 }else if(slider.active.index == getPagerQty() - 1 && slider.carousel){ 805 position = slider.children.eq((getPagerQty() - 1) * getMoveBy()).position(); 806 // last slide 807 }else if(slider.active.index == slider.children.length - 1){ 808 position = slider.children.eq(slider.children.length - 1).position(); 809 } 810 if (slider.settings.mode == 'horizontal') { setPositionProperty(-position.left, 'reset', 0);; } 811 else if (slider.settings.mode == 'vertical') { setPositionProperty(-position.top, 'reset', 0);; } 812 } 813 // declare that the transition is complete 814 slider.working = false; 815 // onSlideAfter callback 816 slider.settings.onSlideAfter(slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index); 817 } 818 819 /** 820 * Updates the auto controls state (either active, or combined switch) 821 * 822 * @param state (string) "start", "stop" 823 * - the new state of the auto show 824 */ 825 var updateAutoControls = function(state){ 826 // if autoControlsCombine is true, replace the current control with the new state 827 if(slider.settings.autoControlsCombine){ 828 slider.controls.autoEl.html(slider.controls[state]); 829 // if autoControlsCombine is false, apply the "active" class to the appropriate control 830 }else{ 831 slider.controls.autoEl.find('a').removeClass('active');
832 slider.controls.autoEl.find('a:not(.bx-' + state + ')').addClass('active'); 833 } 834 } 835 836 /** 837 * Updates the direction controls (checks if either should be hidden) 838 */ 839 var updateDirectionControls = function(){ 840 if(getPagerQty() == 1){ 841 slider.controls.prev.addClass('disabled'); 842 slider.controls.next.addClass('disabled'); 843 }else if(!slider.settings.infiniteLoop && slider.settings.hideControlOnEnd){ 844 // if first slide 845 if (slider.active.index == 0){ 846 slider.controls.prev.addClass('disabled'); 847 slider.controls.next.removeClass('disabled'); 848 // if last slide 849 }else if(slider.active.index == getPagerQty() - 1){ 850 slider.controls.next.addClass('disabled'); 851 slider.controls.prev.removeClass('disabled'); 852 // if any slide in the middle 853 }else{ 854 slider.controls.prev.removeClass('disabled'); 855 slider.controls.next.removeClass('disabled'); 856 } 857 } 858 } 859 860 /** 861 * Initialzes the auto process 862 */ 863 var initAuto = function(){ 864 // if autoDelay was supplied, launch the auto show using a setTimeout() call 865 if(slider.settings.autoDelay > 0){ 866 var timeout = setTimeout(el.startAuto, slider.settings.autoDelay); 867 // if autoDelay was not supplied, start the auto show normally 868 }else{ 869 el.startAuto(); 870 } 871 // if autoHover is requested 872 if(slider.settings.autoHover){ 873 // on el hover 874 el.hover(function(){ 875 // if the auto show is currently playing (has an active interval) 876 if(slider.interval){ 877 // stop the auto show and pass true agument which will prevent control update 878 el.stopAuto(true); 879 // create a new autoPaused value which will be used by the relative "mouseout" event 880 slider.autoPaused = true; 881 } 882 }, function(){ 883 // if the autoPaused value was created be the prior "mouseover" event 884 if(slider.autoPaused){ 885 // start the auto show and pass true agument which will prevent control update 886 el.startAuto(true); 887 // reset the autoPaused value 888 slider.autoPaused = null; 889 } 890 }); 891 } 892 } 893 894 /** 895 * Initialzes the ticker process 896 */ 897 var initTicker = function(){ 898 var startPosition = 0; 899 // if autoDirection is "next", append a clone of the entire slider 900 if(slider.settings.autoDirection == 'next'){ 901 el.append(slider.children.clone().addClass('bx-clone')); 902 // if autoDirection is "prev", prepend a clone of the entire slider, and set the left position 903 }else{ 904 el.prepend(slider.children.clone().addClass('bx-clone')); 905 var position = slider.children.first().position(); 906 startPosition = slider.settings.mode == 'horizontal' ? -position.left : -position.top; 907 } 908 setPositionProperty(startPosition, 'reset', 0); 909 // do not allow controls in ticker mode 910 slider.settings.pager = false; 911 slider.settings.controls = false; 912 slider.settings.autoControls = false; 913 // if autoHover is requested 914 if(slider.settings.tickerHover && !slider.usingCSS){ 915 // on el hover 916 slider.viewport.hover(function(){ 917 el.stop(); 918 }, function(){ 919 // calculate the total width of children (used to calculate the speed ratio) 920 var totalDimens = 0; 921 slider.children.each(function(index){ 922 totalDimens += slider.settings.mode == 'horizontal' ? $(this).outerWidth(true) : $(this).outerHeight(true); 923 }); 924 // calculate the speed ratio (used to determine the new speed to finish the paused animation) 925 var ratio = slider.settings.speed / totalDimens; 926 // determine which property to use 927 var property = slider.settings.mode == 'horizontal' ? 'left' : 'top'; 928 // calculate the new speed 929 var newSpeed = ratio * (totalDimens - (Math.abs(parseInt(el.css(property))))); 930 tickerLoop(newSpeed); 931 }); 932 } 933 // start the ticker loop 934 tickerLoop(); 935 } 936 937 /** 938 * Runs a continuous loop, news ticker-style 939 */ 940 var tickerLoop = function(resumeSpeed){ 941 speed = resumeSpeed ? resumeSpeed : slider.settings.speed; 942 var position = {left: 0, top: 0}; 943 var reset = {left: 0, top: 0}; 944 // if "next" animate left position to last child, then reset left to 0 945 if(slider.settings.autoDirection == 'next'){ 946 position = el.find('.bx-clone').first().position(); 947 // if "prev" animate left position to 0, then reset left to first non-clone child 948 }else{ 949 reset = slider.children.first().position(); 950 } 951 var animateProperty = slider.settings.mode == 'horizontal' ? -position.left : -position.top; 952 var resetValue = slider.settings.mode == 'horizontal' ? -reset.left : -reset.top; 953 var params = {resetValue: resetValue}; 954 setPositionProperty(animateProperty, 'ticker', speed, params); 955 } 956 957 /** 958 * Initializes touch events 959 */ 960 var initTouch = function(){ 961 // initialize object to contain all touch values 962 slider.touch = { 963 start: {x: 0, y: 0}, 964 end: {x: 0, y: 0} 965 } 966 slider.viewport.bind('touchstart', onTouchStart); 967 } 968 969 /** 970 * Event handler for "touchstart" 971 * 972 * @param e (event) 973 * - DOM event object 974 */ 975 var onTouchStart = function(e){ 976 if(slider.working){ 977 e.preventDefault(); 978 }else{ 979 // record the original position when touch starts 980 slider.touch.originalPos = el.position(); 981 var orig = e.originalEvent; 982 // record the starting touch x, y coordinates
983 slider.touch.start.x = orig.changedTouches[0].pageX; 984 slider.touch.start.y = orig.changedTouches[0].pageY; 985 // bind a "touchmove" event to the viewport 986 slider.viewport.bind('touchmove', onTouchMove); 987 // bind a "touchend" event to the viewport 988 slider.viewport.bind('touchend', onTouchEnd); 989 } 990 } 991 992 /** 993 * Event handler for "touchmove" 994 * 995 * @param e (event) 996 * - DOM event object 997 */ 998 var onTouchMove = function(e){ 999 var orig = e.originalEvent; 1000 // if scrolling on y axis, do not prevent default 1001 var xMovement = Math.abs(orig.changedTouches[0].pageX - slider.touch.start.x); 1002 var yMovement = Math.abs(orig.changedTouches[0].pageY - slider.touch.start.y); 1003 // x axis swipe 1004 if((xMovement * 3) > yMovement && slider.settings.preventDefaultSwipeX){ 1005 e.preventDefault(); 1006 // y axis swipe 1007 }else if((yMovement * 3) > xMovement && slider.settings.preventDefaultSwipeY){ 1008 e.preventDefault(); 1009 } 1010 if(slider.settings.mode != 'fade' && slider.settings.oneToOneTouch){ 1011 var value = 0; 1012 // if horizontal, drag along x axis 1013 if(slider.settings.mode == 'horizontal'){ 1014 var change = orig.changedTouches[0].pageX - slider.touch.start.x; 1015 value = slider.touch.originalPos.left + change; 1016 // if vertical, drag along y axis 1017 }else{ 1018 var change = orig.changedTouches[0].pageY - slider.touch.start.y; 1019 value = slider.touch.originalPos.top + change; 1020 } 1021 setPositionProperty(value, 'reset', 0); 1022 } 1023 } 1024 1025 /** 1026 * Event handler for "touchend" 1027 * 1028 * @param e (event) 1029 * - DOM event object 1030 */ 1031 var onTouchEnd = function(e){ 1032 slider.viewport.unbind('touchmove', onTouchMove); 1033 var orig = e.originalEvent; 1034 var value = 0; 1035 // record end x, y positions 1036 slider.touch.end.x = orig.changedTouches[0].pageX; 1037 slider.touch.end.y = orig.changedTouches[0].pageY; 1038 // if fade mode, check if absolute x distance clears the threshold 1039 if(slider.settings.mode == 'fade'){ 1040 var distance = Math.abs(slider.touch.start.x - slider.touch.end.x); 1041 if(distance >= slider.settings.swipeThreshold){ 1042 slider.touch.start.x > slider.touch.end.x ? el.goToNextSlide() : el.goToPrevSlide(); 1043 el.stopAuto(); 1044 } 1045 // not fade mode 1046 }else{ 1047 var distance = 0; 1048 // calculate distance and el's animate property 1049 if(slider.settings.mode == 'horizontal'){ 1050 distance = slider.touch.end.x - slider.touch.start.x; 1051 value = slider.touch.originalPos.left; 1052 }else{ 1053 distance = slider.touch.end.y - slider.touch.start.y; 1054 value = slider.touch.originalPos.top; 1055 } 1056 // if not infinite loop and first / last slide, do not attempt a slide transition 1057 if(!slider.settings.infiniteLoop && ((slider.active.index == 0 && distance > 0) || (slider.active.last && distance < 0))){ 1058 setPositionProperty(value, 'reset', 200); 1059 }else{ 1060 // check if distance clears threshold 1061 if(Math.abs(distance) >= slider.settings.swipeThreshold){ 1062 distance < 0 ? el.goToNextSlide() : el.goToPrevSlide(); 1063 el.stopAuto(); 1064 }else{ 1065 // el.animate(property, 200); 1066 setPositionProperty(value, 'reset', 200); 1067 } 1068 } 1069 } 1070 slider.viewport.unbind('touchend', onTouchEnd); 1071 } 1072 1073 /** 1074 * Window resize event callback 1075 */ 1076 var resizeWindow = function(e){ 1077 // get the new window dimens (again, thank you IE) 1078 var windowWidthNew = $(window).width(); 1079 var windowHeightNew = $(window).height(); 1080 // make sure that it is a true window resize 1081 // *we must check this because our dinosaur friend IE fires a window resize event when certain DOM elements 1082 // are resized. Can you just die already?* 1083 if(windowWidth != windowWidthNew || windowHeight != windowHeightNew){ 1084 // set the new window dimens 1085 windowWidth = windowWidthNew; 1086 windowHeight = windowHeightNew; 1087 // update all dynamic elements 1088 el.redrawSlider(); 1089 } 1090 } 1091 1092 /** 1093 * =================================================================================== 1094 * = PUBLIC FUNCTIONS 1095 * =================================================================================== 1096 */ 1097 1098 /** 1099 * Performs slide transition to the specified slide 1100 * 1101 * @param slideIndex (int) 1102 * - the destination slide's index (zero-based) 1103 * 1104 * @param direction (string) 1105 * - INTERNAL USE ONLY - the direction of travel ("prev" / "next") 1106 */ 1107 el.goToSlide = function(slideIndex, direction){ 1108 // if plugin is currently in motion, ignore request 1109 if(slider.working || slider.active.index == slideIndex) return; 1110 // declare that plugin is in motion 1111 slider.working = true; 1112 // store the old index 1113 slider.oldIndex = slider.active.index; 1114 // if slideIndex is less than zero, set active index to last child (this happens during infinite loop) 1115 if(slideIndex < 0){ 1116 slider.active.index = getPagerQty() - 1; 1117 // if slideIndex is greater than children length, set active index to 0 (this happens during infinite loop) 1118 }else if(slideIndex >= getPagerQty()){ 1119 slider.active.index = 0; 1120 // set active index to requested slide 1121 }else{ 1122 slider.active.index = slideIndex; 1123 } 1124 // onSlideBefore, onSlideNext, onSlidePrev callbacks 1125 slider.settings.onSlideBefore(slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index); 1126 if(direction == 'next'){ 1127 slider.settings.onSlideNext(slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index); 1128 }else if(direction == 'prev'){ 1129 slider.settings.onSlidePrev(slider.children.eq(slider.active.index), slider.oldIndex, slider.active.index); 1130 } 1131 // check if last slide 1132 slider.active.last = slider.active.index >= getPagerQty() - 1; 1133 // update the pager with active class 1134 if(slider.settings.pager) updatePagerActive(slider.active.index); 1135 // // check for direction control update 1136 if(slider.settings.controls) updateDirectionControls(); 1137 // if slider is set to mode: "fade" 1138 if(slider.settings.mode == 'fade'){ 1139 // if adaptiveHeight is true and next height is different from current height, animate to the new height 1140 if(slider.settings.adaptiveHeight && slider.viewport.height() != getViewportHe
1140ight()){ 1141 slider.viewport.animate({height: getViewportHeight()}, slider.settings.adaptiveHeightSpeed); 1142 } 1143 // fade out the visible child and reset its z-index value 1144 slider.children.filter(':visible').fadeOut(slider.settings.speed).css({zIndex: 0}); 1145 // fade in the newly requested slide 1146 slider.children.eq(slider.active.index).css('zIndex', 51).fadeIn(slider.settings.speed, function(){ 1147 $(this).css('zIndex', 50); 1148 updateAfterSlideTransition(); 1149 }); 1150 // slider mode is not "fade" 1151 }else{ 1152 // if adaptiveHeight is true and next height is different from current height, animate to the new height 1153 if(slider.settings.adaptiveHeight && slider.viewport.height() != getViewportHeight()){ 1154 slider.viewport.animate({height: getViewportHeight()}, slider.settings.adaptiveHeightSpeed); 1155 } 1156 var moveBy = 0; 1157 var position = {left: 0, top: 0}; 1158 // if carousel and not infinite loop 1159 if(!slider.settings.infiniteLoop && slider.carousel && slider.active.last){ 1160 if(slider.settings.mode == 'horizontal'){ 1161 // get the last child position 1162 var lastChild = slider.children.eq(slider.children.length - 1); 1163 position = lastChild.position(); 1164 // calculate the position of the last slide 1165 moveBy = slider.viewport.width() - lastChild.outerWidth(); 1166 }else{ 1167 // get last showing index position 1168 var lastShowingIndex = slider.children.length - slider.settings.minSlides; 1169 position = slider.children.eq(lastShowingIndex).position(); 1170 } 1171 // horizontal carousel, going previous while on first slide (infiniteLoop mode) 1172 }else if(slider.carousel && slider.active.last && direction == 'prev'){ 1173 // get the last child position 1174 var eq = slider.settings.moveSlides == 1 ? slider.settings.maxSlides - getMoveBy() : ((getPagerQty() - 1) * getMoveBy()) - (slider.children.length - slider.settings.maxSlides); 1175 var lastChild = el.children('.bx-clone').eq(eq); 1176 position = lastChild.position(); 1177 // if infinite loop and "Next" is clicked on the last slide 1178 }else if(direction == 'next' && slider.active.index == 0){ 1179 // get the last clone position 1180 position = el.find('> .bx-clone').eq(slider.settings.maxSlides).position(); 1181 slider.active.last = false; 1182 // normal non-zero requests 1183 }else if(slideIndex >= 0){ 1184 var requestEl = slideIndex * getMoveBy(); 1185 position = slider.children.eq(requestEl).position(); 1186 } 1187 1188 /* If the position doesn't exist 1189 * (e.g. if you destroy the slider on a next click), 1190 * it doesn't throw an error. 1191 */ 1192 if ("undefined" !== typeof(position)) { 1193 var value = slider.settings.mode == 'horizontal' ? -(position.left - moveBy) : -position.top; 1194 // plugin values to be animated 1195 setPositionProperty(value, 'slide', slider.settings.speed); 1196 } 1197 } 1198 } 1199 1200 /** 1201 * Transitions to the next slide in the show 1202 */ 1203 el.goToNextSlide = function(){ 1204 // if infiniteLoop is false and last page is showing, disregard call 1205 if (!slider.settings.infiniteLoop && slider.active.last) return; 1206 var pagerIndex = parseInt(slider.active.index) + 1; 1207 el.goToSlide(pagerIndex, 'next'); 1208 } 1209 1210 /** 1211 * Transitions to the prev slide in the show 1212 */ 1213 el.goToPrevSlide = function(){ 1214 // if infiniteLoop is false and last page is showing, disregard call 1215 if (!slider.settings.infiniteLoop && slider.active.index == 0) return; 1216 var pagerIndex = parseInt(slider.active.index) - 1; 1217 el.goToSlide(pagerIndex, 'prev'); 1218 } 1219 1220 /** 1221 * Starts the auto show 1222 * 1223 * @param preventControlUpdate (boolean) 1224 * - if true, auto controls state will not be updated 1225 */ 1226 el.startAuto = function(preventControlUpdate){ 1227 // if an interval already exists, disregard call 1228 if(slider.interval) return; 1229 // create an interval 1230 slider.interval = setInterval(function(){ 1231 slider.settings.autoDirection == 'next' ? el.goToNextSlide() : el.goToPrevSlide(); 1232 }, slider.settings.pause); 1233 // if auto controls are displayed and preventControlUpdate is not true 1234 if (slider.settings.autoControls && preventControlUpdate != true) updateAutoControls('stop'); 1235 } 1236 1237 /** 1238 * Stops the auto show 1239 * 1240 * @param preventControlUpdate (boolean) 1241 * - if true, auto controls state will not be updated 1242 */ 1243 el.stopAuto = function(preventControlUpdate){ 1244 // if no interval exists, disregard call
1245 if(!slider.interval) return; 1246 // clear the interval 1247 clearInterval(slider.interval); 1248 slider.interval = null; 1249 // if auto controls are displayed and preventControlUpdate is not true 1250 if (slider.settings.autoControls && preventControlUpdate != true) updateAutoControls('start'); 1251 } 1252 1253 /** 1254 * Returns current slide index (zero-based) 1255 */ 1256 el.getCurrentSlide = function(){ 1257 return slider.active.index; 1258 } 1259 1260 /** 1261 * Returns number of slides in show 1262 */ 1263 el.getSlideCount = function(){ 1264 return slider.children.length; 1265 } 1266 1267 /** 1268 * Update all dynamic slider elements 1269 */ 1270 el.redrawSlider = function(){ 1271 // resize all children in ratio to new screen size 1272 slider.children.add(el.find('.bx-clone')).outerWidth(getSlideWidth()); 1273 // adjust the height 1274 slider.viewport.css('height', getViewportHeight()); 1275 // update the slide position 1276 if(!slider.settings.ticker) setSlidePosition(); 1277 // if active.last was true before the screen resize, we want 1278 // to keep it last no matter what screen size we end on 1279 if (slider.active.last) slider.active.index = getPagerQty() - 1; 1280 // if the active index (page) no longer exists due to the resize, simply set the index as last 1281 if (slider.active.index >= getPagerQty()) slider.active.last = true; 1282 // if a pager is being displayed and a custom pager is not being used, update it 1283 if(slider.settings.pager && !slider.settings.pagerCustom){ 1284 populatePager(); 1285 updatePagerActive(slider.active.index); 1286 } 1287 } 1288 1289 /** 1290 * Destroy the current instance of the slider (revert everything back to original state) 1291 */ 1292 el.destroySlider = function(){ 1293 // don't do anything if slider has already been destroyed 1294 if(!slider.initialized) return; 1295 slider.initialized = false; 1296 $('.bx-clone', this).remove(); 1297 slider.children.each(function() { 1298 $(this).data("origStyle") != undefined ? $(this).attr("style", $(this).data("origStyle")) : $(this).removeAttr('style'); 1299 }); 1300 $(this).data("origStyle") != undefined ? this.attr("style", $(this).data("origStyle")) : $(this).removeAttr('style'); 1301 $(this).unwrap().unwrap(); 1302 if(slider.controls.el) slider.controls.el.remove(); 1303 if(slider.controls.next) slider.controls.next.remove(); 1304 if(slider.controls.prev) slider.controls.prev.remove(); 1305 if(slider.pagerEl) slider.pagerEl.remove(); 1306 $('.bx-caption', this).remove(); 1307 if(slider.controls.autoEl) slider.controls.autoEl.remove(); 1308 clearInterval(slider.interval); 1309 if(slider.settings.responsive) $(window).unbind('resize', resizeWindow); 1310 } 1311 1312 /** 1313 * Reload the slider (revert all DOM changes, and re-initialize) 1314 */ 1315 el.reloadSlider = function(settings){ 1316 if (settings != undefined) options = settings; 1317 el.destroySlider(); 1318 init(); 1319 } 1320 1321 init(); 1322 1323 // returns the current jQuery object 1324 return this; 1325 } 1326 1327})(jQuery); 1328 1329} 1330/* 1331 FILE ARCHIVED ON 03:38:06 Dec 28, 2019 AND RETRIEVED FROM THE 1332 INTERNET ARCHIVE ON 09:19:39 May 09, 2024. 1333 JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE. 1334 1335 ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C. 1336 SECTION 108(a)(3)). 1337*/ 1338/* 1339playback timings (ms): 1340 captures_list: 0.81 1341 exclusion.robots: 0.256 1342 exclusion.robots.policy: 0.241 1343 esindex: 0.011 1344 cdx.remote: 5.596 1345 LoadShardBlock: 46.365 (3) 1346 PetaboxLoader3.datanode: 45.778 (4) 1347 load_resource: 64.035 1348 PetaboxLoader3.resolve: 40.62 1349*/
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.