1/* 2 _ _ _ _ 3 ___| (_) ___| | __ (_)___ 4/ __| | |/ __| |/ / | / __| 5\__ \ | | (__| < _ | \__ \ 6|___/_|_|\___|_|\_(_)/ |___/ 7 |__/ 8 9 Version: 1.8.1 10 Author: Ken Wheeler 11 Website: http://kenwheeler.github.io 12 Docs: http://kenwheeler.github.io/slick 13 Repo: http://github.com/kenwheeler/slick 14 Issues: http://github.com/kenwheeler/slick/issues 15 16 */ 17/* global window, document, define, jQuery, setInterval, clearInterval */ 18;(function(factory) { 19 'use strict'; 20 if (typeof define === 'function' && define.amd) { 21 define(['jquery'], factory); 22 } else if (typeof exports !== 'undefined') { 23 module.exports = factory(require('jquery')); 24 } else { 25 factory(jQuery); 26 } 27 28}(function($) { 29 'use strict';
vendor: 31,932 bytes, lines 29-1092
29 30 var Slick = window.Slick || {}; 31 32 Slick = (function() { 33 34 var instanceUid = 0; 35 36 function Slick(element, settings) { 37 38 var _ = this, dataSettings; 39 40 _.defaults = { 41 accessibility: true, 42 adaptiveHeight: false, 43 appendArrows: $(element), 44 appendDots: $(element), 45 arrows: true, 46 asNavFor: null, 47 prevArrow: '<button class="slick-prev" aria-label="Previous" type="button">Previous</button>', 48 nextArrow: '<button class="slick-next" aria-label="Next" type="button">Next</button>', 49 autoplay: false, 50 autoplaySpeed: 3000, 51 centerMode: false, 52 centerPadding: '50px', 53 cssEase: 'ease', 54 customPaging: function(slider, i) { 55 return $('<button type="button" />').text(i + 1); 56 }, 57 dots: false, 58 dotsClass: 'slick-dots', 59 draggable: true, 60 easing: 'linear', 61 edgeFriction: 0.35, 62 fade: false, 63 focusOnSelect: false, 64 focusOnChange: false, 65 infinite: true, 66 initialSlide: 0, 67 lazyLoad: 'ondemand', 68 mobileFirst: false, 69 pauseOnHover: true, 70 pauseOnFocus: true, 71 pauseOnDotsHover: false, 72 respondTo: 'window', 73 responsive: null, 74 rows: 1, 75 rtl: false, 76 slide: '', 77 slidesPerRow: 1, 78 slidesToShow: 1, 79 slidesToScroll: 1, 80 speed: 500, 81 swipe: true, 82 swipeToSlide: false, 83 touchMove: true, 84 touchThreshold: 5, 85 useCSS: true, 86 useTransform: true, 87 variableWidth: false, 88 vertical: false, 89 verticalSwiping: false, 90 waitForAnimate: true, 91 zIndex: 1000 92 }; 93 94 _.initials = { 95 animating: false, 96 dragging: false, 97 autoPlayTimer: null, 98 currentDirection: 0, 99 currentLeft: null, 100 currentSlide: 0, 101 direction: 1, 102 $dots: null, 103 listWidth: null, 104 listHeight: null, 105 loadIndex: 0, 106 $nextArrow: null, 107 $prevArrow: null, 108 scrolling: false, 109 slideCount: null, 110 slideWidth: null, 111 $slideTrack: null, 112 $slides: null, 113 sliding: false, 114 slideOffset: 0, 115 swipeLeft: null, 116 swiping: false, 117 $list: null, 118 touchObject: {}, 119 transformsEnabled: false, 120 unslicked: false 121 }; 122 123 $.extend(_, _.initials); 124 125 _.activeBreakpoint = null; 126 _.animType = null; 127 _.animProp = null; 128 _.breakpoints = []; 129 _.breakpointSettings = []; 130 _.cssTransitions = false; 131 _.focussed = false; 132 _.interrupted = false; 133 _.hidden = 'hidden'; 134 _.paused = true; 135 _.positionProp = null; 136 _.respondTo = null; 137 _.rowCount = 1; 138 _.shouldClick = true; 139 _.$slider = $(element); 140 _.$slidesCache = null; 141 _.transformType = null; 142 _.transitionType = null; 143 _.visibilityChange = 'visibilitychange'; 144 _.windowWidth = 0; 145 _.windowTimer = null; 146 147 dataSettings = $(element).data('slick') || {}; 148 149 _.options = $.extend({}, _.defaults, settings, dataSettings); 150 151 _.currentSlide = _.options.initialSlide; 152 153 _.originalSettings = _.options; 154 155 if (typeof document.mozHidden !== 'undefined') { 156 _.hidden = 'mozHidden'; 157 _.visibilityChange = 'mozvisibilitychange'; 158 } else if (typeof document.webkitHidden !== 'undefined') { 159 _.hidden = 'webkitHidden'; 160 _.visibilityChange = 'webkitvisibilitychange'; 161 } 162 163 _.autoPlay = $.proxy(_.autoPlay, _); 164 _.autoPlayClear = $.proxy(_.autoPlayClear, _); 165 _.autoPlayIterator = $.proxy(_.autoPlayIterator, _); 166 _.changeSlide = $.proxy(_.changeSlide, _); 167 _.clickHandler = $.proxy(_.clickHandler, _); 168 _.selectHandler = $.proxy(_.selectHandler, _); 169 _.setPosition = $.proxy(_.setPosition, _); 170 _.swipeHandler = $.proxy(_.swipeHandler, _); 171 _.dragHandler = $.proxy(_.dragHandler, _); 172 _.keyHandler = $.proxy(_.keyHandler, _); 173 174 _.instanceUid = instanceUid++; 175 176 // A simple way to check for HTML strings 177 // Strict HTML recognition (must start with <) 178 // Extracted from jQuery v1.11 source 179 _.htmlExpr = /^(?:\s*(<[\w\W]+>)[^>]*)$/; 180 181 182 _.registerBreakpoints(); 183 _.init(true); 184 185 } 186 187 return Slick; 188 189 }()); 190 191 Slick.prototype.activateADA = function() { 192 var _ = this; 193 194 _.$slideTrack.find('.slick-active').attr({ 195 'aria-hidden': 'false' 196 }).find('a, input, button, select').attr({ 197 'tabindex': '0' 198 }); 199 200 }; 201 202 Slick.prototype.addSlide = Slick.prototype.slickAdd = function(markup, index, addBefore) { 203 204 var _ = this; 205 206 if (typeof(index) === 'boolean') { 207 addBefore = index; 208 index = null; 209 } else if (index < 0 || (index >= _.slideCount)) { 210 return false; 211 } 212 213 _.unload(); 214 215 if (typeof(index) === 'number') { 216 if (index === 0 && _.$slides.length === 0) { 217 $(markup).appendTo(_.$slideTrack); 218 } else if (addBefore) { 219 $(markup).insertBefore(_.$slides.eq(index)); 220 } else { 221 $(markup).insertAfter(_.$slides.eq(index)); 222 } 223 } else { 224 if (addBefore === true) { 225 $(markup).prependTo(_.$slideTrack); 226 } else { 227 $(markup).appendTo(_.$slideTrack); 228 } 229 } 230 231 _.$slides = _.$slideTrack.children(this.options.slide); 232 233 _.$slideTrack.children(this.options.slide).detach(); 234 235 _.$slideTrack.append(_.$slides); 236 237 _.$slides.each(function(index, element) { 238 $(element).attr('data-slick-index', index); 239 }); 240 241 _.$slidesCache = _.$slides; 242 243 _.reinit(); 244 245 }; 246 247 Slick.prototype.animateHeight = function() { 248 var _ = this; 249 if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) { 250 var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true); 251 _.$list.animate({ 252 height: targetHeight 253 }, _.options.speed); 254 } 255 }; 256 257 Slick.prototype.animateSlide = function(targetLeft, callback) { 258 259 var animProps = {}, 260 _ = this; 261 262 _.animateHeight(); 263 264 if (_.options.rtl === true && _.options.vertical === false) { 265 targetLeft = -targetLeft; 266 } 267 if (_.transformsEnabled === false) { 268 if (_.options.vertical === false) { 269 _.$slideTrack.animate({ 270 left: targetLeft 271 }, _.options.speed, _.options.easing, callback); 272 } else { 273 _.$slideTrack.animate({ 274 top: targetLeft 275 }, _.options.speed, _.options.easing, callback); 276 } 277 278 } else { 279 280 if (_.cssTransitions === false) { 281 if (_.options.rtl === true) { 282 _.currentLeft = -(_.currentLeft); 283 } 284 $({ 285 animStart: _.currentLeft 286 }).animate({ 287 animStart: targetLeft 288 }, { 289 duration: _.options.speed, 290 easing: _.options.easing, 291 step: function(now) { 292 now = Math.ceil(now); 293 if (_.options.vertical === false) { 294 animProps[_.animType] = 'translate(' + 295 now + 'px, 0px)'; 296 _.$slideTrack.css(animProps); 297 } else { 298 animProps[_.animType] = 'translate(0px,' + 299 now + 'px)'; 300 _.$slideTrack.css(animProps); 301 } 302 }, 303 complete: function() { 304 if (callback) { 305 callback.call(); 306 } 307 } 308 }); 309 310 } else { 311 312 _.applyTransition(); 313 targetLeft = Math.ceil(targetLeft); 314 315 if (_.options.vertical === false) { 316 animProps[_.animType] = 'translate3d(' + targetLeft + 'px, 0px, 0px)'; 317 } else { 318 animProps[_.animType] = 'translate3d(0px,' + targetLeft + 'px, 0px)'; 319 } 320 _.$slideTrack.css(animProps); 321 322 if (callback) { 323 setTimeout(function() { 324 325 _.disableTransition(); 326 327 callback.call(); 328 }, _.options.speed); 329 } 330 331 } 332 333 } 334 335 }; 336 337 Slick.prototype.getNavTarget = function() { 338 339 var _ = this, 340 asNavFor = _.options.asNavFor; 341 342 if ( asNavFor && asNavFor !== null ) { 343 asNavFor = $(asNavFor).not(_.$slider); 344 } 345 346 return asNavFor; 347 348 }; 349 350 Slick.prototype.asNavFor = function(index) { 351 352 var _ = this, 353 asNavFor = _.getNavTarget(); 354 355 if ( asNavFor !== null && typeof asNavFor === 'object' ) { 356 asNavFor.each(function() { 357 var target = $(this).slick('getSlick'); 358 if(!target.unslicked) { 359 target.slideHandler(index, true); 360 } 361 }); 362 } 363 364 }; 365 366 Slick.prototype.applyTransition = function(slide) { 367 368 var _ = this, 369 transition = {}; 370 371 if (_.options.fade === false) { 372 transition[_.transitionType] = _.transformType + ' ' + _.options.speed + 'ms ' + _.options.cssEase; 373 } else { 374 transition[_.transitionType] = 'opacity ' + _.options.speed + 'ms ' + _.options.cssEase; 375 } 376 377 if (_.options.fade === false) { 378 _.$slideTrack.css(transition); 379 } else { 380 _.$slides.eq(slide).css(transition); 381 } 382 383 }; 384 385 Slick.prototype.autoPlay = function() { 386 387 var _ = this; 388 389 _.autoPlayClear(); 390 391 if ( _.slideCount > _.options.slidesToShow ) { 392 _.autoPlayTimer = setInterval( _.autoPlayIterator, _.options.autoplaySpeed ); 393 } 394 395 }; 396 397 Slick.prototype.autoPlayClear = function() { 398 399 var _ = this; 400 401 if (_.autoPlayTimer) { 402 clearInterval(_.autoPlayTimer); 403 } 404 405 }; 406 407 Slick.prototype.autoPlayIterator = function() { 408 409 var _ = this, 410 slideTo = _.currentSlide + _.options.slidesToScroll; 411 412 if ( !_.paused && !_.interrupted && !_.focussed ) { 413 414 if ( _.options.infinite === false ) { 415 416 if ( _.direction === 1 && ( _.currentSlide + 1 ) === ( _.slideCount - 1 )) { 417 _.direction = 0; 418 } 419 420 else if ( _.direction === 0 ) { 421 422 slideTo = _.currentSlide - _.options.slidesToScroll; 423 424 if ( _.currentSlide - 1 === 0 ) { 425 _.direction = 1; 426 } 427 428 } 429 430 } 431 432 _.slideHandler( slideTo ); 433 434 } 435 436 }; 437 438 Slick.prototype.buildArrows = function() { 439 440 var _ = this; 441 442 if (_.options.arrows === true ) { 443 444 _.$prevArrow = $(_.options.prevArrow).addClass('slick-arrow'); 445 _.$nextArrow = $(_.options.nextArrow).addClass('slick-arrow'); 446 447 if( _.slideCount > _.options.slidesToShow ) { 448 449 _.$prevArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex'); 450 _.$nextArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex'); 451 452 if (_.htmlExpr.test(_.options.prevArrow)) { 453 _.$prevArrow.prependTo(_.options.appendArrows); 454 } 455 456 if (_.htmlExpr.test(_.options.nextArrow)) { 457 _.$nextArrow.appendTo(_.options.appendArrows); 458 } 459 460 if (_.options.infinite !== true) { 461 _.$prevArrow 462 .addClass('slick-disabled') 463 .attr('aria-disabled', 'true'); 464 } 465 466 } else { 467 468 _.$prevArrow.add( _.$nextArrow ) 469 470 .addClass('slick-hidden') 471 .attr({ 472 'aria-disabled': 'true', 473 'tabindex': '-1' 474 }); 475 476 } 477 478 } 479 480 }; 481 482 Slick.prototype.buildDots = function() { 483 484 var _ = this, 485 i, dot; 486 487 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 488 489 _.$slider.addClass('slick-dotted'); 490 491 dot = $('<ul />').addClass(_.options.dotsClass); 492 493 for (i = 0; i <= _.getDotCount(); i += 1) { 494 dot.append($('<li />').append(_.options.customPaging.call(this, _, i))); 495 } 496 497 _.$dots = dot.appendTo(_.options.appendDots); 498 499 _.$dots.find('li').first().addClass('slick-active'); 500 501 } 502 503 }; 504 505 Slick.prototype.buildOut = function() { 506 507 var _ = this; 508 509 _.$slides = 510 _.$slider 511 .children( _.options.slide + ':not(.slick-cloned)') 512 .addClass('slick-slide'); 513 514 _.slideCount = _.$slides.length; 515 516 _.$slides.each(function(index, element) { 517 $(element) 518 .attr('data-slick-index', index) 519 .data('originalStyling', $(element).attr('style') || ''); 520 }); 521 522 _.$slider.addClass('slick-slider'); 523 524 _.$slideTrack = (_.slideCount === 0) ? 525 $('<div class="slick-track"/>').appendTo(_.$slider) : 526 _.$slides.wrapAll('<div class="slick-track"/>').parent(); 527 528 _.$list = _.$slideTrack.wrap( 529 '<div class="slick-list"/>').parent(); 530 _.$slideTrack.css('opacity', 0); 531 532 if (_.options.centerMode === true || _.options.swipeToSlide === true) { 533 _.options.slidesToScroll = 1; 534 } 535 536 $('img[data-lazy]', _.$slider).not('[src]').addClass('slick-loading'); 537 538 _.setupInfinite(); 539 540 _.buildArrows(); 541 542 _.buildDots(); 543 544 _.updateDots(); 545 546 547 _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0); 548 549 if (_.options.draggable === true) { 550 _.$list.addClass('draggable'); 551 } 552 553 }; 554 555 Slick.prototype.buildRows = function() { 556 557 var _ = this, a, b, c, newSlides, numOfSlides, originalSlides,slidesPerSection; 558 559 newSlides = document.createDocumentFragment(); 560 originalSlides = _.$slider.children(); 561 562 if(_.options.rows > 0) { 563 564 slidesPerSection = _.options.slidesPerRow * _.options.rows; 565 numOfSlides = Math.ceil( 566 originalSlides.length / slidesPerSection 567 ); 568 569 for(a = 0; a < numOfSlides; a++){ 570 var slide = document.createElement('div'); 571 for(b = 0; b < _.options.rows; b++) { 572 var row = document.createElement('div'); 573 for(c = 0; c < _.options.slidesPerRow; c++) { 574 var target = (a * slidesPerSection + ((b * _.options.slidesPerRow) + c)); 575 if (originalSlides.get(target)) { 576 row.appendChild(originalSlides.get(target)); 577 } 578 } 579 slide.appendChild(row); 580 } 581 newSlides.appendChild(slide); 582 } 583 584 _.$slider.empty().append(newSlides); 585 _.$slider.children().children().children() 586 .css({ 587 'width':(100 / _.options.slidesPerRow) + '%', 588 'display': 'inline-block' 589 }); 590 591 } 592 593 }; 594 595 Slick.prototype.checkResponsive = function(initial, forceUpdate) { 596 597 var _ = this, 598 breakpoint, targetBreakpoint, respondToWidth, triggerBreakpoint = false; 599 var sliderWidth = _.$slider.width(); 600 var windowWidth = window.innerWidth || $(window).width(); 601 602 if (_.respondTo === 'window') { 603 respondToWidth = windowWidth; 604 } else if (_.respondTo === 'slider') { 605 respondToWidth = sliderWidth; 606 } else if (_.respondTo === 'min') { 607 respondToWidth = Math.min(windowWidth, sliderWidth); 608 } 609 610 if ( _.options.responsive && 611 _.options.responsive.length && 612 _.options.responsive !== null) { 613 614 targetBreakpoint = null; 615 616 for (breakpoint in _.breakpoints) { 617 if (_.breakpoints.hasOwnProperty(breakpoint)) { 618 if (_.originalSettings.mobileFirst === false) { 619 if (respondToWidth < _.breakpoints[breakpoint]) { 620 targetBreakpoint = _.breakpoints[breakpoint]; 621 } 622 } else { 623 if (respondToWidth > _.breakpoints[breakpoint]) { 624 targetBreakpoint = _.breakpoints[breakpoint]; 625 } 626 } 627 } 628 } 629 630 if (targetBreakpoint !== null) { 631 if (_.activeBreakpoint !== null) { 632 if (targetBreakpoint !== _.activeBreakpoint || forceUpdate) { 633 _.activeBreakpoint = 634 targetBreakpoint; 635 if (_.breakpointSettings[targetBreakpoint] === 'unslick') { 636 _.unslick(targetBreakpoint); 637 } else { 638 _.options = $.extend({}, _.originalSettings, 639 _.breakpointSettings[ 640 targetBreakpoint]); 641 if (initial === true) { 642 _.currentSlide = _.options.initialSlide; 643 } 644 _.refresh(initial); 645 } 646 triggerBreakpoint = targetBreakpoint; 647 } 648 } else { 649 _.activeBreakpoint = targetBreakpoint; 650 if (_.breakpointSettings[targetBreakpoint] === 'unslick') { 651 _.unslick(targetBreakpoint); 652 } else { 653 _.options = $.extend({}, _.originalSettings, 654 _.breakpointSettings[ 655 targetBreakpoint]); 656 if (initial === true) { 657 _.currentSlide = _.options.initialSlide; 658 } 659 _.refresh(initial); 660 } 661 triggerBreakpoint = targetBreakpoint; 662 } 663 } else { 664 if (_.activeBreakpoint !== null) { 665 _.activeBreakpoint = null; 666 _.options = _.originalSettings; 667 if (initial === true) { 668 _.currentSlide = _.options.initialSlide; 669 } 670 _.refresh(initial); 671 triggerBreakpoint = targetBreakpoint; 672 } 673 } 674 675 // only trigger breakpoints during an actual break. not on initialize. 676 if( !initial && triggerBreakpoint !== false ) { 677 _.$slider.trigger('breakpoint', [_, triggerBreakpoint]); 678 } 679 } 680 681 }; 682 683 Slick.prototype.changeSlide = function(event, dontAnimate) { 684 685 var _ = this, 686 $target = $(event.currentTarget), 687 indexOffset, slideOffset, unevenOffset; 688 689 // If target is a link, prevent default action. 690 if($target.is('a')) { 691 event.preventDefault(); 692 } 693 694 // If target is not the <li> element (ie: a child), find the <li>. 695 if(!$target.is('li')) { 696 $target = $target.closest('li'); 697 } 698 699 unevenOffset = (_.slideCount % _.options.slidesToScroll !== 0); 700 indexOffset = unevenOffset ? 0 : (_.slideCount - _.currentSlide) % _.options.slidesToScroll; 701 702 switch (event.data.message) { 703 704 case 'previous': 705 slideOffset = indexOffset === 0 ? _.options.slidesToScroll : _.options.slidesToShow - indexOffset; 706 if (_.slideCount > _.options.slidesToShow) { 707 _.slideHandler(_.currentSlide - slideOffset, false, dontAnimate); 708 } 709 break; 710 711 case 'next': 712 slideOffset = indexOffset === 0 ? _.options.slidesToScroll : indexOffset; 713 if (_.slideCount > _.options.slidesToShow) { 714 _.slideHandler(_.currentSlide + slideOffset, false, dontAnimate); 715 } 716 break; 717 718 case 'index': 719 var index = event.data.index === 0 ? 0 : 720 event.data.index || $target.index() * _.options.slidesToScroll; 721 722 _.slideHandler(_.checkNavigable(index), false, dontAnimate); 723 $target.children().trigger('focus'); 724 break; 725 726 default: 727 return; 728 } 729 730 }; 731 732 Slick.prototype.checkNavigable = function(index) { 733 734 var _ = this, 735 navigables, prevNavigable; 736 737 navigables = _.getNavigableIndexes(); 738 prevNavigable = 0; 739 if (index > navigables[navigables.length - 1]) { 740 index = navigables[navigables.length - 1]; 741 } else { 742 for (var n in navigables) { 743 if (index < navigables[n]) { 744 index = prevNavigable; 745 break; 746 } 747 prevNavigable = navigables[n]; 748 } 749 } 750 751 return index; 752 }; 753 754 Slick.prototype.cleanUpEvents = function() { 755 756 var _ = this; 757 758 if (_.options.dots && _.$dots !== null) { 759 760 $('li', _.$dots) 761 .off('click.slick', _.changeSlide) 762 .off('mouseenter.slick', $.proxy(_.interrupt, _, true)) 763 .off('mouseleave.slick', $.proxy(_.interrupt, _, false)); 764 765 if (_.options.accessibility === true) { 766 _.$dots.off('keydown.slick', _.keyHandler); 767 } 768 } 769 770 _.$slider.off('focus.slick blur.slick'); 771 772 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 773 _.$prevArrow && _.$prevArrow.off('click.slick', _.changeSlide); 774 _.$nextArrow && _.$nextArrow.off('click.slick', _.changeSlide); 775 776 if (_.options.accessibility === true) { 777 _.$prevArrow && _.$prevArrow.off('keydown.slick', _.keyHandler); 778 _.$nextArrow && _.$nextArrow.off('keydown.slick', _.keyHandler); 779 } 780 } 781 782 _.$list.off('touchstart.slick mousedown.slick', _.swipeHandler); 783 _.$list.off('touchmove.slick mousemove.slick', _.swipeHandler); 784 _.$list.off('touchend.slick mouseup.slick', _.swipeHandler); 785 _.$list.off('touchcancel.slick mouseleave.slick', _.swipeHandler); 786 787 _.$list.off('click.slick', _.clickHandler); 788 789 $(document).off(_.visibilityChange, _.visibility); 790 791 _.cleanUpSlideEvents(); 792 793 if (_.options.accessibility === true) { 794 _.$list.off('keydown.slick', _.keyHandler); 795 } 796 797 if (_.options.focusOnSelect === true) { 798 $(_.$slideTrack).children().off('click.slick', _.selectHandler); 799 } 800 801 $(window).off('orientationchange.slick.slick-' + _.instanceUid, _.orientationChange); 802 803 $(window).off('resize.slick.slick-' + _.instanceUid, _.resize); 804 805 $('[draggable!=true]', _.$slideTrack).off('dragstart', _.preventDefault); 806 807 $(window).off('load.slick.slick-' + _.instanceUid, _.setPosition); 808 809 }; 810 811 Slick.prototype.cleanUpSlideEvents = function() { 812 813 var _ = this; 814 815 _.$list.off('mouseenter.slick', $.proxy(_.interrupt, _, true)); 816 _.$list.off('mouseleave.slick', $.proxy(_.interrupt, _, false)); 817 818 }; 819 820 Slick.prototype.cleanUpRows = function() { 821 822 var _ = this, originalSlides; 823 824 if(_.options.rows > 0) { 825 originalSlides = _.$slides.children().children(); 826 originalSlides.removeAttr('style'); 827 _.$slider.empty().append(originalSlides); 828 } 829 830 }; 831 832 Slick.prototype.clickHandler = function(event) { 833 834 var _ = this; 835 836 if (_.shouldClick === false) { 837 event.stopImmediatePropagation(); 838 event.stopPropagation(); 839 event.preventDefault(); 840 } 841 842 }; 843 844 Slick.prototype.destroy = function(refresh) { 845 846 var _ = this; 847 848 _.autoPlayClear(); 849 850 _.touchObject = {}; 851 852 _.cleanUpEvents(); 853 854 $('.slick-cloned', _.$slider).detach(); 855 856 if (_.$dots) { 857 _.$dots.remove(); 858 } 859 860 if ( _.$prevArrow && _.$prevArrow.length ) { 861 862 _.$prevArrow 863 .removeClass('slick-disabled slick-arrow slick-hidden') 864 .removeAttr('aria-hidden aria-disabled tabindex') 865 .css('display',''); 866 867 if ( _.htmlExpr.test( _.options.prevArrow )) { 868 _.$prevArrow.remove(); 869 } 870 } 871 872 if ( _.$nextArrow && _.$nextArrow.length ) { 873 874 _.$nextArrow 875 .removeClass('slick-disabled slick-arrow slick-hidden') 876 .removeAttr('aria-hidden aria-disabled tabindex') 877 .css('display',''); 878 879 if ( _.htmlExpr.test( _.options.nextArrow )) { 880 _.$nextArrow.remove(); 881 } 882 } 883 884 885 if (_.$slides) { 886 887 _.$slides 888 .removeClass('slick-slide slick-active slick-center slick-visible slick-current') 889 .removeAttr('aria-hidden') 890 .removeAttr('data-slick-index') 891 .each(function(){ 892 $(this).attr('style', $(this).data('originalStyling')); 893 }); 894 895 _.$slideTrack.children(this.options.slide).detach(); 896 897 _.$slideTrack.detach(); 898 899 _.$list.detach(); 900 901 _.$slider.append(_.$slides); 902 } 903 904 _.cleanUpRows(); 905 906 _.$slider.removeClass('slick-slider'); 907 _.$slider.removeClass('slick-initialized'); 908 _.$slider.removeClass('slick-dotted'); 909 910 _.unslicked = true; 911 912 if(!refresh) { 913 _.$slider.trigger('destroy', [_]); 914 } 915 916 }; 917 918 Slick.prototype.disableTransition = function(slide) { 919 920 var _ = this, 921 transition = {}; 922 923 transition[_.transitionType] = ''; 924 925 if (_.options.fade === false) { 926 _.$slideTrack.css(transition); 927 } else { 928 _.$slides.eq(slide).css(transition); 929 } 930 931 }; 932 933 Slick.prototype.fadeSlide = function(slideIndex, callback) { 934 935 var _ = this; 936 937 if (_.cssTransitions === false) { 938 939 _.$slides.eq(slideIndex).css({ 940 zIndex: _.options.zIndex 941 }); 942 943 _.$slides.eq(slideIndex).animate({ 944 opacity: 1 945 }, _.options.speed, _.options.easing, callback); 946 947 } else { 948 949 _.applyTransition(slideIndex); 950 951 _.$slides.eq(slideIndex).css({ 952 opacity: 1, 953 zIndex: _.options.zIndex 954 }); 955 956 if (callback) { 957 setTimeout(function() { 958 959 _.disableTransition(slideIndex); 960 961 callback.call(); 962 }, _.options.speed); 963 } 964 965 } 966 967 }; 968 969 Slick.prototype.fadeSlideOut = function(slideIndex) { 970 971 var _ = this; 972 973 if (_.cssTransitions === false) { 974 975 _.$slides.eq(slideIndex).animate({ 976 opacity: 0, 977 zIndex: _.options.zIndex - 2 978 }, _.options.speed, _.options.easing); 979 980 } else { 981 982 _.applyTransition(slideIndex); 983 984 _.$slides.eq(slideIndex).css({ 985 opacity: 0, 986 zIndex: _.options.zIndex - 2 987 }); 988 989 } 990 991 }; 992 993 Slick.prototype.filterSlides = Slick.prototype.slickFilter = function(filter) { 994 995 var _ = this; 996 997 if (filter !== null) { 998 999 _.$slidesCache = _.$slides; 1000 1001 _.unload(); 1002 1003 _.$slideTrack.children(this.options.slide).detach(); 1004 1005 _.$slidesCache.filter(filter).appendTo(_.$slideTrack); 1006 1007 _.reinit(); 1008 1009 } 1010 1011 }; 1012 1013 Slick.prototype.focusHandler = function() { 1014 1015 var _ = this; 1016 1017 _.$slider 1018 .off('focus.slick blur.slick') 1019 .on('focus.slick blur.slick', '*', function(event) { 1020 1021 event.stopImmediatePropagation(); 1022 var $sf = $(this); 1023 1024 setTimeout(function() { 1025 1026 if( _.options.pauseOnFocus ) { 1027 _.focussed = $sf.is(':focus'); 1028 _.autoPlay(); 1029 } 1030 1031 }, 0); 1032 1033 }); 1034 }; 1035 1036 Slick.prototype.getCurrent = Slick.prototype.slickCurrentSlide = function() { 1037 1038 var _ = this; 1039 return _.currentSlide; 1040 1041 }; 1042 1043 Slick.prototype.getDotCount = function() { 1044 1045 var _ = this; 1046 1047 var breakPoint = 0; 1048 var counter = 0; 1049 var pagerQty = 0; 1050 1051 if (_.options.infinite === true) { 1052 if (_.slideCount <= _.options.slidesToShow) { 1053 ++pagerQty; 1054 } else { 1055 while (breakPoint < _.slideCount) { 1056 ++pagerQty; 1057 breakPoint = counter + _.options.slidesToScroll; 1058 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 1059 } 1060 } 1061 } else if (_.options.centerMode === true) { 1062 pagerQty = _.slideCount; 1063 } else if(!_.options.asNavFor) { 1064 pagerQty = 1 + Math.ceil((_.slideCount - _.options.slidesToShow) / _.options.slidesToScroll); 1065 }else { 1066 while (breakPoint < _.slideCount) { 1067 ++pagerQty; 1068 breakPoint = counter + _.options.slidesToScroll; 1069 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 1070 } 1071 } 1072 1073 return pagerQty - 1; 1074 1075 }; 1076 1077 Slick.prototype.getLeft = function(slideIndex) { 1078 1079 var _ = this, 1080 targetLeft, 1081 verticalHeight, 1082 verticalOffset = 0, 1083 targetSlide, 1084 coef; 1085 1086 _.slideOffset = 0; 1087 verticalHeight = _.$slides.first().outerHeight(true); 1088 1089 if (_.options.infinite === true) { 1090 if (_.slideCount > _.options.slidesToShow) { 1091 _.slideOffset = (_.slideWidth * _.options.slidesToShow) * -1; 1092 coef = -1
1092 1093 1094 if (_.options.vertical === true && _.options.centerMode === true) { 1095 if (_.options.slidesToShow === 2) { 1096 coef = -1.5; 1097 } else if (_.options.slidesToShow === 1) { 1098 coef = -2
vendor: 47,517 bytes, lines 1098-2701
1098 1099 } 1100 } 1101 verticalOffset = (verticalHeight * _.options.slidesToShow) * coef; 1102 } 1103 if (_.slideCount % _.options.slidesToScroll !== 0) { 1104 if (slideIndex + _.options.slidesToScroll > _.slideCount && _.slideCount > _.options.slidesToShow) { 1105 if (slideIndex > _.slideCount) { 1106 _.slideOffset = ((_.options.slidesToShow - (slideIndex - _.slideCount)) * _.slideWidth) * -1; 1107 verticalOffset = ((_.options.slidesToShow - (slideIndex - _.slideCount)) * verticalHeight) * -1; 1108 } else { 1109 _.slideOffset = ((_.slideCount % _.options.slidesToScroll) * _.slideWidth) * -1; 1110 verticalOffset = ((_.slideCount % _.options.slidesToScroll) * verticalHeight) * -1; 1111 } 1112 } 1113 } 1114 } else { 1115 if (slideIndex + _.options.slidesToShow > _.slideCount) { 1116 _.slideOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * _.slideWidth; 1117 verticalOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * verticalHeight; 1118 } 1119 } 1120 1121 if (_.slideCount <= _.options.slidesToShow) { 1122 _.slideOffset = 0; 1123 verticalOffset = 0; 1124 } 1125 1126 if (_.options.centerMode === true && _.slideCount <= _.options.slidesToShow) { 1127 _.slideOffset = ((_.slideWidth * Math.floor(_.options.slidesToShow)) / 2) - ((_.slideWidth * _.slideCount) / 2); 1128 } else if (_.options.centerMode === true && _.options.infinite === true) { 1129 _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2) - _.slideWidth; 1130 } else if (_.options.centerMode === true) { 1131 _.slideOffset = 0; 1132 _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2); 1133 } 1134 1135 if (_.options.vertical === false) { 1136 targetLeft = ((slideIndex * _.slideWidth) * -1) + _.slideOffset; 1137 } else { 1138 targetLeft = ((slideIndex * verticalHeight) * -1) + verticalOffset; 1139 } 1140 1141 if (_.options.variableWidth === true) { 1142 1143 if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) { 1144 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex); 1145 } else { 1146 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow); 1147 } 1148 1149 if (_.options.rtl === true) { 1150 if (targetSlide[0]) { 1151 targetLeft = (_.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1; 1152 } else { 1153 targetLeft = 0; 1154 } 1155 } else { 1156 targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0; 1157 } 1158 1159 if (_.options.centerMode === true) { 1160 if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) { 1161 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex); 1162 } else { 1163 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow + 1); 1164 } 1165 1166 if (_.options.rtl === true) { 1167 if (targetSlide[0]) { 1168 targetLeft = (_.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1; 1169 } else { 1170 targetLeft = 0; 1171 } 1172 } else { 1173 targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0; 1174 } 1175 1176 targetLeft += (_.$list.width() - targetSlide.outerWidth()) / 2; 1177 } 1178 } 1179 1180 return targetLeft; 1181 1182 }; 1183 1184 Slick.prototype.getOption = Slick.prototype.slickGetOption = function(option) { 1185 1186 var _ = this; 1187 1188 return _.options[option]; 1189 1190 }; 1191 1192 Slick.prototype.getNavigableIndexes = function() { 1193 1194 var _ = this, 1195 breakPoint = 0, 1196 counter = 0, 1197 indexes = [], 1198 max; 1199 1200 if (_.options.infinite === false) { 1201 max = _.slideCount; 1202 } else { 1203 breakPoint = _.options.slidesToScroll * -1; 1204 counter = _.options.slidesToScroll * -1; 1205 max = _.slideCount * 2; 1206 } 1207 1208 while (breakPoint < max) { 1209 indexes.push(breakPoint); 1210 breakPoint = counter + _.options.slidesToScroll; 1211 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 1212 } 1213 1214 return indexes; 1215 1216 }; 1217 1218 Slick.prototype.getSlick = function() { 1219 1220 return this; 1221 1222 }; 1223 1224 Slick.prototype.getSlideCount = function() { 1225 1226 var _ = this, 1227 slidesTraversed, swipedSlide, centerOffset; 1228 1229 centerOffset = _.options.centerMode === true ? _.slideWidth * Math.floor(_.options.slidesToShow / 2) : 0; 1230 1231 if (_.options.swipeToSlide === true) { 1232 _.$slideTrack.find('.slick-slide').each(function(index, slide) { 1233 if (slide.offsetLeft - centerOffset + ($(slide).outerWidth() / 2) > (_.swipeLeft * -1)) { 1234 swipedSlide = slide; 1235 return false; 1236 } 1237 }); 1238 1239 slidesTraversed = Math.abs($(swipedSlide).attr('data-slick-index') - _.currentSlide) || 1; 1240 1241 return slidesTraversed; 1242 1243 } else { 1244 return _.options.slidesToScroll; 1245 } 1246 1247 }; 1248 1249 Slick.prototype.goTo = Slick.prototype.slickGoTo = function(slide, dontAnimate) { 1250 1251 var _ = this; 1252 1253 _.changeSlide({ 1254 data: { 1255 message: 'index', 1256 index: parseInt(slide) 1257 } 1258 }, dontAnimate); 1259 1260 }; 1261 1262 Slick.prototype.init = function(creation) { 1263 1264 var _ = this; 1265 1266 if (!$(_.$slider).hasClass('slick-initialized')) { 1267 1268 $(_.$slider).addClass('slick-initialized'); 1269 1270 _.buildRows(); 1271 _.buildOut(); 1272 _.setProps(); 1273 _.startLoad(); 1274 _.loadSlider(); 1275 _.initializeEvents(); 1276 _.updateArrows(); 1277 _.updateDots(); 1278 _.checkResponsive(true); 1279 _.focusHandler(); 1280 1281 } 1282 1283 if (creation) { 1284 _.$slider.trigger('init', [_]); 1285 } 1286 1287 if (_.options.accessibility === true) { 1288 _.initADA(); 1289 } 1290 1291 if ( _.options.autoplay ) { 1292 1293 _.paused = false; 1294 _.autoPlay(); 1295 1296 } 1297 1298 }; 1299 1300 Slick.prototype.initADA = function() { 1301 var _ = this, 1302 numDotGroups = Math.ceil(_.slideCount / _.options.slidesToShow), 1303 tabControlIndexes = _.getNavigableIndexes().filter(function(val) { 1304 return (val >= 0) && (val < _.slideCount); 1305 }); 1306 1307 _.$slides.add(_.$slideTrack.find('.slick-cloned')).attr({ 1308 'aria-hidden': 'true', 1309 'tabindex': '-1' 1310 }).find('a, input, button, select').attr({ 1311 'tabindex': '-1' 1312 }); 1313 1314 if (_.$dots !== null) { 1315 _.$slides.not(_.$slideTrack.find('.slick-cloned')).each(function(i) { 1316 var slideControlIndex = tabControlIndexes.indexOf(i); 1317 1318 $(this).attr({ 1319 'role': 'tabpanel', 1320 'id': 'slick-slide' + _.instanceUid + i, 1321 'tabindex': -1 1322 }); 1323 1324 if (slideControlIndex !== -1) { 1325 var ariaButtonControl = 'slick-slide-control' + _.instanceUid + slideControlIndex 1326 if ($('#' + ariaButtonControl).length) { 1327 $(this).attr({ 1328 'aria-describedby': ariaButtonControl 1329 }); 1330 } 1331 } 1332 }); 1333 1334 _.$dots.attr('role', 'tablist').find('li').each(function(i) { 1335 var mappedSlideIndex = tabControlIndexes[i]; 1336 1337 $(this).attr({ 1338 'role': 'presentation' 1339 }); 1340 1341 $(this).find('button').first().attr({ 1342 'role': 'tab', 1343 'id': 'slick-slide-control' + _.instanceUid + i, 1344 'aria-controls': 'slick-slide' + _.instanceUid + mappedSlideIndex, 1345 'aria-label': (i + 1) + ' of ' + numDotGroups, 1346 'aria-selected': null, 1347 'tabindex': '-1' 1348 }); 1349 1350 }).eq(_.currentSlide).find('button').attr({ 1351 'aria-selected': 'true', 1352 'tabindex': '0' 1353 }).end(); 1354 } 1355 1356 for (var i=_.currentSlide, max=i+_.options.slidesToShow; i < max; i++) { 1357 if (_.options.focusOnChange) { 1358 _.$slides.eq(i).attr({'tabindex': '0'}); 1359 } else { 1360 _.$slides.eq(i).removeAttr('tabindex'); 1361 } 1362 } 1363 1364 _.activateADA(); 1365 1366 }; 1367 1368 Slick.prototype.initArrowEvents = function() { 1369 1370 var _ = this; 1371 1372 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 1373 _.$prevArrow 1374 .off('click.slick') 1375 .on('click.slick', { 1376 message: 'previous' 1377 }, _.changeSlide); 1378 _.$nextArrow 1379 .off('click.slick') 1380 .on('click.slick', { 1381 message: 'next' 1382 }, _.changeSlide); 1383 1384 if (_.options.accessibility === true) { 1385 _.$prevArrow.on('keydown.slick', _.keyHandler); 1386 _.$nextArrow.on('keydown.slick', _.keyHandler); 1387 } 1388 } 1389 1390 }; 1391 1392 Slick.prototype.initDotEvents = function() { 1393 1394 var _ = this; 1395 1396 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 1397 $('li', _.$dots).on('click.slick', { 1398 message: 'index' 1399 }, _.changeSlide); 1400 1401 if (_.options.accessibility === true) { 1402 _.$dots.on('keydown.slick', _.keyHandler); 1403 } 1404 } 1405 1406 if (_.options.dots === true && _.options.pauseOnDotsHover === true && _.slideCount > _.options.slidesToShow) { 1407 1408 $('li', _.$dots) 1409 .on('mouseenter.slick', $.proxy(_.interrupt, _, true)) 1410 .on('mouseleave.slick', $.proxy(_.interrupt, _, false)); 1411 1412 } 1413 1414 }; 1415 1416 Slick.prototype.initSlideEvents = function() { 1417 1418 var _ = this; 1419 1420 if ( _.options.pauseOnHover ) { 1421 1422 _.$list.on('mouseenter.slick', $.proxy(_.interrupt, _, true)); 1423 _.$list.on('mouseleave.slick', $.proxy(_.interrupt, _, false)); 1424 1425 } 1426 1427 }; 1428 1429 Slick.prototype.initializeEvents = function() { 1430 1431 var _ = this; 1432 1433 _.initArrowEvents(); 1434 1435 _.initDotEvents(); 1436 _.initSlideEvents(); 1437 1438 _.$list.on('touchstart.slick mousedown.slick', { 1439 action: 'start' 1440 }, _.swipeHandler); 1441 _.$list.on('touchmove.slick mousemove.slick', { 1442 action: 'move' 1443 }, _.swipeHandler); 1444 _.$list.on('touchend.slick mouseup.slick', { 1445 action: 'end' 1446 }, _.swipeHandler); 1447 _.$list.on('touchcancel.slick mouseleave.slick', { 1448 action: 'end' 1449 }, _.swipeHandler); 1450 1451 _.$list.on('click.slick', _.clickHandler); 1452 1453 $(document).on(_.visibilityChange, $.proxy(_.visibility, _)); 1454 1455 if (_.options.accessibility === true) { 1456 _.$list.on('keydown.slick', _.keyHandler); 1457 } 1458 1459 if (_.options.focusOnSelect === true) { 1460 $(_.$slideTrack).children().on('click.slick', _.selectHandler); 1461 } 1462 1463 $(window).on('orientationchange.slick.slick-' + _.instanceUid, $.proxy(_.orientationChange, _)); 1464 1465 $(window).on('resize.slick.slick-' + _.instanceUid, $.proxy(_.resize, _)); 1466 1467 $('[draggable!=true]', _.$slideTrack).on('dragstart', _.preventDefault); 1468 1469 $(window).on('load.slick.slick-' + _.instanceUid, _.setPosition); 1470 $(_.setPosition); 1471 1472 }; 1473 1474 Slick.prototype.initUI = function() { 1475 1476 var _ = this; 1477 1478 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 1479 1480 _.$prevArrow.show(); 1481 _.$nextArrow.show(); 1482 1483 } 1484 1485 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 1486 1487 _.$dots.show(); 1488 1489 } 1490 1491 }; 1492 1493 Slick.prototype.keyHandler = function(event) { 1494 1495 var _ = this; 1496 //Dont slide if the cursor is inside the form fields and arrow keys are pressed 1497 if(!event.target.tagName.match('TEXTAREA|INPUT|SELECT')) { 1498 if (event.keyCode === 37 && _.options.accessibility === true) { 1499 _.changeSlide({ 1500 data: { 1501 message: _.options.rtl === true ? 'next' : 'previous' 1502 } 1503 }); 1504 } else if (event.keyCode === 39 && _.options.accessibility === true) { 1505 _.changeSlide({ 1506 data: { 1507 message: _.options.rtl === true ? 'previous' : 'next' 1508 } 1509 }); 1510 } 1511 } 1512 1513 }; 1514 1515 Slick.prototype.lazyLoad = function() { 1516 1517 var _ = this, 1518 loadRange, cloneRange, rangeStart, rangeEnd; 1519 1520 function loadImages(imagesScope) { 1521 1522 $('img[data-lazy]', imagesScope).each(function() { 1523 1524 var image = $(this), 1525 imageSource = $(this).attr('data-lazy'), 1526 imageSrcSet = $(this).attr('data-srcset'), 1527 imageSizes = $(this).attr('data-sizes') || _.$slider.attr('data-sizes'), 1528 imageToLoad = document.createElement('img'); 1529 1530 imageToLoad.onload = function() { 1531 1532 image 1533 .animate({ opacity: 0 }, 100, function() { 1534 1535 if (imageSrcSet) { 1536 image 1537 .attr('srcset', imageSrcSet ); 1538 1539 if (imageSizes) { 1540 image 1541 .attr('sizes', imageSizes ); 1542 } 1543 } 1544 1545 image 1546 .attr('src', imageSource) 1547 .animate({ opacity: 1 }, 200, function() { 1548 image 1549 .removeAttr('data-lazy data-srcset data-sizes') 1550 .removeClass('slick-loading'); 1551 }); 1552 _.$slider.trigger('lazyLoaded', [_, image, imageSource]); 1553 }); 1554 1555 }; 1556 1557 imageToLoad.onerror = function() { 1558 1559 image 1560 .removeAttr( 'data-lazy' ) 1561 .removeClass( 'slick-loading' ) 1562 .addClass( 'slick-lazyload-error' ); 1563 1564 _.$slider.trigger('lazyLoadError', [ _, image, imageSource ]); 1565 1566 }; 1567 1568 imageToLoad.src = imageSource; 1569 1570 }); 1571 1572 } 1573 1574 if (_.options.centerMode === true) { 1575 if (_.options.infinite === true) { 1576 rangeStart = _.currentSlide + (_.options.slidesToShow / 2 + 1); 1577 rangeEnd = rangeStart + _.options.slidesToShow + 2; 1578 } else { 1579 rangeStart = Math.max(0, _.currentSlide - (_.options.slidesToShow / 2 + 1)); 1580 rangeEnd = 2 + (_.options.slidesToShow / 2 + 1) + _.currentSlide; 1581 } 1582 } else { 1583 rangeStart = _.options.infinite ? _.options.slidesToShow + _.currentSlide : _.currentSlide; 1584 rangeEnd = Math.ceil(rangeStart + _.options.slidesToShow); 1585 if (_.options.fade === true) { 1586 if (rangeStart > 0) rangeStart--; 1587 if (rangeEnd <= _.slideCount) rangeEnd++; 1588 } 1589 } 1590 1591 loadRange = _.$slider.find('.slick-slide').slice(rangeStart, rangeEnd); 1592 1593 if (_.options.lazyLoad === 'anticipated') { 1594 var prevSlide = rangeStart - 1, 1595 nextSlide = rangeEnd, 1596 $slides = _.$slider.find('.slick-slide'); 1597 1598 for (var i = 0; i < _.options.slidesToScroll; i++) { 1599 if (prevSlide < 0) prevSlide = _.slideCount - 1; 1600 loadRange = loadRange.add($slides.eq(prevSlide)); 1601 loadRange = loadRange.add($slides.eq(nextSlide)); 1602 prevSlide--; 1603 nextSlide++; 1604 } 1605 } 1606 1607 loadImages(loadRange); 1608 1609 if (_.slideCount <= _.options.slidesToShow) { 1610 cloneRange = _.$slider.find('.slick-slide'); 1611 loadImages(cloneRange); 1612 } else 1613 if (_.currentSlide >= _.slideCount - _.options.slidesToShow) { 1614 cloneRange = _.$slider.find('.slick-cloned').slice(0, _.options.slidesToShow); 1615 loadImages(cloneRange); 1616 } else if (_.currentSlide === 0) { 1617 cloneRange = _.$slider.find('.slick-cloned').slice(_.options.slidesToShow * -1); 1618 loadImages(cloneRange); 1619 } 1620 1621 }; 1622 1623 Slick.prototype.loadSlider = function() { 1624 1625 var _ = this; 1626 1627 _.setPosition(); 1628 1629 _.$slideTrack.css({ 1630 opacity: 1 1631 }); 1632 1633 _.$slider.removeClass('slick-loading'); 1634 1635 _.initUI(); 1636 1637 if (_.options.lazyLoad === 'progressive') { 1638 _.progressiveLazyLoad(); 1639 } 1640 1641 }; 1642 1643 Slick.prototype.next = Slick.prototype.slickNext = function() { 1644 1645 var _ = this; 1646 1647 _.changeSlide({ 1648 data: { 1649 message: 'next' 1650 } 1651 }); 1652 1653 }; 1654 1655 Slick.prototype.orientationChange = function() { 1656 1657 var _ = this; 1658 1659 _.checkResponsive(); 1660 _.setPosition(); 1661 1662 }; 1663 1664 Slick.prototype.pause = Slick.prototype.slickPause = function() { 1665 1666 var _ = this; 1667 1668 _.autoPlayClear(); 1669 _.paused = true; 1670 1671 }; 1672 1673 Slick.prototype.play = Slick.prototype.slickPlay = function() { 1674 1675 var _ = this; 1676 1677 _.autoPlay(); 1678 _.options.autoplay = true; 1679 _.paused = false; 1680 _.focussed = false; 1681 _.interrupted = false; 1682 1683 }; 1684 1685 Slick.prototype.postSlide = function(index) { 1686 1687 var _ = this; 1688 1689 if( !_.unslicked ) { 1690 1691 _.$slider.trigger('afterChange', [_, index]); 1692 1693 _.animating = false; 1694 1695 if (_.slideCount > _.options.slidesToShow) { 1696 _.setPosition(); 1697 } 1698 1699 _.swipeLeft = null; 1700 1701 if ( _.options.autoplay ) { 1702 _.autoPlay(); 1703 } 1704 1705 if (_.options.accessibility === true) { 1706 _.initADA(); 1707 1708 if (_.options.focusOnChange) { 1709 var $currentSlide = $(_.$slides.get(_.currentSlide)); 1710 $currentSlide.attr('tabindex', 0).focus(); 1711 } 1712 } 1713 1714 } 1715 1716 }; 1717 1718 Slick.prototype.prev = Slick.prototype.slickPrev = function() { 1719 1720 var _ = this; 1721 1722 _.changeSlide({ 1723 data: { 1724 message: 'previous' 1725 } 1726 }); 1727 1728 }; 1729 1730 Slick.prototype.preventDefault = function(event) { 1731 1732 event.preventDefault(); 1733 1734 }; 1735 1736 Slick.prototype.progressiveLazyLoad = function( tryCount ) { 1737 1738 tryCount = tryCount || 1; 1739 1740 var _ = this, 1741 $imgsToLoad = $( 'img[data-lazy]', _.$slider ), 1742 image, 1743 imageSource, 1744 imageSrcSet, 1745 imageSizes, 1746 imageToLoad; 1747 1748 if ( $imgsToLoad.length ) { 1749 1750 image = $imgsToLoad.first(); 1751 imageSource = image.attr('data-lazy'); 1752 imageSrcSet = image.attr('data-srcset'); 1753 imageSizes = image.attr('data-sizes') || _.$slider.attr('data-sizes'); 1754 imageToLoad = document.createElement('img'); 1755 1756 imageToLoad.onload = function() { 1757 1758 if (imageSrcSet) { 1759 image 1760 .attr('srcset', imageSrcSet ); 1761 1762 if (imageSizes) { 1763 image 1764 .attr('sizes', imageSizes ); 1765 } 1766 } 1767 1768 image 1769 .attr( 'src', imageSource ) 1770 .removeAttr('data-lazy data-srcset data-sizes') 1771 .removeClass('slick-loading'); 1772 1773 if ( _.options.adaptiveHeight === true ) { 1774 _.setPosition(); 1775 } 1776 1777 _.$slider.trigger('lazyLoaded', [ _, image, imageSource ]); 1778 _.progressiveLazyLoad(); 1779 1780 }; 1781 1782 imageToLoad.onerror = function() { 1783 1784 if ( tryCount < 3 ) { 1785 1786 /** 1787 * try to load the image 3 times, 1788 * leave a slight delay so we don't get 1789 * servers blocking the request. 1790 */ 1791 setTimeout( function() { 1792 _.progressiveLazyLoad( tryCount + 1 ); 1793 }, 500 ); 1794 1795 } else { 1796 1797 image 1798 .removeAttr( 'data-lazy' ) 1799 .removeClass( 'slick-loading' ) 1800 .addClass( 'slick-lazyload-error' ); 1801 1802 _.$slider.trigger('lazyLoadError', [ _, image, imageSource ]); 1803 1804 _.progressiveLazyLoad(); 1805 1806 } 1807 1808 }; 1809 1810 imageToLoad.src = imageSource; 1811 1812 } else { 1813 1814 _.$slider.trigger('allImagesLoaded', [ _ ]); 1815 1816 } 1817 1818 }; 1819 1820 Slick.prototype.refresh = function( initializing ) { 1821 1822 var _ = this, currentSlide, lastVisibleIndex; 1823 1824 lastVisibleIndex = _.slideCount - _.options.slidesToShow; 1825 1826 // in non-infinite sliders, we don't want to go past the 1827 // last visible index. 1828 if( !_.options.infinite && ( _.currentSlide > lastVisibleIndex )) { 1829 _.currentSlide = lastVisibleIndex; 1830 } 1831 1832 // if less slides than to show, go to start. 1833 if ( _.slideCount <= _.options.slidesToShow ) { 1834 _.currentSlide = 0; 1835 1836 } 1837 1838 currentSlide = _.currentSlide; 1839 1840 _.destroy(true); 1841 1842 $.extend(_, _.initials, { currentSlide: currentSlide }); 1843 1844 _.init(); 1845 1846 if( !initializing ) { 1847 1848 _.changeSlide({ 1849 data: { 1850 message: 'index', 1851 index: currentSlide 1852 } 1853 }, false); 1854 1855 } 1856 1857 }; 1858 1859 Slick.prototype.registerBreakpoints = function() { 1860 1861 var _ = this, breakpoint, currentBreakpoint, l, 1862 responsiveSettings = _.options.responsive || null; 1863 1864 if ( $.type(responsiveSettings) === 'array' && responsiveSettings.length ) { 1865 1866 _.respondTo = _.options.respondTo || 'window'; 1867 1868 for ( breakpoint in responsiveSettings ) { 1869 1870 l = _.breakpoints.length-1; 1871 1872 if (responsiveSettings.hasOwnProperty(breakpoint)) { 1873 currentBreakpoint = responsiveSettings[breakpoint].breakpoint; 1874 1875 // loop through the breakpoints and cut out any existing 1876 // ones with the same breakpoint number, we don't want dupes. 1877 while( l >= 0 ) { 1878 if( _.breakpoints[l] && _.breakpoints[l] === currentBreakpoint ) { 1879 _.breakpoints.splice(l,1); 1880 } 1881 l--; 1882 } 1883 1884 _.breakpoints.push(currentBreakpoint); 1885 _.breakpointSettings[currentBreakpoint] = responsiveSettings[breakpoint].settings; 1886 1887 } 1888 1889 } 1890 1891 _.breakpoints.sort(function(a, b) { 1892 return ( _.options.mobileFirst ) ? a-b : b-a; 1893 }); 1894 1895 } 1896 1897 }; 1898 1899 Slick.prototype.reinit = function() { 1900 1901 var _ = this; 1902 1903 _.$slides = 1904 _.$slideTrack 1905 .children(_.options.slide) 1906 .addClass('slick-slide'); 1907 1908 _.slideCount = _.$slides.length; 1909 1910 if (_.currentSlide >= _.slideCount && _.currentSlide !== 0) { 1911 _.currentSlide = _.currentSlide - _.options.slidesToScroll; 1912 } 1913 1914 if (_.slideCount <= _.options.slidesToShow) { 1915 _.currentSlide = 0; 1916 } 1917 1918 _.registerBreakpoints(); 1919 1920 _.setProps(); 1921 _.setupInfinite(); 1922 _.buildArrows(); 1923 _.updateArrows(); 1924 _.initArrowEvents(); 1925 _.buildDots(); 1926 _.updateDots(); 1927 _.initDotEvents(); 1928 _.cleanUpSlideEvents(); 1929 _.initSlideEvents(); 1930 1931 _.checkResponsive(false, true); 1932 1933 if (_.options.focusOnSelect === true) { 1934 $(_.$slideTrack).children().on('click.slick', _.selectHandler); 1935 } 1936 1937 _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0); 1938 1939 _.setPosition(); 1940 _.focusHandler(); 1941 1942 _.paused = !_.options.autoplay; 1943 _.autoPlay(); 1944 1945 _.$slider.trigger('reInit', [_]); 1946 1947 }; 1948 1949 Slick.prototype.resize = function() { 1950 1951 var _ = this; 1952 1953 if ($(window).width() !== _.windowWidth) { 1954 clearTimeout(_.windowDelay); 1955 _.windowDelay = window.setTimeout(function() { 1956 _.windowWidth = $(window).width(); 1957 _.checkResponsive(); 1958 if( !_.unslicked ) { _.setPosition(); } 1959 }, 50); 1960 } 1961 }; 1962 1963 Slick.prototype.removeSlide = Slick.prototype.slickRemove = function(index, removeBefore, removeAll) { 1964 1965 var _ = this; 1966 1967 if (typeof(index) === 'boolean') { 1968 removeBefore = index; 1969 index = removeBefore === true ? 0 : _.slideCount - 1; 1970 } else { 1971 index = removeBefore === true ? --index : index; 1972 } 1973 1974 if (_.slideCount < 1 || index < 0 || index > _.slideCount - 1) { 1975 return false; 1976 } 1977 1978 _.unload(); 1979 1980 if (removeAll === true) { 1981 _.$slideTrack.children().remove(); 1982 } else { 1983 _.$slideTrack.children(this.options.slide).eq(index).remove(); 1984 } 1985 1986 _.$slides = _.$slideTrack.children(this.options.slide); 1987 1988 _.$slideTrack.children(this.options.slide).detach(); 1989 1990 _.$slideTrack.append(_.$slides); 1991 1992 _.$slidesCache = _.$slides; 1993 1994 _.reinit(); 1995 1996 }; 1997 1998 Slick.prototype.setCSS = function(position) { 1999 2000 var _ = this, 2001 positionProps = {}, 2002 x, y; 2003 2004 if (_.options.rtl === true) { 2005 position = -position; 2006 } 2007 x = _.positionProp == 'left' ? Math.ceil(position) + 'px' : '0px'; 2008 y = _.positionProp == 'top' ? Math.ceil(position) + 'px' : '0px'; 2009 2010 positionProps[_.positionProp] = position; 2011 2012 if (_.transformsEnabled === false) { 2013 _.$slideTrack.css(positionProps); 2014 } else { 2015 positionProps = {}; 2016 if (_.cssTransitions === false) { 2017 positionProps[_.animType] = 'translate(' + x + ', ' + y + ')'; 2018 _.$slideTrack.css(positionProps); 2019 } else { 2020 positionProps[_.animType] = 'translate3d(' + x + ', ' + y + ', 0px)'; 2021 _.$slideTrack.css(positionProps); 2022 } 2023 } 2024 2025 }; 2026 2027 Slick.prototype.setDimensions = function() { 2028 2029 var _ = this; 2030 2031 if (_.options.vertical === false) { 2032 if (_.options.centerMode === true) { 2033 _.$list.css({ 2034 padding: ('0px ' + _.options.centerPadding) 2035 }); 2036 } 2037 } else { 2038 _.$list.height(_.$slides.first().outerHeight(true) * _.options.slidesToShow); 2039 if (_.options.centerMode === true) { 2040 _.$list.css({ 2041 padding: (_.options.centerPadding + ' 0px') 2042 }); 2043 } 2044 } 2045 2046 _.listWidth = _.$list.width(); 2047 _.listHeight = _.$list.height(); 2048 2049 2050 if (_.options.vertical === false && _.options.variableWidth === false) { 2051 _.slideWidth = Math.ceil(_.listWidth / _.options.slidesToShow); 2052 _.$slideTrack.width(Math.ceil((_.slideWidth * _.$slideTrack.children('.slick-slide').length))); 2053 2054 } else if (_.options.variableWidth === true) { 2055 _.$slideTrack.width(5000 * _.slideCount); 2056 } else { 2057 _.slideWidth = Math.ceil(_.listWidth); 2058 _.$slideTrack.height(Math.ceil((_.$slides.first().outerHeight(true) * _.$slideTrack.children('.slick-slide').length))); 2059 } 2060 2061 var offset = _.$slides.first().outerWidth(true) - _.$slides.first().width(); 2062 if (_.options.variableWidth === false) _.$slideTrack.children('.slick-slide').width(_.slideWidth - offset); 2063 2064 }; 2065 2066 Slick.prototype.setFade = function() { 2067 2068 var _ = this, 2069 targetLeft; 2070 2071 _.$slides.each(function(index, element) { 2072 targetLeft = (_.slideWidth * index) * -1; 2073 if (_.options.rtl === true) { 2074 $(element).css({ 2075 position: 'relative', 2076 right: targetLeft, 2077 top: 0, 2078 zIndex: _.options.zIndex - 2, 2079 opacity: 0 2080 }); 2081 } else { 2082 $(element).css({ 2083 position: 'relative', 2084 left: targetLeft, 2085 top: 0, 2086 zIndex: _.options.zIndex - 2, 2087 opacity: 0 2088 }); 2089 } 2090 }); 2091 2092 _.$slides.eq(_.currentSlide).css({ 2093 zIndex: _.options.zIndex - 1, 2094 opacity: 1 2095 }); 2096 2097 }; 2098 2099 Slick.prototype.setHeight = function() { 2100 2101 var _ = this; 2102 2103 if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) { 2104 var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true); 2105 _.$list.css('height', targetHeight); 2106 } 2107 2108 }; 2109 2110 Slick.prototype.setOption = 2111 Slick.prototype.slickSetOption = function() { 2112 2113 /** 2114 * accepts arguments in format of: 2115 * 2116 * - for changing a single option's value: 2117 * .slick("setOption", option, value, refresh ) 2118 * 2119 * - for changing a set of responsive options: 2120 * .slick("setOption", 'responsive', [{}, ...], refresh ) 2121 * 2122 * - for updating multiple values at once (not responsive) 2123 * .slick("setOption", { 'option': value, ... }, refresh ) 2124 */ 2125 2126 var _ = this, l, item, option, value, refresh = false, type; 2127 2128 if( $.type( arguments[0] ) === 'object' ) { 2129 2130 option = arguments[0]; 2131 refresh = arguments[1]; 2132 type = 'multiple'; 2133 2134 } else if ( $.type( arguments[0] ) === 'string' ) { 2135 2136 option = arguments[0]; 2137 value = arguments[1]; 2138 refresh = arguments[2]; 2139 2140 if ( arguments[0] === 'responsive' && $.type( arguments[1] ) === 'array' ) { 2141 2142 type = 'responsive'; 2143 2144 } else if ( typeof arguments[1] !== 'undefined' ) { 2145 2146 type = 'single'; 2147 2148 } 2149 2150 } 2151 2152 if ( type === 'single' ) { 2153 2154 _.options[option] = value; 2155 2156 2157 } else if ( type === 'multiple' ) { 2158 2159 $.each( option , function( opt, val ) { 2160 2161 _.options[opt] = val; 2162 2163 }); 2164 2165 2166 } else if ( type === 'responsive' ) { 2167 2168 for ( item in value ) { 2169 2170 if( $.type( _.options.responsive ) !== 'array' ) { 2171 2172 _.options.responsive = [ value[item] ]; 2173 2174 } else { 2175 2176 l = _.options.responsive.length-1; 2177 2178 // loop through the responsive object and splice out duplicates. 2179 while( l >= 0 ) { 2180 2181 if( _.options.responsive[l].breakpoint === value[item].breakpoint ) { 2182 2183 _.options.responsive.splice(l,1); 2184 2185 } 2186 2187 l--; 2188 2189 } 2190 2191 _.options.responsive.push( value[item] ); 2192 2193 } 2194 2195 } 2196 2197 } 2198 2199 if ( refresh ) { 2200 2201 _.unload(); 2202 _.reinit(); 2203 2204 } 2205 2206 }; 2207 2208 Slick.prototype.setPosition = function() { 2209 2210 var _ = this; 2211 2212 _.setDimensions(); 2213 2214 _.setHeight(); 2215 2216 if (_.options.fade === false) { 2217 _.setCSS(_.getLeft(_.currentSlide)); 2218 } else { 2219 _.setFade(); 2220 } 2221 2222 _.$slider.trigger('setPosition', [_]); 2223 2224 }; 2225 2226 Slick.prototype.setProps = function() { 2227 2228 var _ = this, 2229 bodyStyle = document.body.style; 2230 2231 _.positionProp = _.options.vertical === true ? 'top' : 'left'; 2232 2233 if (_.positionProp === 'top') { 2234 _.$slider.addClass('slick-vertical'); 2235 } else { 2236 _.$slider.removeClass('slick-vertical'); 2237 } 2238 2239 if (bodyStyle.WebkitTransition !== undefined || 2240 bodyStyle.MozTransition !== undefined || 2241 bodyStyle.msTransition !== undefined) { 2242 if (_.options.useCSS === true) { 2243 _.cssTransitions = true; 2244 } 2245 } 2246 2247 if ( _.options.fade ) { 2248 if ( typeof _.options.zIndex === 'number' ) { 2249 if( _.options.zIndex < 3 ) { 2250 _.options.zIndex = 3; 2251 } 2252 } else { 2253 _.options.zIndex = _.defaults.zIndex; 2254 } 2255 } 2256 2257 if (bodyStyle.OTransform !== undefined) { 2258 _.animType = 'OTransform'; 2259 _.transformType = '-o-transform'; 2260 _.transitionType = 'OTransition'; 2261 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false; 2262 } 2263 if (bodyStyle.MozTransform !== undefined) { 2264 _.animType = 'MozTransform'; 2265 _.transformType = '-moz-transform'; 2266 _.transitionType = 'MozTransition'; 2267 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.MozPerspective === undefined) _.animType = false; 2268 } 2269 if (bodyStyle.webkitTransform !== undefined) { 2270 _.animType = 'webkitTransform'; 2271 _.transformType = '-webkit-transform'; 2272 _.transitionType = 'webkitTransition'; 2273 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false; 2274 } 2275 if (bodyStyle.msTransform !== undefined) { 2276 _.animType = 'msTransform'; 2277 _.transformType = '-ms-transform'; 2278 _.transitionType = 'msTransition'; 2279 if (bodyStyle.msTransform === undefined) _.animType = false; 2280 } 2281 if (bodyStyle.transform !== undefined && _.animType !== false) { 2282 _.animType = 'transform'; 2283 _.transformType = 'transform'; 2284 _.transitionType = 'transition'; 2285 } 2286 _.transformsEnabled = _.options.useTransform && (_.animType !== null && _.animType !== false); 2287 }; 2288 2289 2290 Slick.prototype.setSlideClasses = function(index) { 2291 2292 var _ = this, 2293 centerOffset, allSlides, indexOffset, remainder; 2294 2295 allSlides = _.$slider 2296 .find('.slick-slide') 2297 .removeClass('slick-active slick-center slick-current') 2298 .attr('aria-hidden', 'true'); 2299 2300 _.$slides 2301 .eq(index) 2302 .addClass('slick-current'); 2303 2304 if (_.options.centerMode === true) { 2305 2306 var evenCoef = _.options.slidesToShow % 2 === 0 ? 1 : 0; 2307 2308 centerOffset = Math.floor(_.options.slidesToShow / 2); 2309 2310 if (_.options.infinite === true) { 2311 2312 if (index >= centerOffset && index <= (_.slideCount - 1) - centerOffset) { 2313 _.$slides 2314 .slice(index - centerOffset + evenCoef, index + centerOffset + 1) 2315 .addClass('slick-active') 2316 .attr('aria-hidden', 'false'); 2317 2318 } else { 2319 2320 indexOffset = _.options.slidesToShow + index; 2321 allSlides 2322 .slice(indexOffset - centerOffset + 1 + evenCoef, indexOffset + centerOffset + 2) 2323 .addClass('slick-active') 2324 .attr('aria-hidden', 'false'); 2325 2326 } 2327 2328 if (index === 0) { 2329 2330 allSlides 2331 .eq(allSlides.length - 1 - _.options.slidesToShow) 2332 .addClass('slick-center'); 2333 2334 } else if (index === _.slideCount - 1) { 2335 2336 allSlides 2337 .eq(_.options.slidesToShow) 2338 .addClass('slick-center'); 2339 2340 } 2341 2342 } 2343 2344 _.$slides 2345 .eq(index) 2346 .addClass('slick-center'); 2347 2348 } else { 2349 2350 if (index >= 0 && index <= (_.slideCount - _.options.slidesToShow)) { 2351 2352 _.$slides 2353 .slice(index, index + _.options.slidesToShow) 2354 .addClass('slick-active') 2355 .attr('aria-hidden', 'false'); 2356 2357 } else if (allSlides.length <= _.options.slidesToShow) { 2358 2359 allSlides 2360 .addClass('slick-active') 2361 .attr('aria-hidden', 'false'); 2362 2363 } else { 2364 2365 remainder = _.slideCount % _.options.slidesToShow; 2366 indexOffset = _.options.infinite === true ? _.options.slidesToShow + index : index; 2367 2368 if (_.options.slidesToShow == _.options.slidesToScroll && (_.slideCount - index) < _.options.slidesToShow) { 2369 2370 allSlides 2371 .slice(indexOffset - (_.options.slidesToShow - remainder), indexOffset + remainder) 2372 .addClass('slick-active') 2373 .attr('aria-hidden', 'false'); 2374 2375 } else { 2376 2377 allSlides 2378 .slice(indexOffset, indexOffset + _.options.slidesToShow) 2379 .addClass('slick-active') 2380 .attr('aria-hidden', 'false'); 2381 2382 } 2383 2384 } 2385 2386 } 2387 2388 if (_.options.lazyLoad === 'ondemand' || _.options.lazyLoad === 'anticipated') { 2389 _.lazyLoad(); 2390 } 2391 }; 2392 2393 Slick.prototype.setupInfinite = function() { 2394 2395 var _ = this, 2396 i, slideIndex, infiniteCount; 2397 2398 if (_.options.fade === true) { 2399 _.options.centerMode = false; 2400 } 2401 2402 if (_.options.infinite === true && _.options.fade === false) { 2403 2404 slideIndex = null; 2405 2406 if (_.slideCount > _.options.slidesToShow) { 2407 2408 if (_.options.centerMode === true) { 2409 infiniteCount = _.options.slidesToShow + 1; 2410 } else { 2411 infiniteCount = _.options.slidesToShow; 2412 } 2413 2414 for (i = _.slideCount; i > (_.slideCount - 2415 infiniteCount); i -= 1) { 2416 slideIndex = i - 1; 2417 $(_.$slides[slideIndex]).clone(true).attr('id', '') 2418 .attr('data-slick-index', slideIndex - _.slideCount) 2419 .prependTo(_.$slideTrack).addClass('slick-cloned'); 2420 } 2421 for (i = 0; i < infiniteCount + _.slideCount; i += 1) { 2422 slideIndex = i; 2423 $(_.$slides[slideIndex]).clone(true).attr('id', '') 2424 .attr('data-slick-index', slideIndex + _.slideCount) 2425 .appendTo(_.$slideTrack).addClass('slick-cloned'); 2426 } 2427 _.$slideTrack.find('.slick-cloned').find('[id]').each(function() { 2428 $(this).attr('id', ''); 2429 }); 2430 2431 } 2432 2433 } 2434 2435 }; 2436 2437 Slick.prototype.interrupt = function( toggle ) { 2438 2439 var _ = this; 2440 2441 if( !toggle ) { 2442 _.autoPlay(); 2443 } 2444 _.interrupted = toggle; 2445 2446 }; 2447 2448 Slick.prototype.selectHandler = function(event) { 2449 2450 var _ = this; 2451 2452 var targetElement = 2453 $(event.target).is('.slick-slide') ? 2454 $(event.target) : 2455 $(event.target).parents('.slick-slide'); 2456 2457 var index = parseInt(targetElement.attr('data-slick-index')); 2458 2459 if (!index) index = 0; 2460 2461 if (_.slideCount <= _.options.slidesToShow) { 2462 2463 _.slideHandler(index, false, true); 2464 return; 2465 2466 } 2467 2468 _.slideHandler(index); 2469 2470 }; 2471 2472 Slick.prototype.slideHandler = function(index, sync, dontAnimate) { 2473 2474 var targetSlide, animSlide, oldSlide, slideLeft, targetLeft = null, 2475 _ = this, navTarget; 2476 2477 sync = sync || false; 2478 2479 if (_.animating === true && _.options.waitForAnimate === true) { 2480 return; 2481 } 2482 2483 if (_.options.fade === true && _.currentSlide === index) { 2484 return; 2485 } 2486 2487 if (sync === false) { 2488 _.asNavFor(index); 2489 } 2490 2491 targetSlide = index; 2492 targetLeft = _.getLeft(targetSlide); 2493 slideLeft = _.getLeft(_.currentSlide); 2494 2495 _.currentLeft = _.swipeLeft === null ? slideLeft : _.swipeLeft; 2496 2497 if (_.options.infinite === false && _.options.centerMode === false && (index < 0 || index > _.getDotCount() * _.options.slidesToScroll)) { 2498 if (_.options.fade === false) { 2499 targetSlide = _.currentSlide; 2500 if (dontAnimate !== true && _.slideCount > _.options.slidesToShow) { 2501 _.animateSlide(slideLeft, function() { 2502 _.postSlide(targetSlide); 2503 }); 2504 } else { 2505 _.postSlide(targetSlide); 2506 } 2507 } 2508 return; 2509 } else if (_.options.infinite === false && _.options.centerMode === true && (index < 0 || index > (_.slideCount - _.options.slidesToScroll))) { 2510 if (_.options.fade === false) { 2511 targetSlide = _.currentSlide; 2512 if (dontAnimate !== true && _.slideCount > _.options.slidesToShow) { 2513 _.animateSlide(slideLeft, function() { 2514 _.postSlide(targetSlide); 2515 }); 2516 } else { 2517 _.postSlide(targetSlide); 2518 } 2519 } 2520 return; 2521 } 2522 2523 if ( _.options.autoplay ) { 2524 clearInterval(_.autoPlayTimer); 2525 } 2526 2527 if (targetSlide < 0) { 2528 if (_.slideCount % _.options.slidesToScroll !== 0) { 2529 animSlide = _.slideCount - (_.slideCount % _.options.slidesToScroll); 2530 } else { 2531 animSlide = _.slideCount + targetSlide; 2532 } 2533 } else if (targetSlide >= _.slideCount) { 2534 if (_.slideCount % _.options.slidesToScroll !== 0) { 2535 animSlide = 0; 2536 } else { 2537 animSlide = targetSlide - _.slideCount; 2538 } 2539 } else { 2540 animSlide = targetSlide; 2541 } 2542 2543 _.animating = true; 2544 2545 _.$slider.trigger('beforeChange', [_, _.currentSlide, animSlide]); 2546 2547 oldSlide = _.currentSlide; 2548 _.currentSlide = animSlide; 2549 2550 _.setSlideClasses(_.currentSlide); 2551 2552 if ( _.options.asNavFor ) { 2553 2554 navTarget = _.getNavTarget(); 2555 navTarget = navTarget.slick('getSlick'); 2556 2557 if ( navTarget.slideCount <= navTarget.options.slidesToShow ) { 2558 navTarget.setSlideClasses(_.currentSlide); 2559 } 2560 2561 } 2562 2563 _.updateDots(); 2564 _.updateArrows(); 2565 2566 if (_.options.fade === true) { 2567 if (dontAnimate !== true) { 2568 2569 _.fadeSlideOut(oldSlide); 2570 2571 _.fadeSlide(animSlide, function() { 2572 _.postSlide(animSlide); 2573 }); 2574 2575 } else { 2576 _.postSlide(animSlide); 2577 } 2578 _.animateHeight(); 2579 return; 2580 } 2581 2582 if (dontAnimate !== true && _.slideCount > _.options.slidesToShow) { 2583 _.animateSlide(targetLeft, function() { 2584 _.postSlide(animSlide); 2585 }); 2586 } else { 2587 _.postSlide(animSlide); 2588 } 2589 2590 }; 2591 2592 Slick.prototype.startLoad = function() { 2593 2594 var _ = this; 2595 2596 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 2597 2598 _.$prevArrow.hide(); 2599 _.$nextArrow.hide(); 2600 2601 } 2602 2603 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 2604 2605 _.$dots.hide(); 2606 2607 } 2608 2609 _.$slider.addClass('slick-loading'); 2610 2611 }; 2612 2613 Slick.prototype.swipeDirection = function() { 2614 2615 var xDist, yDist, r, swipeAngle, _ = this; 2616 2617 xDist = _.touchObject.startX - _.touchObject.curX; 2618 yDist = _.touchObject.startY - _.touchObject.curY; 2619 r = Math.atan2(yDist, xDist); 2620 2621 swipeAngle = Math.round(r * 180 / Math.PI); 2622 if (swipeAngle < 0) { 2623 swipeAngle = 360 - Math.abs(swipeAngle); 2624 } 2625 2626 if ((swipeAngle <= 45) && (swipeAngle >= 0)) { 2627 return (_.options.rtl === false ? 'left' : 'right'); 2628 } 2629 if ((swipeAngle <= 360) && (swipeAngle >= 315)) { 2630 return (_.options.rtl === false ? 'left' : 'right'); 2631 } 2632 if ((swipeAngle >= 135) && (swipeAngle <= 225)) { 2633 return (_.options.rtl === false ? 'right' : 'left'); 2634 } 2635 if (_.options.verticalSwiping === true) { 2636 if ((swipeAngle >= 35) && (swipeAngle <= 135)) { 2637 return 'down'; 2638 } else { 2639 return 'up'; 2640 } 2641 } 2642 2643 return 'vertical'; 2644 2645 }; 2646 2647 Slick.prototype.swipeEnd = function(event) { 2648 2649 var _ = this, 2650 slideCount, 2651 direction; 2652 2653 _.dragging = false; 2654 _.swiping = false; 2655 2656 if (_.scrolling) { 2657 _.scrolling = false; 2658 return false; 2659 } 2660 2661 _.interrupted = false; 2662 _.shouldClick = ( _.touchObject.swipeLength > 10 ) ? false : true; 2663 2664 if ( _.touchObject.curX === undefined ) { 2665 return false; 2666 } 2667 2668 if ( _.touchObject.edgeHit === true ) { 2669 _.$slider.trigger('edge', [_, _.swipeDirection() ]); 2670 } 2671 2672 if ( _.touchObject.swipeLength >= _.touchObject.minSwipe ) { 2673 2674 direction = _.swipeDirection(); 2675 2676 switch ( direction ) { 2677 2678 case 'left': 2679 case 'down': 2680 2681 slideCount = 2682 _.options.swipeToSlide ? 2683 _.checkNavigable( _.currentSlide + _.getSlideCount() ) : 2684 _.currentSlide + _.getSlideCount(); 2685 2686 _.currentDirection = 0; 2687 2688 break; 2689 2690 case 'right': 2691 case 'up': 2692 2693 slideCount = 2694 _.options.swipeToSlide ? 2695 _.checkNavigable( _.currentSlide - _.getSlideCount() ) : 2696 _.currentSlide - _.getSlideCount(); 2697 2698 _.currentDirection = 1; 2699 2700 break; 2701
vendor: 8,484 bytes, lines 2702-3014
2702 default: 2703 2704 2705 } 2706 2707 if( direction != 'vertical' ) { 2708 2709 _.slideHandler( slideCount ); 2710 _.touchObject = {}; 2711 _.$slider.trigger('swipe', [_, direction ]); 2712 2713 } 2714 2715 } else { 2716 2717 if ( _.touchObject.startX !== _.touchObject.curX ) { 2718 2719 _.slideHandler( _.currentSlide ); 2720 _.touchObject = {}; 2721 2722 } 2723 2724 } 2725 2726 }; 2727 2728 Slick.prototype.swipeHandler = function(event) { 2729 2730 var _ = this; 2731 2732 if ((_.options.swipe === false) || ('ontouchend' in document && _.options.swipe === false)) { 2733 return; 2734 } else if (_.options.draggable === false && event.type.indexOf('mouse') !== -1) { 2735 return; 2736 } 2737 2738 _.touchObject.fingerCount = event.originalEvent && event.originalEvent.touches !== undefined ? 2739 event.originalEvent.touches.length : 1; 2740 2741 _.touchObject.minSwipe = _.listWidth / _.options 2742 .touchThreshold; 2743 2744 if (_.options.verticalSwiping === true) { 2745 _.touchObject.minSwipe = _.listHeight / _.options 2746 .touchThreshold; 2747 } 2748 2749 switch (event.data.action) { 2750 2751 case 'start': 2752 _.swipeStart(event); 2753 break; 2754 2755 case 'move': 2756 _.swipeMove(event); 2757 break; 2758 2759 case 'end': 2760 _.swipeEnd(event); 2761 break; 2762 2763 } 2764 2765 }; 2766 2767 Slick.prototype.swipeMove = function(event) { 2768 2769 var _ = this, 2770 edgeWasHit = false, 2771 curLeft, swipeDirection, swipeLength, positionOffset, touches, verticalSwipeLength; 2772 2773 touches = event.originalEvent !== undefined ? event.originalEvent.touches : null; 2774 2775 if (!_.dragging || _.scrolling || touches && touches.length !== 1) { 2776 return false; 2777 } 2778 2779 curLeft = _.getLeft(_.currentSlide); 2780 2781 _.touchObject.curX = touches !== undefined ? touches[0].pageX : event.clientX; 2782 _.touchObject.curY = touches !== undefined ? touches[0].pageY : event.clientY; 2783 2784 _.touchObject.swipeLength = Math.round(Math.sqrt( 2785 Math.pow(_.touchObject.curX - _.touchObject.startX, 2))); 2786 2787 verticalSwipeLength = Math.round(Math.sqrt( 2788 Math.pow(_.touchObject.curY - _.touchObject.startY, 2))); 2789 2790 if (!_.options.verticalSwiping && !_.swiping && verticalSwipeLength > 4) { 2791 _.scrolling = true; 2792 return false; 2793 } 2794 2795 if (_.options.verticalSwiping === true) { 2796 _.touchObject.swipeLength = verticalSwipeLength; 2797 } 2798 2799 swipeDirection = _.swipeDirection(); 2800 2801 if (event.originalEvent !== undefined && _.touchObject.swipeLength > 4) { 2802 _.swiping = true; 2803 event.preventDefault(); 2804 } 2805 2806 positionOffset = (_.options.rtl === false ? 1 : -1) * (_.touchObject.curX > _.touchObject.startX ? 1 : -1); 2807 if (_.options.verticalSwiping === true) { 2808 positionOffset = _.touchObject.curY > _.touchObject.startY ? 1 : -1; 2809 } 2810 2811 2812 swipeLength = _.touchObject.swipeLength; 2813 2814 _.touchObject.edgeHit = false; 2815 2816 if (_.options.infinite === false) { 2817 if ((_.currentSlide === 0 && swipeDirection === 'right') || (_.currentSlide >= _.getDotCount() && swipeDirection === 'left')) { 2818 swipeLength = _.touchObject.swipeLength * _.options.edgeFriction; 2819 _.touchObject.edgeHit = true; 2820 } 2821 } 2822 2823 if (_.options.vertical === false) { 2824 _.swipeLeft = curLeft + swipeLength * positionOffset; 2825 } else { 2826 _.swipeLeft = curLeft + (swipeLength * (_.$list.height() / _.listWidth)) * positionOffset; 2827 } 2828 if (_.options.verticalSwiping === true) { 2829 _.swipeLeft = curLeft + swipeLength * positionOffset; 2830 } 2831 2832 if (_.options.fade === true || _.options.touchMove === false) { 2833 return false; 2834 } 2835 2836 if (_.animating === true) { 2837 _.swipeLeft = null; 2838 return false; 2839 } 2840 2841 _.setCSS(_.swipeLeft); 2842 2843 }; 2844 2845 Slick.prototype.swipeStart = function(event) { 2846 2847 var _ = this, 2848 touches; 2849 2850 _.interrupted = true; 2851 2852 if (_.touchObject.fingerCount !== 1 || _.slideCount <= _.options.slidesToShow) { 2853 _.touchObject = {}; 2854 return false; 2855 } 2856 2857 if (event.originalEvent !== undefined && event.originalEvent.touches !== undefined) { 2858 touches = event.originalEvent.touches[0]; 2859 } 2860 2861 _.touchObject.startX = _.touchObject.curX = touches !== undefined ? touches.pageX : event.clientX; 2862 _.touchObject.startY = _.touchObject.curY = touches !== undefined ? touches.pageY : event.clientY; 2863 2864 _.dragging = true; 2865 2866 }; 2867 2868 Slick.prototype.unfilterSlides = Slick.prototype.slickUnfilter = function() { 2869 2870 var _ = this; 2871 2872 if (_.$slidesCache !== null) { 2873 2874 _.unload(); 2875 2876 _.$slideTrack.children(this.options.slide).detach(); 2877 2878 _.$slidesCache.appendTo(_.$slideTrack); 2879 2880 _.reinit(); 2881 2882 } 2883 2884 }; 2885 2886 Slick.prototype.unload = function() { 2887 2888 var _ = this; 2889 2890 $('.slick-cloned', _.$slider).remove(); 2891 2892 if (_.$dots) { 2893 _.$dots.remove(); 2894 } 2895 2896 if (_.$prevArrow && _.htmlExpr.test(_.options.prevArrow)) { 2897 _.$prevArrow.remove(); 2898 } 2899 2900 if (_.$nextArrow && _.htmlExpr.test(_.options.nextArrow)) { 2901 _.$nextArrow.remove(); 2902 } 2903 2904 _.$slides 2905 .removeClass('slick-slide slick-active slick-visible slick-current') 2906 .attr('aria-hidden', 'true') 2907 .css('width', ''); 2908 2909 }; 2910 2911 Slick.prototype.unslick = function(fromBreakpoint) { 2912 2913 var _ = this; 2914 _.$slider.trigger('unslick', [_, fromBreakpoint]); 2915 _.destroy(); 2916 2917 }; 2918 2919 Slick.prototype.updateArrows = function() { 2920 2921 var _ = this, 2922 centerOffset; 2923 2924 centerOffset = Math.floor(_.options.slidesToShow / 2); 2925 2926 if ( _.options.arrows === true && 2927 _.slideCount > _.options.slidesToShow && 2928 !_.options.infinite ) { 2929 2930 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 2931 _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 2932 2933 if (_.currentSlide === 0) { 2934 2935 _.$prevArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 2936 _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 2937 2938 } else if (_.currentSlide >= _.slideCount - _.options.slidesToShow && _.options.centerMode === false) { 2939 2940 _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 2941 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 2942 2943 } else if (_.currentSlide >= _.slideCount - 1 && _.options.centerMode === true) { 2944 2945 _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 2946 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 2947 2948 } 2949 2950 } 2951 2952 }; 2953 2954 Slick.prototype.updateDots = function() { 2955 2956 var _ = this; 2957 2958 if (_.$dots !== null) { 2959 2960 _.$dots 2961 .find('li') 2962 .removeClass('slick-active') 2963 .end(); 2964 2965 _.$dots 2966 .find('li') 2967 .eq(Math.floor(_.currentSlide / _.options.slidesToScroll)) 2968 .addClass('slick-active'); 2969 2970 } 2971 2972 }; 2973 2974 Slick.prototype.visibility = function() { 2975 2976 var _ = this; 2977 2978 if ( _.options.autoplay ) { 2979 2980 if ( document[_.hidden] ) { 2981 2982 _.interrupted = true; 2983 2984 } else { 2985 2986 _.interrupted = false; 2987 2988 } 2989 2990 } 2991 2992 }; 2993 2994 $.fn.slick = function() { 2995 var _ = this, 2996 opt = arguments[0], 2997 args = Array.prototype.slice.call(arguments, 1), 2998 l = _.length, 2999 i, 3000 ret; 3001 for (i = 0; i < l; i++) { 3002 if (typeof opt == 'object' || typeof opt == 'undefined') 3003 _[i].slick = new Slick(_[i], opt); 3004 else 3005 ret = _[i].slick[opt].apply(_[i].slick, args); 3006 if (typeof ret != 'undefined') return ret; 3007 } 3008 return _; 3009 }; 3010 3011})); 3012 3013/*! 3014 * # Semantic UI 2.3.1
vendor: 12,726 bytes, lines 3014-3417
3014 - Sticky 3015 * http://github.com/semantic-org/semantic-ui/ 3016 * 3017 * 3018 * Released under the MIT license 3019 * http://opensource.org/licenses/MIT 3020 * 3021 */ 3022 3023;(function ($, window, document, undefined) { 3024 3025'use strict'; 3026 3027window = (typeof window != 'undefined' && window.Math == Math) 3028 ? window 3029 : (typeof self != 'undefined' && self.Math == Math) 3030 ? self 3031 : Function('return this')() 3032; 3033 3034$.fn.sticky = function(parameters) { 3035 var 3036 $allModules = $(this), 3037 moduleSelector = $allModules.selector || '', 3038 3039 time = new Date().getTime(), 3040 performance = [], 3041 3042 query = arguments[0], 3043 methodInvoked = (typeof query == 'string'), 3044 queryArguments = [].slice.call(arguments, 1), 3045 returnedValue 3046 ; 3047 3048 $allModules 3049 .each(function() { 3050 var 3051 settings = ( $.isPlainObject(parameters) ) 3052 ? $.extend(true, {}, $.fn.sticky.settings, parameters) 3053 : $.extend({}, $.fn.sticky.settings), 3054 3055 className = settings.className, 3056 namespace = settings.namespace, 3057 error = settings.error, 3058 3059 eventNamespace = '.' + namespace, 3060 moduleNamespace = 'module-' + namespace, 3061 3062 $module = $(this), 3063 $window = $(window), 3064 $scroll = $(settings.scrollContext), 3065 $container, 3066 $context, 3067 3068 selector = $module.selector || '', 3069 instance = $module.data(moduleNamespace), 3070 3071 requestAnimationFrame = window.requestAnimationFrame 3072 || window.mozRequestAnimationFrame 3073 || window.webkitRequestAnimationFrame 3074 || window.msRequestAnimationFrame 3075 || function(callback) { setTimeout(callback, 0); }, 3076 3077 element = this, 3078 3079 documentObserver, 3080 observer, 3081 module 3082 ; 3083 3084 module = { 3085 3086 initialize: function() { 3087 3088 module.determineContainer(); 3089 module.determineContext(); 3090 module.verbose('Initializing sticky', settings, $container); 3091 3092 module.save.positions(); 3093 module.checkErrors(); 3094 module.bind.events(); 3095 3096 if(settings.observeChanges) { 3097 module.observeChanges(); 3098 } 3099 module.instantiate(); 3100 }, 3101 3102 instantiate: function() { 3103 module.verbose('Storing instance of module', module); 3104 instance = module; 3105 $module 3106 .data(moduleNamespace, module) 3107 ; 3108 }, 3109 3110 destroy: function() { 3111 module.verbose('Destroying previous instance'); 3112 module.reset(); 3113 if(documentObserver) { 3114 documentObserver.disconnect(); 3115 } 3116 if(observer) { 3117 observer.disconnect(); 3118 } 3119 $window 3120 .off('load' + eventNamespace, module.event.load) 3121 .off('resize' + eventNamespace, module.event.resize) 3122 ; 3123 $scroll 3124 .off('scrollchange' + eventNamespace, module.event.scrollchange) 3125 ; 3126 $module.removeData(moduleNamespace); 3127 }, 3128 3129 observeChanges: function() { 3130 if('MutationObserver' in window) { 3131 documentObserver = new MutationObserver(module.event.documentChanged); 3132 observer = new MutationObserver(module.event.changed); 3133 documentObserver.observe(document, { 3134 childList : true, 3135 subtree : true 3136 }); 3137 observer.observe(element, { 3138 childList : true, 3139 subtree : true 3140 }); 3141 observer.observe($context[0], { 3142 childList : true, 3143 subtree : true 3144 }); 3145 module.debug('Setting up mutation observer', observer); 3146 } 3147 }, 3148 3149 determineContainer: function() { 3150 if(settings.container) { 3151 $container = $(settings.container); 3152 } 3153 else { 3154 $container = $module.offsetParent(); 3155 } 3156 }, 3157 3158 determineContext: function() { 3159 if(settings.context) { 3160 $context = $(settings.context); 3161 } 3162 else { 3163 $context = $container; 3164 } 3165 if($context.length === 0) { 3166 module.error(error.invalidContext, settings.context, $module); 3167 return; 3168 } 3169 }, 3170 3171 checkErrors: function() { 3172 if( module.is.hidden() ) { 3173 module.error(error.visible, $module); 3174 } 3175 if(module.cache.element.height > module.cache.context.height) { 3176 module.reset(); 3177 module.error(error.elementSize, $module); 3178 return; 3179 } 3180 }, 3181 3182 bind: { 3183 events: function() { 3184 $window 3185 .on('load' + eventNamespace, module.event.load) 3186 .on('resize' + eventNamespace, module.event.resize) 3187 ; 3188 // pub/sub pattern 3189 $scroll 3190 .off('scroll' + eventNamespace) 3191 .on('scroll' + eventNamespace, module.event.scroll) 3192 .on('scrollchange' + eventNamespace, module.event.scrollchange) 3193 ; 3194 } 3195 }, 3196 3197 event: { 3198 changed: function(mutations) { 3199 clearTimeout(module.timer); 3200 module.timer = setTimeout(function() { 3201 module.verbose('DOM tree modified, updating sticky menu', mutations); 3202 module.refresh(); 3203 }, 100); 3204 }, 3205 documentChanged: function(mutations) { 3206 [].forEach.call(mutations, function(mutation) { 3207 if(mutation.removedNodes) { 3208 [].forEach.call(mutation.removedNodes, function(node) { 3209 if(node == element || $(node).find(element).length > 0) { 3210 module.debug('Element removed from DOM, tearing down events'); 3211 module.destroy(); 3212 } 3213 }); 3214 } 3215 }); 3216 }, 3217 load: function() { 3218 module.verbose('Page contents finished loading'); 3219 requestAnimationFrame(module.refresh); 3220 }, 3221 resize: function() { 3222 module.verbose('Window resized'); 3223 requestAnimationFrame(module.refresh); 3224 }, 3225 scroll: function() { 3226 requestAnimationFrame(function() { 3227 $scroll.triggerHandler('scrollchange' + eventNamespace, $scroll.scrollTop() ); 3228 }); 3229 }, 3230 scrollchange: function(event, scrollPosition) { 3231 module.stick(scrollPosition); 3232 settings.onScroll.call(element); 3233 } 3234 }, 3235 3236 refresh: function(hardRefresh) { 3237 module.reset(); 3238 if(!settings.context) { 3239 module.determineContext(); 3240 } 3241 if(hardRefresh) { 3242 module.determineContainer(); 3243 } 3244 module.save.positions(); 3245 module.stick(); 3246 settings.onReposition.call(element); 3247 }, 3248 3249 supports: { 3250 sticky: function() { 3251 var 3252 $element = $('<div/>'), 3253 element = $element[0] 3254 ; 3255 $element.addClass(className.supported); 3256 return($element.css('position').match('sticky')); 3257 } 3258 }, 3259 3260 save: { 3261 lastScroll: function(scroll) { 3262 module.lastScroll = scroll; 3263 }, 3264 elementScroll: function(scroll) { 3265 module.elementScroll = scroll; 3266 }, 3267 positions: function() { 3268 var 3269 scrollContext = { 3270 height : $scroll.height() 3271 }, 3272 element = { 3273 margin: { 3274 top : parseInt($module.css('margin-top'), 10), 3275 bottom : parseInt($module.css('margin-bottom'), 10), 3276 }, 3277 offset : $module.offset(), 3278 width : $module.outerWidth(), 3279 height : $module.outerHeight() 3280 }, 3281 context = { 3282 offset : $context.offset(), 3283 height : $context.outerHeight() 3284 }, 3285 container = { 3286 height: $container.outerHeight() 3287 } 3288 ; 3289 if( !module.is.standardScroll() ) { 3290 module.debug('Non-standard scroll. Removing scroll offset from element offset'); 3291 3292 scrollContext.top = $scroll.scrollTop(); 3293 scrollContext.left = $scroll.scrollLeft(); 3294 3295 element.offset.top += scrollContext.top; 3296 context.offset.top += scrollContext.top; 3297 element.offset.left += scrollContext.left; 3298 context.offset.left += scrollContext.left; 3299 } 3300 module.cache = { 3301 fits : ( (element.height + settings.offset) <= scrollContext.height), 3302 sameHeight : (element.height == context.height), 3303 scrollContext : { 3304 height : scrollContext.height 3305 }, 3306 element: { 3307 margin : element.margin, 3308 top : element.offset.top - element.margin.top, 3309 left : element.offset.left, 3310 width : element.width, 3311 height : element.height, 3312 bottom : element.offset.top + element.height 3313 }, 3314 context: { 3315 top : context.offset.top, 3316 height : context.height, 3317 bottom : context.offset.top + context.height 3318 } 3319 }; 3320 module.set.containerSize(); 3321 3322 module.stick(); 3323 module.debug('Caching element positions', module.cache); 3324 } 3325 }, 3326 3327 get: { 3328 direction: function(scroll) { 3329 var 3330 direction = 'down' 3331 ; 3332 scroll = scroll || $scroll.scrollTop(); 3333 if(module.lastScroll !== undefined) { 3334 if(module.lastScroll < scroll) { 3335 direction = 'down'; 3336 } 3337 else if(module.lastScroll > scroll) { 3338 direction = 'up'; 3339 } 3340 } 3341 return direction; 3342 }, 3343 scrollChange: function(scroll) { 3344 scroll = scroll || $scroll.scrollTop(); 3345 return (module.lastScroll) 3346 ? (scroll - module.lastScroll) 3347 : 0 3348 ; 3349 }, 3350 currentElementScroll: function() { 3351 if(module.elementScroll) { 3352 return module.elementScroll; 3353 } 3354 return ( module.is.top() ) 3355 ? Math.abs(parseInt($module.css('top'), 10)) || 0 3356 : Math.abs(parseInt($module.css('bottom'), 10)) || 0 3357 ; 3358 }, 3359 3360 elementScroll: function(scroll) { 3361 scroll = scroll || $scroll.scrollTop(); 3362 var 3363 element = module.cache.element, 3364 scrollContext = module.cache.scrollContext, 3365 delta = module.get.scrollChange(scroll), 3366 maxScroll = (element.height - scrollContext.height + settings.offset), 3367 elementScroll = module.get.currentElementScroll(), 3368 possibleScroll = (elementScroll + delta) 3369 ; 3370 if(module.cache.fits || possibleScroll < 0) { 3371 elementScroll = 0; 3372 } 3373 else if(possibleScroll > maxScroll ) { 3374 elementScroll = maxScroll; 3375 } 3376 else { 3377 elementScroll = possibleScroll; 3378 } 3379 return elementScroll; 3380 } 3381 }, 3382 3383 remove: { 3384 lastScroll: function() { 3385 delete module.lastScroll; 3386 }, 3387 elementScroll: function(scroll) { 3388 delete module.elementScroll; 3389 }, 3390 minimumSize: function() { 3391 $container 3392 .css('min-height', '') 3393 ; 3394 }, 3395 offset: function() { 3396 $module.css('margin-top', ''); 3397 } 3398 }, 3399 3400 set: { 3401 offset: function() { 3402 module.verbose('Setting offset on element', settings.offset); 3403 $module 3404 .css('margin-top', settings.offset) 3405 ; 3406 }, 3407 containerSize: function() { 3408 var 3409 tagName = $container.get(0).tagName 3410 ; 3411 if(tagName === 'HTML' || tagName == 'body') { 3412 // this can trigger for too many reasons 3413 //module.error(error.container, tagName, $module); 3414 module.determineContainer(); 3415 } 3416 else { 3417
vendor: 6,838 bytes, lines 3417-3602
3417if( Math.abs($container.outerHeight() - module.cache.context.height) > settings.jitter) { 3418 module.debug('Context has padding, specifying exact height for container', module.cache.context.height); 3419 $container.css({ 3420 height: module.cache.context.height 3421 }); 3422 } 3423 } 3424 }, 3425 minimumSize: function() { 3426 var 3427 element = module.cache.element 3428 ; 3429 $container 3430 .css('min-height', element.height) 3431 ; 3432 }, 3433 scroll: function(scroll) { 3434 module.debug('Setting scroll on element', scroll); 3435 if(module.elementScroll == scroll) { 3436 return; 3437 } 3438 if( module.is.top() ) { 3439 $module 3440 .css('bottom', '') 3441 .css('top', -scroll) 3442 ; 3443 } 3444 if( module.is.bottom() ) { 3445 $module 3446 .css('top', '') 3447 .css('bottom', scroll) 3448 ; 3449 } 3450 }, 3451 size: function() { 3452 if(module.cache.element.height !== 0 && module.cache.element.width !== 0) { 3453 element.style.setProperty('width', module.cache.element.width + 'px', 'important'); 3454 element.style.setProperty('height', module.cache.element.height + 'px', 'important'); 3455 } 3456 } 3457 }, 3458 3459 is: { 3460 standardScroll: function() { 3461 return ($scroll[0] == window); 3462 }, 3463 top: function() { 3464 return $module.hasClass(className.top); 3465 }, 3466 bottom: function() { 3467 return $module.hasClass(className.bottom); 3468 }, 3469 initialPosition: function() { 3470 return (!module.is.fixed() && !module.is.bound()); 3471 }, 3472 hidden: function() { 3473 return (!$module.is(':visible')); 3474 }, 3475 bound: function() { 3476 return $module.hasClass(className.bound); 3477 }, 3478 fixed: function() { 3479 return $module.hasClass(className.fixed); 3480 } 3481 }, 3482 3483 stick: function(scroll) { 3484 var 3485 cachedPosition = scroll || $scroll.scrollTop(), 3486 cache = module.cache, 3487 fits = cache.fits, 3488 sameHeight = cache.sameHeight, 3489 element = cache.element, 3490 scrollContext = cache.scrollContext, 3491 context = cache.context, 3492 offset = (module.is.bottom() && settings.pushing) 3493 ? settings.bottomOffset 3494 : settings.offset, 3495 scroll = { 3496 top : cachedPosition + offset, 3497 bottom : cachedPosition + offset + scrollContext.height 3498 }, 3499 direction = module.get.direction(scroll.top), 3500 elementScroll = (fits) 3501 ? 0 3502 : module.get.elementScroll(scroll.top), 3503 3504 // shorthand 3505 doesntFit = !fits, 3506 elementVisible = (element.height !== 0) 3507 ; 3508 if(elementVisible && !sameHeight) { 3509 3510 if( module.is.initialPosition() ) { 3511 if(scroll.top >= context.bottom) { 3512 module.debug('Initial element position is bottom of container'); 3513 module.bindBottom(); 3514 } 3515 else if(scroll.top > element.top) { 3516 if( (element.height + scroll.top - elementScroll) >= context.bottom ) { 3517 module.debug('Initial element position is bottom of container'); 3518 module.bindBottom(); 3519 } 3520 else { 3521 module.debug('Initial element position is fixed'); 3522 module.fixTop(); 3523 } 3524 } 3525 3526 } 3527 else if( module.is.fixed() ) { 3528 3529 // currently fixed top 3530 if( module.is.top() ) { 3531 if( scroll.top <= element.top ) { 3532 module.debug('Fixed element reached top of container'); 3533 module.setInitialPosition(); 3534 } 3535 else if( (element.height + scroll.top - elementScroll) >= context.bottom ) { 3536 module.debug('Fixed element reached bottom of container'); 3537 module.bindBottom(); 3538 } 3539 // scroll element if larger than screen 3540 else if(doesntFit) { 3541 module.set.scroll(elementScroll); 3542 module.save.lastScroll(scroll.top); 3543 module.save.elementScroll(elementScroll); 3544 } 3545 } 3546 3547 // currently fixed bottom 3548 else if(module.is.bottom() ) { 3549 3550 // top edge 3551 if( (scroll.bottom - element.height) <= element.top) { 3552 module.debug('Bottom fixed rail has reached top of container'); 3553 module.setInitialPosition(); 3554 } 3555 // bottom edge 3556 else if(scroll.bottom >= context.bottom) { 3557 module.debug('Bottom fixed rail has reached bottom of container'); 3558 module.bindBottom(); 3559 } 3560 // scroll element if larger than screen 3561 else if(doesntFit) { 3562 module.set.scroll(elementScroll); 3563 module.save.lastScroll(scroll.top); 3564 module.save.elementScroll(elementScroll); 3565 } 3566 3567 } 3568 } 3569 else if( module.is.bottom() ) { 3570 if( scroll.top <= element.top ) { 3571 module.debug('Jumped from bottom fixed to top fixed, most likely used home/end button'); 3572 module.setInitialPosition(); 3573 } 3574 else { 3575 if(settings.pushing) { 3576 if(module.is.bound() && scroll.bottom <= context.bottom ) { 3577 module.debug('Fixing bottom attached element to bottom of browser.'); 3578 module.fixBottom(); 3579 } 3580 } 3581 else { 3582 if(module.is.bound() && (scroll.top <= context.bottom - element.height) ) { 3583 module.debug('Fixing bottom attached element to top of browser.'); 3584 module.fixTop(); 3585 } 3586 } 3587 } 3588 } 3589 } 3590 }, 3591 3592 bindTop: function() { 3593 module.debug('Binding element to top of parent container'); 3594 module.remove.offset(); 3595 $module 3596 .css({ 3597 left : '', 3598 top : '', 3599 marginBottom : '' 3600 }) 3601 .removeClass(className.fixed) 3602 .removeClass(className.bottom)
3603 .addClass(className.bound) 3604 .addClass(className.top) 3605 ; 3606 settings.onTop.call(element); 3607 settings.onUnstick.call(element); 3608 }, 3609 bindBottom: function() { 3610 module.debug('Binding element to bottom of parent container'); 3611 module.remove.offset();
vendor: 10,951 bytes, lines 3611-3974
3611 3612 $module 3613 .css({ 3614 left : '', 3615 top : '' 3616 }) 3617 .removeClass(className.fixed) 3618 .removeClass(className.top) 3619 .addClass(className.bound) 3620 .addClass(className.bottom) 3621 ; 3622 settings.onBottom.call(element); 3623 settings.onUnstick.call(element); 3624 }, 3625 3626 setInitialPosition: function() { 3627 module.debug('Returning to initial position'); 3628 module.unfix(); 3629 module.unbind(); 3630 }, 3631 3632 3633 fixTop: function() { 3634 module.debug('Fixing element to top of page'); 3635 if(settings.setSize) { 3636 module.set.size(); 3637 } 3638 module.set.minimumSize(); 3639 module.set.offset(); 3640 $module 3641 .css({ 3642 left : module.cache.element.left, 3643 bottom : '', 3644 marginBottom : '' 3645 }) 3646 .removeClass(className.bound) 3647 .removeClass(className.bottom) 3648 .addClass(className.fixed) 3649 .addClass(className.top) 3650 ; 3651 settings.onStick.call(element); 3652 }, 3653 3654 fixBottom: function() { 3655 module.debug('Sticking element to bottom of page'); 3656 if(settings.setSize) { 3657 module.set.size(); 3658 } 3659 module.set.minimumSize(); 3660 module.set.offset(); 3661 $module 3662 .css({ 3663 left : module.cache.element.left, 3664 bottom : '', 3665 marginBottom : '' 3666 }) 3667 .removeClass(className.bound) 3668 .removeClass(className.top) 3669 .addClass(className.fixed) 3670 .addClass(className.bottom) 3671 ; 3672 settings.onStick.call(element); 3673 }, 3674 3675 unbind: function() { 3676 if( module.is.bound() ) { 3677 module.debug('Removing container bound position on element'); 3678 module.remove.offset(); 3679 $module 3680 .removeClass(className.bound) 3681 .removeClass(className.top) 3682 .removeClass(className.bottom) 3683 ; 3684 } 3685 }, 3686 3687 unfix: function() { 3688 if( module.is.fixed() ) { 3689 module.debug('Removing fixed position on element'); 3690 module.remove.minimumSize(); 3691 module.remove.offset(); 3692 $module 3693 .removeClass(className.fixed) 3694 .removeClass(className.top) 3695 .removeClass(className.bottom) 3696 ; 3697 settings.onUnstick.call(element); 3698 } 3699 }, 3700 3701 reset: function() { 3702 module.debug('Resetting elements position'); 3703 module.unbind(); 3704 module.unfix(); 3705 module.resetCSS(); 3706 module.remove.offset(); 3707 module.remove.lastScroll(); 3708 }, 3709 3710 resetCSS: function() { 3711 $module 3712 .css({ 3713 width : '', 3714 height : '' 3715 }) 3716 ; 3717 $container 3718 .css({ 3719 height: '' 3720 }) 3721 ; 3722 }, 3723 3724 setting: function(name, value) { 3725 if( $.isPlainObject(name) ) { 3726 $.extend(true, settings, name); 3727 } 3728 else if(value !== undefined) { 3729 settings[name] = value; 3730 } 3731 else { 3732 return settings[name]; 3733 } 3734 }, 3735 internal: function(name, value) { 3736 if( $.isPlainObject(name) ) { 3737 $.extend(true, module, name); 3738 } 3739 else if(value !== undefined) { 3740 module[name] = value; 3741 } 3742 else { 3743 return module[name]; 3744 } 3745 }, 3746 debug: function() { 3747 if(!settings.silent && settings.debug) { 3748 if(settings.performance) { 3749 module.performance.log(arguments); 3750 } 3751 else { 3752 module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':'); 3753 module.debug.apply(console, arguments); 3754 } 3755 } 3756 }, 3757 verbose: function() { 3758 if(!settings.silent && settings.verbose && settings.debug) { 3759 if(settings.performance) { 3760 module.performance.log(arguments); 3761 } 3762 else { 3763 module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':'); 3764 module.verbose.apply(console, arguments); 3765 } 3766 } 3767 }, 3768 error: function() { 3769 if(!settings.silent) { 3770 module.error = Function.prototype.bind.call(console.error, console, settings.name + ':'); 3771 module.error.apply(console, arguments); 3772 } 3773 }, 3774 performance: { 3775 log: function(message) { 3776 var 3777 currentTime, 3778 executionTime, 3779 previousTime 3780 ; 3781 if(settings.performance) { 3782 currentTime = new Date().getTime(); 3783 previousTime = time || currentTime; 3784 executionTime = currentTime - previousTime; 3785 time = currentTime; 3786 performance.push({ 3787 'Name' : message[0], 3788 'Arguments' : [].slice.call(message, 1) || '', 3789 'Element' : element, 3790 'Execution Time' : executionTime 3791 }); 3792 } 3793 clearTimeout(module.performance.timer); 3794 module.performance.timer = setTimeout(module.performance.display, 0); 3795 }, 3796 display: function() { 3797 var 3798 title = settings.name + ':', 3799 totalTime = 0 3800 ; 3801 time = false; 3802 clearTimeout(module.performance.timer); 3803 $.each(performance, function(index, data) { 3804 totalTime += data['Execution Time']; 3805 }); 3806 title += ' ' + totalTime + 'ms'; 3807 if(moduleSelector) { 3808 title += ' \'' + moduleSelector + '\''; 3809 } 3810 if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) { 3811 console.groupCollapsed(title); 3812 if(console.table) { 3813 console.table(performance); 3814 } 3815 else { 3816 $.each(performance, function(index, data) { 3817 console.log(data['Name'] + ': ' + data['Execution Time']+'ms'); 3818 }); 3819 } 3820 console.groupEnd(); 3821 } 3822 performance = []; 3823 } 3824 }, 3825 invoke: function(query, passedArguments, context) { 3826 var 3827 object = instance, 3828 maxDepth, 3829 found, 3830 response 3831 ; 3832 passedArguments = passedArguments || queryArguments; 3833 context = element || context; 3834 if(typeof query == 'string' && object !== undefined) { 3835 query = query.split(/[\. ]/); 3836 maxDepth = query.length - 1; 3837 $.each(query, function(depth, value) { 3838 var camelCaseValue = (depth != maxDepth) 3839 ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1) 3840 : query 3841 ; 3842 if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) { 3843 object = object[camelCaseValue]; 3844 } 3845 else if( object[camelCaseValue] !== undefined ) { 3846 found = object[camelCaseValue]; 3847 return false; 3848 } 3849 else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) { 3850 object = object[value]; 3851 } 3852 else if( object[value] !== undefined ) { 3853 found = object[value]; 3854 return false; 3855 } 3856 else { 3857 return false; 3858 } 3859 }); 3860 } 3861 if ( $.isFunction( found ) ) { 3862 response = found.apply(context, passedArguments); 3863 } 3864 else if(found !== undefined) { 3865 response = found; 3866 } 3867 if($.isArray(returnedValue)) { 3868 returnedValue.push(response); 3869 } 3870 else if(returnedValue !== undefined) { 3871 returnedValue = [returnedValue, response]; 3872 } 3873 else if(response !== undefined) { 3874 returnedValue = response; 3875 } 3876 return found; 3877 } 3878 }; 3879 3880 if(methodInvoked) { 3881 if(instance === undefined) { 3882 module.initialize(); 3883 } 3884 module.invoke(query); 3885 } 3886 else { 3887 if(instance !== undefined) { 3888 instance.invoke('destroy'); 3889 } 3890 module.initialize(); 3891 } 3892 }) 3893 ; 3894 3895 return (returnedValue !== undefined) 3896 ? returnedValue 3897 : this 3898 ; 3899}; 3900 3901$.fn.sticky.settings = { 3902 3903 name : 'Sticky', 3904 namespace : 'sticky', 3905 3906 silent : false, 3907 debug : false, 3908 verbose : true, 3909 performance : true, 3910 3911 // whether to stick in the opposite direction on scroll up 3912 pushing : false, 3913 3914 context : false, 3915 container : false, 3916 3917 // Context to watch scroll events 3918 scrollContext : window, 3919 3920 // Offset to adjust scroll 3921 offset : 0, 3922 3923 // Offset to adjust scroll when attached to bottom of screen 3924 bottomOffset : 0, 3925 3926 // will only set container height if difference between context and container is larger than this number 3927 jitter : 5, 3928 3929 // set width of sticky element when it is fixed to page (used to make sure 100% width is maintained if no fixed size set) 3930 setSize : true, 3931 3932 // Whether to automatically observe changes with Mutation Observers 3933 observeChanges : false, 3934 3935 // Called when position is recalculated 3936 onReposition : function(){}, 3937 3938 // Called on each scroll 3939 onScroll : function(){}, 3940 3941 // Called when element is stuck to viewport 3942 onStick : function(){}, 3943 3944 // Called when element is unstuck from viewport 3945 onUnstick : function(){}, 3946 3947 // Called when element reaches top of context 3948 onTop : function(){}, 3949 3950 // Called when element reaches bottom of context 3951 onBottom : function(){}, 3952 3953 error : { 3954 container : 'Sticky element must be inside a relative container', 3955 visible : 'Element is hidden, you must call refresh after element becomes visible. Use silent setting to surpress this warning in production.', 3956 method : 'The method you called is not defined.', 3957 invalidContext : 'Context specified does not exist', 3958 elementSize : 'Sticky element is larger than its container, cannot create sticky.' 3959 }, 3960 3961 className : { 3962 bound : 'bound', 3963 fixed : 'fixed', 3964 supported : 'native', 3965 top : 'top', 3966 bottom : 'bottom' 3967 } 3968 3969}; 3970 3971})( jQuery, window, document ); 3972 3973/*! 3974 *
3974JavaScript Cookie v2.2.0 3975 * https://github.com/js-cookie/js-cookie 3976 * 3977 * Copyright 2006, 2015 Klaus Hartl & Fagner Brack 3978 * Released under the MIT license 3979 */ 3980;(function (factory) { 3981 var registeredInModuleLoader; 3982 if (typeof define === 'function' && define.amd) { 3983 define(factory); 3984 registeredInModuleLoader = true; 3985 } 3986 if (typeof exports === 'object') { 3987 module.exports = factory(); 3988 registeredInModuleLoader = true; 3989 } 3990 if (!registeredInModuleLoader) { 3991 var OldCookies = window.Cookies; 3992 var api = window.Cookies = factory(); 3993 api.noConflict = function () { 3994 window.Cookies = OldCookies; 3995 return api; 3996 }; 3997 } 3998}(function () { 3999 function extend () { 4000 var i = 0; 4001 var result = {}; 4002 for (; i < arguments.length; i++) { 4003 var attributes = arguments[ i ]; 4004 for (var key in attributes) { 4005 result[key] = attributes[key]; 4006 } 4007 } 4008 return result; 4009 } 4010 4011 function decode (s) { 4012 return s.replace(/(%[0-9A-Z]{2})+/g, decodeURIComponent); 4013 } 4014 4015 function init (converter) { 4016 function api() {} 4017 4018 function set (key, value, attributes) { 4019 if (typeof document === 'undefined') { 4020 return; 4021 } 4022 4023 attributes = extend({ 4024 path: '/' 4025 }, api.defaults, attributes); 4026 4027 if (typeof attributes.expires === 'number') { 4028 attributes.expires = new Date(new Date() * 1 + attributes.expires * 864e+5); 4029 } 4030 4031 // We're using "expires" because "max-age" is not supported by IE 4032 attributes.expires = attributes.expires ? attributes.expires.toUTCString() : ''; 4033 4034 try { 4035 var result = JSON.stringify(value); 4036 if (/^[\{\[]/.test(result)) { 4037 value = result; 4038 } 4039 } catch (e) {} 4040 4041 value = converter.write ? 4042 converter.write(value, key) : 4043 encodeURIComponent(String(value)) 4044 .replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g, decodeURIComponent); 4045 4046 key = encodeURIComponent(String(key)) 4047 .replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent) 4048 .replace(/[\(\)]/g, escape); 4049 4050 var stringifiedAttributes = ''; 4051 for (var attributeName in attributes) { 4052 if (!attributes[attributeName]) { 4053 continue; 4054 } 4055 stringifiedAttributes += '; ' + attributeName; 4056 if (attributes[attributeName] === true) { 4057 continue; 4058 } 4059 4060 // Considers RFC 6265 section 5.2: 4061 // ... 4062 // 3. If the remaining unparsed-attributes contains a %x3B (";") 4063 // character: 4064 // Consume the characters of the unparsed-attributes up to, 4065 // not including, the first %x3B (";") character. 4066 // ... 4067 stringifiedAttributes += '=' + attributes[attributeName].split(';')[0]; 4068 } 4069 4070 return (document.cookie = key + '=' + value + stringifiedAttributes); 4071 } 4072 4073 function get (key, json) { 4074 if (typeof document === 'undefined') { 4075 return; 4076 } 4077 4078 var jar = {}; 4079 // To prevent the for loop in the first place assign an empty array 4080 // in case there are no cookies at all. 4081 var cookies = document.cookie ? document.cookie.split('; ') : []; 4082 var i = 0; 4083 4084 for (; i < cookies.length; i++) { 4085 var parts = cookies[i].split('='); 4086 var cookie = parts.slice(1).join('='); 4087 4088 if (!json && cookie.charAt(0) === '"') { 4089 cookie = cookie.slice(1, -1); 4090 } 4091 4092 try { 4093 var name = decode(parts[0]); 4094 cookie = (converter.read || converter)(cookie, name) || 4095 decode(cookie); 4096 4097 if (json) { 4098 try { 4099 cookie = JSON.parse(cookie); 4100 } catch (e) {} 4101 } 4102 4103 jar[name] = cookie; 4104 4105 if (key === name) { 4106 break; 4107 } 4108 } catch (e) {} 4109 } 4110 4111 return key ? jar[key] : jar; 4112 } 4113 4114 api.set = set; 4115 api.get = function (key) { 4116 return get(key, false /* read as raw */); 4117 }; 4118 api.getJSON = function (key) { 4119 return get(key, true /* read as json */); 4120 }; 4121 api.remove = function (key, attributes) { 4122 set(key, '', extend(attributes, { 4123 expires: -1 4124 })); 4125 }; 4126 4127 api.defaults = {}; 4128 4129 api.withConverter = init; 4130 4131 return api; 4132 } 4133 4134 return init(function () {}); 4135})); 4136 4137(function(){ 4138 4139 if($('.hamburger').length){ 4140 4141 var $drawer = $('.drawer'); 4142 var tl_drawer = new TimelineLite(); 4143 4144 function hide_drawer(){ 4145 tl_drawer.to($drawer, 0.3, {'left': '-100%', ease:Cubic.easeInOut}) 4146 .to($drawer, 0, {'display':'none'}); 4147 $('.hamburger').removeClass('is-active');
4148 $('body').removeClass('drawer--open'); 4149 } 4150 4151 $('.hamburger').click(function(){ 4152 4153 $(this).toggleClass('is-active'); 4154 4155 $('body').toggleClass('drawer--open'); 4156 4157 if ($('.drawer').length) 4158 { 4159 4160 if ($(this).hasClass('is-active')) 4161 { 4162 tl_drawer.to($drawer, 0, {'display':'block'}) 4163 .to($drawer, 0.3, {'left': '0px', ease:Cubic.easeInOut}); 4164 } 4165 else 4166 { 4167 tl_drawer.to($drawer, 0.3, {'left': '-100%', ease:Cubic.easeInOut}) 4168 .to($drawer, 0, {'display':'none'}); 4169 } 4170 } 4171 4172 $('li.menu-item-has-children > a').each(function(){ 4173 var $span = $('<span><i class="fas fa-chevron-down"></i></span>'); 4174 $span.addClass('menu-item-toggle'); 4175 $(this).append($span); 4176 4177 $span.click(function(e){ 4178 e.preventDefault(); 4179 // e.stopPropagation(); 4180 4181 var $menu = $(this).closest('li').find('.sub-menu'); 4182 4183 $(this).toggleClass('is-active'); 4184 4185 if ($(this).hasClass('is-active')) 4186 { 4187 var tl_menu = new TimelineLite(); 4188 tl_menu.to($menu, 0, {'display':'block'}) 4189 .from($menu, 0.4, {'height':'0px', ease:Cubic.easeInOut}); 4190 } 4191 else 4192 { 4193 var tl_menu = new TimelineLite(); 4194 tl_menu.to($menu, 0.4, {'height':'0px', ease:Cubic.easeInOut}) 4195 .to($menu, 0, {'display':'none'}) 4196 .to($menu, 0, {'height':'auto'}); 4197 } 4198 }); 4199 4200 }); 4201 4202 $('li.menu-item-has-children a').click(function(){ 4203 4204 }); 4205 4206 }); 4207 4208 $('.drawer__tint').click(function(){ 4209 hide_drawer(); 4210 }); 4211 4212 $(window).resize(function(){ 4213 4214 if ($('body').hasClass('drawer--open')) 4215 { 4216 hide_drawer(); 4217 } 4218 4219 }); 4220 } 4221 4222})(); 4223 4224(function(){ 4225 4226 //Smooth scroll to ID target 4227 if ($('a[href^="#"]').length) 4228 { 4229 document.querySelectorAll('a[href^="#"]').forEach(anchor => { 4230 anchor.addEventListener('click', function (e) { 4231 e.preventDefault(); 4232 4233 if (this.getAttribute('href') == '#') 4234 { 4235 return false; 4236 } 4237 4238 document.querySelector(this.getAttribute('href')).scrollIntoView({ 4239 behavior: 'smooth' 4240 }); 4241 4242 }); 4243 }); 4244 } 4245 4246 /** 4247 * SLIDER 4248 */ 4249 function calcSliderHeight(){ 4250 4251 var window_height = $(window).height(), 4252 diff = 0; 4253 4254 if (window_height < 768){ 4255 window_height = 768; 4256 } 4257 4258 if ($('body.logged-in').length){ 4259 diff = diff + 32; 4260 } 4261 4262 // diff = diff + $('header').outerHeight(true); 4263 diff = diff + 193; 4264 4265 if ($('.header__mobile:visible').length) 4266 { 4267 $('.slide, .slick__slider').height(450); 4268 } 4269 else 4270 { 4271 $('.slide, .slick__slider').height(window_height - diff); 4272 } 4273 4274 } 4275 4276 $(window).resize(function(){ 4277 4278 if ($('.slick__slider').length){ 4279 calcSliderHeight(); 4280 } 4281 4282 }); 4283 4284 $('.slick__slider').each(function(){ 4285 4286 $(this).on('init',function(event, slick){ 4287 calcSliderHeight(); 4288 }); 4289 4290 $(this).each(function(){ 4291 4292 var slick_args = {}, 4293 $slick = $(this); 4294 4295 slick_args['arrows'] = false; 4296 // slick_args['dots'] = $(this).data('pager'); 4297 slick_args['autoplay'] = $(this).data('autoplay'); 4298 slick_args['autoplaySpeed'] = $(this).data('interval'); 4299 slick_args['speed'] = $(this).data('transition-speed'); 4300 slick_args['fade'] = $(this).data('transition-type'); 4301 slick_args['infinite'] = $(this).data('infinite'); 4302 // slick_args['pauseOnHover'] = false;
4303 4304 $(this).slick(slick_args); 4305 4306 $(this).find('.slide__play').click(function(){ 4307 $(this).closest('.slick__slider').addClass('autoplay-disabled'); 4308 4309 if ($(this).closest('.slick__slider').hasClass('autoplay-disabled')) 4310 { 4311 $(this).closest('.slick__slider').slick('slickNext').slick('slickPlay'); 4312 } 4313 4314 }); 4315 4316 $(this).find('.slide__pause').click(function(){ 4317 $(this).closest('.slick__slider').removeClass('autoplay-disabled'); 4318 4319 if (!$(this).closest('.slick__slider').hasClass('autoplay-disabled')) 4320 { 4321 $(this).closest('.slick__slider').slick('slickPause'); 4322 } 4323 4324 }); 4325 4326 $(this).find('.slide__slider-pagination-nav-right').click(function(){ 4327 $(this).closest('.slick__slider').slick('slickNext'); 4328 }); 4329 4330 $(this).find('.slide__slider-pagination-nav-left').click(function(){ 4331 $(this).closest('.slick__slider').slick('slickPrev'); 4332 }); 4333 4334 }); 4335 4336 }); 4337 4338 4339 //fontsize controls 4340 if ($('.font-navigation').length) 4341 { 4342 //Font size Controls 4343 var fontsize_settings = { 4344 // 'default_weight' : 10, 4345 'increment_rate' : 10, 4346 'class_prefix' : 'font-size__', 4347 'current_weight' : 10, 4348 'min_weight' : 10, 4349 'max_weight' : 50 4350 }; 4351 4352 function startUp(){ 4353 if(Cookies.get('current_weight')) 4354 { 4355 fontsize_settings.current_weight = parseInt(Cookies.get('current_weight')); 4356 } 4357 4358 } 4359 4360 function initSticky(){ 4361 4362 $('.ui.sticky').sticky({ 4363 'offset': 50 4364 }); 4365 4366 $('html').addClass(fontsize_settings.class_prefix + fontsize_settings.current_weight); 4367 } 4368 4369 function destroySticky(){ 4370 $('.ui.sticky').sticky('destory'); 4371 } 4372 4373 function setButtonState(){ 4374 $('.font-navigation__button').removeClass('is-disabled'); 4375 if (fontsize_settings.max_weight == fontsize_settings.current_weight){ 4376 $('.font-navigation__button[data-font-direction="1"]').addClass('is-disabled'); 4377 } 4378 4379 if (fontsize_settings.min_weight == fontsize_settings.current_weight){ 4380 $('.font-navigation__button[data-font-direction="-1"]').addClass('is-disabled'); 4381 } 4382 } 4383 4384 startUp(); 4385 initSticky(); 4386 setButtonState(); 4387 4388 $('.font-navigation__button').click(function(){ 4389 console.log('clicl'); 4390 4391 temp_new_weight = 0; 4392 4393 if ($(this).data('font-direction') == '1') 4394 { 4395 temp_new_weight = fontsize_settings.current_weight + fontsize_settings.increment_rate; 4396 } 4397 else 4398 { 4399 temp_new_weight = fontsize_settings.current_weight - fontsize_settings.increment_rate; 4400 } 4401 4402 if (temp_new_weight < fontsize_settings.min_weight || temp_new_weight > fontsize_settings.max_weight){ 4403 return; 4404 } 4405 4406 4407 Cookies.set('current_weight', temp_new_weight); 4408 4409 fontsize_settings.current_weight = temp_new_weight; 4410 4411 setButtonState(); 4412 4413 $('html').removeClass(function (index, className) { 4414 return (className.match (/(^|\s)font-size__\S+/g) || []).join(' '); 4415 }); 4416 4417 $('html').addClass(fontsize_settings.class_prefix + fontsize_settings.current_weight); 4418 4419 destroySticky(); 4420 initSticky(); 4421 }); 4422 4423 } 4424 4425 //Auto hider 4426 if ($('header').length) 4427 { 4428 var prevScrollpos = window.pageYOffset; 4429 window.onscroll = function() { 4430 var currentScrollPos = window.pageYOffset; 4431 4432 if(currentScrollPos < 190) 4433 { 4434 $('body').removeClass('scrolled'); 4435 $('body').removeClass('hide'); 4436 } 4437 else if (prevScrollpos > currentScrollPos) { 4438 $('body').removeClass('hide'); 4439 $('body').addClass('scrolled'); 4440 } 4441 else 4442 { 4443 $('body').removeClass('scrolled'); 4444 $('body').addClass('hide'); 4445 } 4446 prevScrollpos = currentScrollPos; 4447 } 4448 } 4449 4450 if ($('.header__search-magnify').length){ 4451 $('.header__search-magnify, .header__search-close').click(function(){ 4452 $('.header__search').toggleClass('is-expanded'); 4453 $('body').toggleClass('search-expanded'); 4454 4455 $('.header__search-text').focus(); 4456 }); 4457 } 4458 4459 if ($('.footer__search').length){ 4460 $('.footer__search').click(function(){ 4461 $('body').removeClass('hide'); 4462 $('body').addClass('scrolled'); 4463 $('.header__search').addClass('is-expanded'); 4464 $('body').addClass('search-expanded'); 4465 $('.header__search-text').focus(); 4466 }); 4467 } 4468 4469 if ($('.card__link').length) 4470 { 4471 $('.card__link:not([href])').click(function(){ 4472 $(this).toggleClass('is-active'); 4473 4474 var tl_toggle = new TimelineLite(); 4475 var $content_preview = $(this).find('.card__big-font'); 4476 var $content = $(this).find('.card__content'); 4477 4478 if ($(this).hasClass('is-active')) 4479 { 4480 TweenLite.to($content_preview,.5,{minHeight:0,height:0,opacity:0,display:'none'}) 4481 TweenLite.set($content,{height:'auto',opacity:1,display:'block'}); 4482 TweenLite.from($content,.5,{minHeight:0,opacity:0,height:0}); 4483 } 4484 else 4485 { 4486 TweenLite.set($content_preview,{height:'auto',opacity:1,display:'block'}); 4487 TweenLite.from($content_preview,.5,{minHeight:0,opacity:0,height:0}); 4488 TweenLite.to($content,.5,{minHeight:0,height:0,opacity:0,display:'none'}) 4489 } 4490 }); 4491 } 4492 4493 // GOOGLE MAP 4494 function initMap(){ 4495 4496 if (!$("#map").length) 4497 { 4498 return false;
4499 } 4500 4501 var lat_coordinate = $("#map").data('lat'), 4502 lng_coordinate = $("#map").data('lng'), 4503 link = $("#map").data('link'), 4504 marker = $("#map").data('marker'); 4505 4506 var latlng = {lat: lat_coordinate, lng: lng_coordinate}; 4507 var map = new google.maps.Map(document.getElementById('map'), { 4508 zoom: 16, 4509 center: latlng 4510 }); 4511 4512 var marker = new google.maps.Marker({ 4513 position: latlng, 4514 map: map, 4515 icon: { 4516 url: marker, 4517 anchor: new google.maps.Point(0,70), //marker offset 4518 scaledSize: new google.maps.Size(143, 73.5) 4519 } 4520 }); 4521 4522 if (link) 4523 { 4524 marker.addListener('click', function() { 4525 window.open(link, '_blank'); 4526 }); 4527 } 4528 4529 } 4530 google.maps.event.addDomListener(window, 'load', initMap); 4531 4532 if($('.footer__link-two').length) 4533 { 4534 // function closeBoardLogin(){ 4535 // var $modal = $('.board-login'); 4536 // TweenLite.to($modal,.4,{opacity:0,display:'none'}) 4537 // } 4538 4539 // $('.footer__link-two').click(function(e){ 4540 // e.preventDefault(); 4541 // var $modal = $('.board-login'); 4542 4543 // TweenLite.set($modal,{opacity:1,display:'block'}); 4544 // TweenLite.from($modal,.4,{opacity:0}); 4545 4546 // $('.board-login__input-1').focus(); 4547 4548 // }); 4549 4550 // $('.board-login__close').click(function(){ 4551 // closeBoardLogin(); 4552 // }); 4553 4554 // $('.board-login__tint').click(function(e){ 4555 // closeBoardLogin(); 4556 // }); 4557 4558 // $('#board-login-form').submit(function(e){ 4559 4560 // e.preventDefault(); 4561 4562 // var link = $(this).attr('action'); 4563 // window.open(link, '_blank'); 4564 4565 // return false; 4566 // }); 4567 } 4568 4569 if ($('.blog__slider-featured-posts').length){ 4570 4571 function updateFeaturedArticlePagination(slick,total){ 4572 4573 if ($('.blog__slider-pagination-position').length && $('.blog__slider-pagination-total').length) 4574 { 4575 if ($('.header__mobile:visible').length) 4576 { 4577 $('.blog__slider-pagination-position').html(slick.currentSlide + 1); 4578 $('.blog__slider-pagination-total').html(slick.slideCount); 4579 } 4580 else 4581 { 4582 $('.blog__slider-pagination-position').html(Math.floor((slick.currentSlide + 1) / total) + 1); 4583 $('.blog__slider-pagination-total').html(Math.floor(slick.slideCount / total) + 1); 4584 } 4585 } 4586 } 4587 4588 $('.blog__slider-featured-posts').each(function(){ 4589 4590 $(this).on('init',function(event, slick){ 4591 4592 updateFeaturedArticlePagination(slick,3); 4593 TweenLite.to($(this),.5,{opacity:1,display:'block'}); 4594 }); 4595 4596 $(this).on('afterChange',function(event, slick, currentSlide, nextSlide){ 4597 4598 updateFeaturedArticlePagination(slick,3); 4599 4600 }); 4601 4602 $(this).each(function(){ 4603 4604 var slick_args = {}; 4605 4606 slick_args['arrows'] = false; 4607 slick_args['dots'] = $(this).data('pager'); 4608 slick_args['autoplay'] = $(this).data('autoplay'); 4609 slick_args['autoplaySpeed'] = $(this).data('interval'); 4610 slick_args['speed'] = $(this).data('transition-speed'); 4611 slick_args['fade'] = $(this).data('transition-type'); 4612 slick_args['infinite'] = $(this).data('infinite'); 4613 slick_args['slidesToShow'] = 3; 4614 slick_args['slidesToScroll'] = 3; 4615 slick_args['responsive'] = [ 4616 { 4617 breakpoint: 992, 4618 settings: { 4619 arrows: false, 4620 centerMode: true, 4621 // centerPadding: '40px', 4622 slidesToShow: 1 4623 } 4624 } 4625 ]; 4626 4627 $(this).slick(slick_args); 4628 4629 }); 4630 4631 $('.blog__slider-pagination-nav-left').click(function(){ 4632 $(this).parent().next().slick('slickPrev'); 4633 }); 4634 4635 $('.blog__slider-pagination-nav-right').click(function(){ 4636 $(this).parent().next().slick('slickNext'); 4637 }); 4638 4639 }); 4640 } 4641 4642 //External links 4643 if ($('a').length) 4644 { 4645 $('a[href*="/"]').each(function() { 4646 4647 if ($(this).data('fancybox')){ 4648 return true; 4649 } 4650 4651 var a = new RegExp('/' + window.location.host + '/'),
4652 mailto = new RegExp('/mailto:/'); 4653 4654 if(!a.test(this.href)) { 4655 var span = $('<span></span>'); 4656 span.html('Opens in new window'); 4657 span.addClass('sr-only d-none'); 4658 $(this).prepend(span); 4659 4660 $(this).click(function(event) { 4661 event.preventDefault(); 4662 event.stopPropagation(); 4663 window.open(this.href, '_blank'); 4664 }); 4665 } 4666 }); 4667 } 4668 4669 4670 4671})();
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.