1/* 2 _ _ _ _ 3 ___| (_) ___| | __ (_)___ 4/ __| | |/ __| |/ / | / __| 5\__ \ | | (__| < _ | \__ \ 6|___/_|_|\___|_|\_(_)/ |___/ 7 |__/ 8 9 Version: 1.5.8 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'; 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 type="button" data-role="none" class="slick-prev" aria-label="Previous" tabindex="0" role="button">Previous</button>', 48 nextArrow: '<button type="button" data-role="none" class="slick-next" aria-label="Next" tabindex="0" role="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" data-role="none" role="button" aria-required="false" tabindex="0">' + (i + 1) + '</button>'; 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 infinite: true, 65 initialSlide: 0, 66 lazyLoad: 'ondemand', 67 mobileFirst: false, 68 pauseOnHover: true, 69 pauseOnDotsHover: false, 70 respondTo: 'window', 71 responsive: null, 72 rows: 1, 73 rtl: false, 74 slide: '', 75 slidesPerRow: 1, 76 slidesToShow: 1, 77 slidesToScroll: 1, 78 speed: 500, 79 swipe: true, 80 swipeToSlide: false, 81 touchMove: true, 82 touchThreshold: 5, 83 useCSS: true, 84 variableWidth: false, 85 vertical: false, 86 verticalSwiping: false, 87 waitForAnimate: true, 88 zIndex: 1000 89 }; 90 91 _.initials = { 92 animating: false, 93 dragging: false, 94 autoPlayTimer: null, 95 currentDirection: 0, 96 currentLeft: null, 97 currentSlide: 0, 98 direction: 1, 99 $dots: null, 100 listWidth: null, 101 listHeight: null, 102 loadIndex: 0, 103 $nextArrow: null, 104 $prevArrow: null, 105 slideCount: null, 106 slideWidth: null, 107 $slideTrack: null, 108 $slides: null, 109 sliding: false, 110 slideOffset: 0, 111 swipeLeft: null, 112 $list: null, 113 touchObject: {}, 114 transformsEnabled: false, 115 unslicked: false 116 }; 117 118 $.extend(_, _.initials); 119 120 _.activeBreakpoint = null; 121 _.animType = null; 122 _.animProp = null; 123 _.breakpoints = []; 124 _.breakpointSettings = []; 125 _.cssTransitions = false; 126 _.hidden = 'hidden'; 127 _.paused = false; 128 _.positionProp = null; 129 _.respondTo = null; 130 _.rowCount = 1; 131 _.shouldClick = true; 132 _.$slider = $(element); 133 _.$slidesCache = null; 134 _.transformType = null; 135 _.transitionType = null; 136 _.visibilityChange = 'visibilitychange'; 137 _.windowWidth = 0; 138 _.windowTimer = null; 139 140 dataSettings = $(element).data('slick') || {}; 141
vendor: 5,225 bytes, lines 142-295
142 _.options = $.extend({}, _.defaults, dataSettings, settings); 143 144 _.currentSlide = _.options.initialSlide; 145 146 _.originalSettings = _.options; 147 148 if (typeof document.mozHidden !== 'undefined') { 149 _.hidden = 'mozHidden'; 150 _.visibilityChange = 'mozvisibilitychange'; 151 } else if (typeof document.webkitHidden !== 'undefined') { 152 _.hidden = 'webkitHidden'; 153 _.visibilityChange = 'webkitvisibilitychange'; 154 } 155 156 _.autoPlay = $.proxy(_.autoPlay, _); 157 _.autoPlayClear = $.proxy(_.autoPlayClear, _); 158 _.changeSlide = $.proxy(_.changeSlide, _); 159 _.clickHandler = $.proxy(_.clickHandler, _); 160 _.selectHandler = $.proxy(_.selectHandler, _); 161 _.setPosition = $.proxy(_.setPosition, _); 162 _.swipeHandler = $.proxy(_.swipeHandler, _); 163 _.dragHandler = $.proxy(_.dragHandler, _); 164 _.keyHandler = $.proxy(_.keyHandler, _); 165 _.autoPlayIterator = $.proxy(_.autoPlayIterator, _); 166 167 _.instanceUid = instanceUid++; 168 169 // A simple way to check for HTML strings 170 // Strict HTML recognition (must start with <) 171 // Extracted from jQuery v1.11 source 172 _.htmlExpr = /^(?:\s*(<[\w\W]+>)[^>]*)$/; 173 174 175 _.registerBreakpoints(); 176 _.init(true); 177 _.checkResponsive(true); 178 179 } 180 181 return Slick; 182 183 }()); 184 185 Slick.prototype.addSlide = Slick.prototype.slickAdd = function (markup, index, addBefore) { 186 187 var _ = this; 188 189 if (typeof (index) === 'boolean') { 190 addBefore = index; 191 index = null; 192 } else if (index < 0 || (index >= _.slideCount)) { 193 return false; 194 } 195 196 _.unload(); 197 198 if (typeof (index) === 'number') { 199 if (index === 0 && _.$slides.length === 0) { 200 $(markup).appendTo(_.$slideTrack); 201 } else if (addBefore) { 202 $(markup).insertBefore(_.$slides.eq(index)); 203 } else { 204 $(markup).insertAfter(_.$slides.eq(index)); 205 } 206 } else { 207 if (addBefore === true) { 208 $(markup).prependTo(_.$slideTrack); 209 } else { 210 $(markup).appendTo(_.$slideTrack); 211 } 212 } 213 214 _.$slides = _.$slideTrack.children(this.options.slide); 215 216 _.$slideTrack.children(this.options.slide).detach(); 217 218 _.$slideTrack.append(_.$slides); 219 220 _.$slides.each(function (index, element) { 221 $(element).attr('data-slick-index', index); 222 }); 223 224 _.$slidesCache = _.$slides; 225 226 _.reinit(); 227 228 }; 229 230 Slick.prototype.animateHeight = function () { 231 var _ = this; 232 if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) { 233 var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true); 234 _.$list.animate({ 235 height: targetHeight 236 }, _.options.speed); 237 } 238 }; 239 240 Slick.prototype.animateSlide = function (targetLeft, callback) { 241 242 var animProps = {}, 243 _ = this; 244 245 _.animateHeight(); 246 247 if (_.options.rtl === true && _.options.vertical === false) { 248 targetLeft = -targetLeft; 249 } 250 if (_.transformsEnabled === false) { 251 if (_.options.vertical === false) { 252 _.$slideTrack.animate({ 253 left: targetLeft 254 }, _.options.speed, _.options.easing, callback); 255 } else { 256 _.$slideTrack.animate({ 257 top: targetLeft 258 }, _.options.speed, _.options.easing, callback); 259 } 260 261 } else { 262 263 if (_.cssTransitions === false) { 264 if (_.options.rtl === true) { 265 _.currentLeft = -(_.currentLeft); 266 } 267 $({ 268 animStart: _.currentLeft 269 }).animate({ 270 animStart: targetLeft 271 }, { 272 duration: _.options.speed, 273 easing: _.options.easing, 274 step: function (now) { 275 now = Math.ceil(now); 276 if (_.options.vertical === false) { 277 animProps[_.animType] = 'translate(' + 278 now + 'px, 0px)'; 279 _.$slideTrack.css(animProps); 280 } else { 281 animProps[_.animType] = 'translate(0px,' + 282 now + 'px)'; 283 _.$slideTrack.css(animProps); 284 } 285 }, 286 complete: function () { 287 if (callback) { 288 callback.call(); 289 } 290 } 291 }); 292 293 } else { 294 295 _.applyTransition();
296 targetLeft = Math.ceil(targetLeft); 297 298 if (_.options.vertical === false) { 299 animProps[_.animType] = 'translate3d(' + targetLeft + 'px, 0px, 0px)'; 300 } else { 301 animProps[_.animType] = 'translate3d(0px,' + targetLeft + 'px, 0px)'; 302 } 303 _.$slideTrack.css(animProps); 304 305 if (callback) { 306 setTimeout(function () { 307 308 _.disableTransition(); 309 310 callback.call(); 311 }, _.options.speed); 312 } 313 314 } 315 316 } 317 318 }; 319 320 Slick.prototype.asNavFor = function (index) { 321 322 var _ = this, 323 asNavFor = _.options.asNavFor; 324 325 if (asNavFor && asNavFor !== null) { 326 asNavFor = $(asNavFor).not(_.$slider); 327 } 328 329 if (asNavFor !== null && typeof asNavFor === 'object') { 330 asNavFor.each(function () { 331 var target = $(this).slick('getSlick'); 332 if (!target.unslicked) { 333 target.slideHandler(index, true); 334 } 335 }); 336 } 337 338 }; 339 340 Slick.prototype.applyTransition = function (slide) { 341 342 var _ = this, 343 transition = {}; 344 345 if (_.options.fade === false) { 346 transition[_.transitionType] = _.transformType + ' ' + _.options.speed + 'ms ' + _.options.cssEase; 347 } else { 348 transition[_.transitionType] = 'opacity ' + _.options.speed + 'ms ' + _.options.cssEase; 349 } 350 351 if (_.options.fade === false) { 352 _.$slideTrack.css(transition); 353 } else { 354 _.$slides.eq(slide).css(transition); 355 } 356 357 }; 358 359 Slick.prototype.autoPlay = function () { 360 361 var _ = this; 362 363 if (_.autoPlayTimer) { 364 clearInterval(_.autoPlayTimer); 365 } 366 367 if (_.slideCount > _.options.slidesToShow && _.paused !== true) { 368 _.autoPlayTimer = setInterval(_.autoPlayIterator, 369 _.options.autoplaySpeed); 370 } 371 372 }; 373 374 Slick.prototype.autoPlayClear = function () { 375 376 var _ = this; 377 if (_.autoPlayTimer) { 378 clearInterval(_.autoPlayTimer); 379 } 380 381 }; 382 383 Slick.prototype.autoPlayIterator = function () { 384 385 var _ = this; 386 387 if (_.options.infinite === false) { 388 389 if (_.direction === 1) { 390 391 if ((_.currentSlide + 1) === _.slideCount - 392 1) { 393 _.direction = 0; 394 } 395 396 _.slideHandler(_.currentSlide + _.options.slidesToScroll); 397 398 } else { 399 400 if ((_.currentSlide - 1 === 0)) { 401 402 _.direction = 1; 403 404 } 405 406 _.slideHandler(_.currentSlide - _.options.slidesToScroll); 407 408 } 409 410 } else { 411 412 _.slideHandler(_.currentSlide + _.options.slidesToScroll); 413 414 } 415 416 }; 417 418 Slick.prototype.buildArrows = function () { 419 420 var _ = this; 421 422 if (_.options.arrows === true) { 423 424 _.$prevArrow = $(_.options.prevArrow).addClass('slick-arrow'); 425 _.$nextArrow = $(_.options.nextArrow).addClass('slick-arrow'); 426 427 if (_.slideCount > _.options.slidesToShow) { 428 429 _.$prevArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex'); 430 _.$nextArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex'); 431 432 if (_.htmlExpr.test(_.options.prevArrow)) { 433 _.$prevArrow.prependTo(_.options.appendArrows); 434 } 435 436 if (_.htmlExpr.test(_.options.nextArrow)) { 437 _.$nextArrow.appendTo(_.options.appendArrows); 438 } 439 440 if (_.options.infinite !== true) { 441 _.$prevArrow 442 .addClass('slick-disabled') 443 .attr('aria-disabled', 'true'); 444 } 445 446 } else { 447 448 _.$prevArrow.add(_.$nextArrow) 449 450 .addClass('slick-hidden') 451 .attr({ 452 'aria-disabled': 'true', 453 'tabindex': '-1' 454 }); 455 456 } 457 458 } 459 460 }; 461 462 Slick.prototype.buildDots = function () { 463 464 var _ = this, 465 i, dotString; 466 467 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 468 469 dotString = '<ul class="' + _.options.dotsClass + '">'; 470 471 for (i = 0; i <= _.getDotCount(); i += 1) { 472 dotString += '<li>' + _.options.customPaging.call(this, _, i) + '</li>'; 473 } 474 475 dotString += '</ul>'; 476 477 _.$dots = $(dotString).appendTo(
vendor: 9,149 bytes, lines 478-730
478 _.options.appendDots); 479 480 _.$dots.find('li').first().addClass('slick-active').attr('aria-hidden', 'false'); 481 482 } 483 484 }; 485 486 Slick.prototype.buildOut = function () { 487 488 var _ = this; 489 490 _.$slides = 491 _.$slider 492 .children(_.options.slide + ':not(.slick-cloned)') 493 .addClass('slick-slide'); 494 495 _.slideCount = _.$slides.length; 496 497 _.$slides.each(function (index, element) { 498 $(element) 499 .attr('data-slick-index', index) 500 .data('originalStyling', $(element).attr('style') || ''); 501 }); 502 503 _.$slidesCache = _.$slides; 504 505 _.$slider.addClass('slick-slider'); 506 507 _.$slideTrack = (_.slideCount === 0) ? 508 $('<div class="slick-track"/>').appendTo(_.$slider) : 509 _.$slides.wrapAll('<div class="slick-track"/>').parent(); 510 511 _.$list = _.$slideTrack.wrap( 512 '<div aria-live="polite" class="slick-list"/>').parent(); 513 _.$slideTrack.css('opacity', 0); 514 515 if (_.options.centerMode === true || _.options.swipeToSlide === true) { 516 _.options.slidesToScroll = 1; 517 } 518 519 $('img[data-lazy]', _.$slider).not('[src]').addClass('slick-loading'); 520 521 _.setupInfinite(); 522 523 _.buildArrows(); 524 525 _.buildDots(); 526 527 _.updateDots(); 528 529 530 _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0); 531 532 if (_.options.draggable === true) { 533 _.$list.addClass('draggable'); 534 } 535 536 }; 537 538 Slick.prototype.buildRows = function () { 539 540 var _ = this, a, b, c, newSlides, numOfSlides, originalSlides, slidesPerSection; 541 542 newSlides = document.createDocumentFragment(); 543 originalSlides = _.$slider.children(); 544 545 if (_.options.rows > 1) { 546 547 slidesPerSection = _.options.slidesPerRow * _.options.rows; 548 numOfSlides = Math.ceil( 549 originalSlides.length / slidesPerSection 550 ); 551 552 for (a = 0; a < numOfSlides; a++) { 553 var slide = document.createElement('div'); 554 for (b = 0; b < _.options.rows; b++) { 555 var row = document.createElement('div'); 556 for (c = 0; c < _.options.slidesPerRow; c++) { 557 var target = (a * slidesPerSection + ((b * _.options.slidesPerRow) + c)); 558 if (originalSlides.get(target)) { 559 row.appendChild(originalSlides.get(target)); 560 } 561 } 562 slide.appendChild(row); 563 } 564 newSlides.appendChild(slide); 565 } 566 567 _.$slider.html(newSlides); 568 _.$slider.children().children().children() 569 .css({ 570 'width': (100 / _.options.slidesPerRow) + '%', 571 'display': 'inline-block' 572 }); 573 574 } 575 576 }; 577 578 Slick.prototype.checkResponsive = function (initial, forceUpdate) { 579 580 var _ = this, 581 breakpoint, targetBreakpoint, respondToWidth, triggerBreakpoint = false; 582 var sliderWidth = _.$slider.width(); 583 var windowWidth = window.innerWidth || $(window).width(); 584 585 if (_.respondTo === 'window') { 586 respondToWidth = windowWidth; 587 } else if (_.respondTo === 'slider') { 588 respondToWidth = sliderWidth; 589 } else if (_.respondTo === 'min') { 590 respondToWidth = Math.min(windowWidth, sliderWidth); 591 } 592 593 if (_.options.responsive && 594 _.options.responsive.length && 595 _.options.responsive !== null) { 596 597 targetBreakpoint = null; 598 599 for (breakpoint in _.breakpoints) { 600 if (_.breakpoints.hasOwnProperty(breakpoint)) { 601 if (_.originalSettings.mobileFirst === false) { 602 if (respondToWidth < _.breakpoints[breakpoint]) { 603 targetBreakpoint = _.breakpoints[breakpoint]; 604 } 605 } else { 606 if (respondToWidth > _.breakpoints[breakpoint]) { 607 targetBreakpoint = _.breakpoints[breakpoint]; 608 } 609 } 610 } 611 } 612 613 if (targetBreakpoint !== null) { 614 if (_.activeBreakpoint !== null) { 615 if (targetBreakpoint !== _.activeBreakpoint || forceUpdate) { 616 _.activeBreakpoint = 617 targetBreakpoint; 618 if (_.breakpointSettings[targetBreakpoint] === 'unslick') { 619 _.unslick(targetBreakpoint); 620 } else { 621 _.options = $.extend({}, _.originalSettings, 622 _.breakpointSettings[ 623 targetBreakpoint]); 624 if (initial === true) { 625 _.currentSlide = _.options.initialSlide; 626 } 627 _.refresh(initial); 628 } 629 triggerBreakpoint = targetBreakpoint; 630 } 631 } else { 632 _.activeBreakpoint = targetBreakpoint; 633 if (_.breakpointSettings[targetBreakpoint] === 'unslick') { 634 _.unslick(targetBreakpoint); 635 } else { 636 _.options = $.extend({}, _.originalSettings, 637 _.breakpointSettings[ 638 targetBreakpoint]); 639 if (initial === true) { 640 _.currentSlide = _.options.initialSlide; 641 } 642 _.refresh(initial); 643 } 644 triggerBreakpoint = targetBreakpoint; 645 } 646 } else { 647 if (_.activeBreakpoint !== null) { 648 _.activeBreakpoint = null; 649 _.options = _.originalSettings; 650 if (initial === true) { 651 _.currentSlide = _.options.initialSlide; 652 } 653 _.refresh(initial); 654 triggerBreakpoint = targetBreakpoint; 655 } 656 } 657 658 // only trigger breakpoints during an actual break. not on initialize. 659 if (!initial && triggerBreakpoint !== false) { 660 _.$slider.trigger('breakpoint', [_, triggerBreakpoint]); 661 } 662 } 663 664 }; 665 666 Slick.prototype.changeSlide = function (event, dontAnimate) { 667 668 var _ = this, 669 $target = $(event.target), 670 indexOffset, slideOffset, unevenOffset; 671 672 // If target is a link, prevent default action. 673 if ($target.is('a')) { 674 event.preventDefault(); 675 } 676 677 // If target is not the <li> element (ie: a child), find the <li>. 678 if (!$target.is('li')) { 679 $target = $target.closest('li'); 680 } 681 682 unevenOffset = (_.slideCount % _.options.slidesToScroll !== 0); 683 indexOffset = unevenOffset ? 0 : (_.slideCount - _.currentSlide) % _.options.slidesToScroll; 684 685 switch (event.data.message) { 686 687 case 'previous': 688 slideOffset = indexOffset === 0 ? _.options.slidesToScroll : _.options.slidesToShow - indexOffset; 689 if (_.slideCount > _.options.slidesToShow) { 690 _.slideHandler(_.currentSlide - slideOffset, false, dontAnimate); 691 } 692 break; 693 694 case 'next': 695 slideOffset = indexOffset === 0 ? _.options.slidesToScroll : indexOffset; 696 if (_.slideCount > _.options.slidesToShow) { 697 _.slideHandler(_.currentSlide + slideOffset, false, dontAnimate); 698 } 699 break; 700 701 case 'index': 702 var index = event.data.index === 0 ? 0 : 703 event.data.index || $target.index() * _.options.slidesToScroll; 704 705 _.slideHandler(_.checkNavigable(index), false, dontAnimate); 706 $target.children().trigger('focus'); 707 break; 708 709 default: 710 return; 711 } 712 713 }; 714 715 Slick.prototype.checkNavigable = function (index) { 716 717 var _ = this, 718 navigables, prevNavigable; 719 720 navigables = _.getNavigableIndexes(); 721 prevNavigable = 0; 722 if (index > navigables[navigables.length - 1]) { 723 index = navigables[navigables.length - 1]; 724 } else { 725 for (var n in navigables) { 726 if (index < navigables[n]) { 727 index = prevNavigable; 728 break; 729 } 730 prevNavigable = navigables[n];
731 } 732 } 733 734 return index; 735 }; 736 737 Slick.prototype.cleanUpEvents = function () { 738 739 var _ = this; 740 741 if (_.options.dots && _.$dots !== null) { 742 743 $('li', _.$dots).off('click.slick', _.changeSlide); 744 745 if (_.options.pauseOnDotsHover === true && _.options.autoplay === true) { 746 747 $('li', _.$dots) 748 .off('mouseenter.slick', $.proxy(_.setPaused, _, true)) 749 .off('mouseleave.slick', $.proxy(_.setPaused, _, false)); 750 751 } 752 753 } 754 755 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 756 _.$prevArrow && _.$prevArrow.off('click.slick', _.changeSlide); 757 _.$nextArrow && _.$nextArrow.off('click.slick', _.changeSlide); 758 } 759 760 _.$list.off('touchstart.slick mousedown.slick', _.swipeHandler); 761 _.$list.off('touchmove.slick mousemove.slick', _.swipeHandler); 762 _.$list.off('touchend.slick mouseup.slick', _.swipeHandler);
vendor: 5,201 bytes, lines 763-963
763 _.$list.off('touchcancel.slick mouseleave.slick', _.swipeHandler); 764 765 _.$list.off('click.slick', _.clickHandler); 766 767 $(document).off(_.visibilityChange, _.visibility); 768 769 _.$list.off('mouseenter.slick', $.proxy(_.setPaused, _, true)); 770 _.$list.off('mouseleave.slick', $.proxy(_.setPaused, _, false)); 771 772 if (_.options.accessibility === true) { 773 _.$list.off('keydown.slick', _.keyHandler); 774 } 775 776 if (_.options.focusOnSelect === true) { 777 $(_.$slideTrack).children().off('click.slick', _.selectHandler); 778 } 779 780 $(window).off('orientationchange.slick.slick-' + _.instanceUid, _.orientationChange); 781 782 $(window).off('resize.slick.slick-' + _.instanceUid, _.resize); 783 784 $('[draggable!=true]', _.$slideTrack).off('dragstart', _.preventDefault); 785 786 $(window).off('load.slick.slick-' + _.instanceUid, _.setPosition); 787 $(document).off('ready.slick.slick-' + _.instanceUid, _.setPosition); 788 }; 789 790 Slick.prototype.cleanUpRows = function () { 791 792 var _ = this, originalSlides; 793 794 if (_.options.rows > 1) { 795 originalSlides = _.$slides.children().children(); 796 originalSlides.removeAttr('style'); 797 _.$slider.html(originalSlides); 798 } 799 800 }; 801 802 Slick.prototype.clickHandler = function (event) { 803 804 var _ = this; 805 806 if (_.shouldClick === false) { 807 event.stopImmediatePropagation(); 808 event.stopPropagation(); 809 event.preventDefault(); 810 } 811 812 }; 813 814 Slick.prototype.destroy = function (refresh) { 815 816 var _ = this; 817 818 _.autoPlayClear(); 819 820 _.touchObject = {}; 821 822 _.cleanUpEvents(); 823 824 $('.slick-cloned', _.$slider).detach(); 825 826 if (_.$dots) { 827 _.$dots.remove(); 828 } 829 830 831 if (_.$prevArrow && _.$prevArrow.length) { 832 833 _.$prevArrow 834 .removeClass('slick-disabled slick-arrow slick-hidden') 835 .removeAttr('aria-hidden aria-disabled tabindex') 836 .css("display", ""); 837 838 if (_.htmlExpr.test(_.options.prevArrow)) { 839 _.$prevArrow.remove(); 840 } 841 } 842 843 if (_.$nextArrow && _.$nextArrow.length) { 844 845 _.$nextArrow 846 .removeClass('slick-disabled slick-arrow slick-hidden') 847 .removeAttr('aria-hidden aria-disabled tabindex') 848 .css("display", ""); 849 850 if (_.htmlExpr.test(_.options.nextArrow)) { 851 _.$nextArrow.remove(); 852 } 853 854 } 855 856 857 if (_.$slides) { 858 859 _.$slides 860 .removeClass('slick-slide slick-active slick-center slick-visible slick-current') 861 .removeAttr('aria-hidden') 862 .removeAttr('data-slick-index') 863 .each(function () { 864 $(this).attr('style', $(this).data('originalStyling')); 865 }); 866 867 _.$slideTrack.children(this.options.slide).detach(); 868 869 _.$slideTrack.detach(); 870 871 _.$list.detach(); 872 873 _.$slider.append(_.$slides); 874 } 875 876 _.cleanUpRows(); 877 878 _.$slider.removeClass('slick-slider'); 879 _.$slider.removeClass('slick-initialized'); 880 881 _.unslicked = true; 882 883 if (!refresh) { 884 _.$slider.trigger('destroy', [_]); 885 } 886 887 }; 888 889 Slick.prototype.disableTransition = function (slide) { 890 891 var _ = this, 892 transition = {}; 893 894 transition[_.transitionType] = ''; 895 896 if (_.options.fade === false) { 897 _.$slideTrack.css(transition); 898 } else { 899 _.$slides.eq(slide).css(transition); 900 } 901 902 }; 903 904 Slick.prototype.fadeSlide = function (slideIndex, callback) { 905 906 var _ = this; 907 908 if (_.cssTransitions === false) { 909 910 _.$slides.eq(slideIndex).css({ 911 zIndex: _.options.zIndex 912 }); 913 914 _.$slides.eq(slideIndex).animate({ 915 opacity: 1 916 }, _.options.speed, _.options.easing, callback); 917 918 } else { 919 920 _.applyTransition(slideIndex); 921 922 _.$slides.eq(slideIndex).css({ 923 opacity: 1, 924 zIndex: _.options.zIndex 925 }); 926 927 if (callback) { 928 setTimeout(function () { 929 930 _.disableTransition(slideIndex); 931 932 callback.call(); 933 }, _.options.speed); 934 } 935 936 } 937 938 }; 939 940 Slick.prototype.fadeSlideOut = function (slideIndex) { 941 942 var _ = this; 943 944 if (_.cssTransitions === false) { 945 946 _.$slides.eq(slideIndex).animate({ 947 opacity: 0, 948 zIndex: _.options.zIndex - 2 949 }, _.options.speed, _.options.easing); 950 951 } else { 952 953 _.applyTransition(slideIndex); 954 955 _.$slides.eq(slideIndex).css({ 956 opacity: 0, 957 zIndex: _.options.zIndex - 2 958 }); 959 960 } 961 962 }; 963
964 Slick.prototype.filterSlides = Slick.prototype.slickFilter = function (filter) { 965 966 var _ = this; 967 968 if (filter !== null) { 969 970 _.unload(); 971 972 _.$slideTrack.children(this.options.slide).detach(); 973 974 _.$slidesCache.filter(filter).appendTo(_.$slideTrack); 975 976 _.reinit(); 977 978 } 979 980 }; 981 982 Slick.prototype.getCurrent = Slick.prototype.slickCurrentSlide = function () { 983 984 var _ = this; 985 return _.currentSlide; 986 987 }; 988 989 Slick.prototype.getDotCount = function () { 990 991 var _ = this; 992 993 var breakPoint = 0; 994 var counter = 0; 995 var pagerQty = 0; 996 997 if (_.options.infinite === true) { 998 while (breakPoint < _.slideCount) { 999 ++pagerQty; 1000 breakPoint = counter + _.options.slidesToShow; 1001 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 1002 } 1003 } else if (_.options.centerMode === true) { 1004 pagerQty = _.slideCount; 1005 } else { 1006 while (breakPoint < _.slideCount) { 1007 ++pagerQty; 1008 breakPoint = counter + _.options.slidesToShow; 1009 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 1010 } 1011 } 1012 1013 return pagerQty - 1; 1014 1015 }; 1016 1017 Slick.prototype.getLeft = function (slideIndex) { 1018 1019 var _ = this, 1020 targetLeft, 1021 verticalHeight, 1022 verticalOffset = 0, 1023 targetSlide; 1024 1025 _.slideOffset = 0; 1026 verticalHeight = _.$slides.first().outerHeight(true); 1027 1028 if (_.options.infinite === true) { 1029 if (_.slideCount > _.options.slidesToShow) { 1030 _.slideOffset = (_.slideWidth * _.options.slidesToShow) * -1; 1031 verticalOffset = (verticalHeight * _.options.slidesToShow) * -1; 1032 } 1033 if (_.slideCount % _.options.slidesToScroll !== 0) { 1034 if (slideIndex + _.options.slidesToScroll > _.slideCount && _.slideCount > _.options.slidesToShow) { 1035 if (slideIndex > _.slideCount) { 1036 _.slideOffset = ((_.options.slidesToShow - (sl
vendor: 1,580 bytes, lines 1036-1070
1036ideIndex - _.slideCount)) * _.slideWidth) * -1; 1037 verticalOffset = ((_.options.slidesToShow - (slideIndex - _.slideCount)) * verticalHeight) * -1; 1038 } else { 1039 _.slideOffset = ((_.slideCount % _.options.slidesToScroll) * _.slideWidth) * -1; 1040 verticalOffset = ((_.slideCount % _.options.slidesToScroll) * verticalHeight) * -1; 1041 } 1042 } 1043 } 1044 } else { 1045 if (slideIndex + _.options.slidesToShow > _.slideCount) { 1046 _.slideOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * _.slideWidth; 1047 verticalOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * verticalHeight; 1048 } 1049 } 1050 1051 if (_.slideCount <= _.options.slidesToShow) { 1052 _.slideOffset = 0; 1053 verticalOffset = 0; 1054 } 1055 1056 if (_.options.centerMode === true && _.options.infinite === true) { 1057 _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2) - _.slideWidth; 1058 } else if (_.options.centerMode === true) { 1059 _.slideOffset = 0; 1060 _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2); 1061 } 1062 1063 if (_.options.vertical === false) { 1064 targetLeft = ((slideIndex * _.slideWidth) * -1) + _.slideOffset; 1065 } else { 1066 targetLeft = ((slideIndex * verticalHeight) * -1) + verticalOffset; 1067 } 1068 1069 if (_.options.variableWidth === true) { 1070
1071 if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) { 1072 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex); 1073 } else { 1074 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow); 1075 } 1076 1077 targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0; 1078 1079 if (_.options.centerMode === true) { 1080 if (_.options.infinite === false) { 1081 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex); 1082 } else { 1083 targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow + 1); 1084 } 1085 targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0; 1086 targetLeft += (_.$list.width() - targetSlide.outerWidth()) / 2; 1087 } 1088 } 1089 1090 return targetLeft; 1091 1092 }; 1093 1094 Slick.prototype.getOption = Slick.prototype.slickGetOption = function (option) { 1095 1096 var _ = this; 1097 1098 return _.options[option]; 1099 1100 }; 1101 1102 Slick.prototype.getNavigableIndexes = function () { 1103 1104 var _ = this, 1105 breakPoint = 0, 1106 counter = 0, 1107 indexes = [], 1108 max; 1109 1110 if (_.options.infinite === false) { 1111 max = _.slideCount; 1112 } else { 1113 breakPoint = _.options.slidesToScroll * -1; 1114 counter = _.options.slidesToScroll * -1; 1115 max = _.slideCount * 2; 1116 } 1117 1118 while (breakPoint < max) { 1119 indexes.push(breakPoint); 1120 breakPoint = counter + _.options.slidesToScroll; 1121 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 1122 } 1123 1124 return indexes; 1125 1126 }; 1127 1128 Slick.prototype.getSlick = function () { 1129 1130 return this; 1131 1132 }; 1133 1134 Slick.prototype.getSlideCount = function () { 1135 1136 var _ = this, 1137 slidesTraversed, swipedSlide, centerOffset; 1138 1139 centerOffset = _.options.centerMode === true ? _.slideWidth * Math.floor(_.options.slidesToShow / 2) : 0; 1140 1141 if (_.options.swipeToSlide === true) { 1142 _.$slideTrack.find('.slick-slide').each(function (index, slide) { 1143 if (slide.offsetLeft - centerOffset + ($(slide).outerWidth() / 2) > (_.swipeLeft * -1)) { 1144 swipedSlide = slide; 1145 return false; 1146 } 1147 }); 1148 1149 slidesTraversed = Math.abs($(swipedSlide).attr('data-slick-index') - _.currentSlide) || 1; 1150 1151 return slidesTraversed; 1152 1153 } else { 1154 return _.options.slidesToScroll; 1155 } 1156 1157 }; 1158 1159 Slick.prototype.goTo = Slick.prototype.slickGoTo = function (slide, dontAnimate) { 1160 1161 var _ = this; 1162 1163 _.changeSlide({ 1164 data: { 1165 message: 'index', 1166 index: parseInt(slide) 1167 } 1168 }, dontAnimate); 1169 1170 }; 1171 1172 Slick.prototype.init = function (creation) { 1173 1174 var _ = this; 1175 1176 if (!$(_.$slider).hasClass('slick-initialized')) { 1177 1178 $(_.$slider).addClass('slick-initialized'); 1179 1180 _.buildRows(); 1181 _.buildOut(); 1182 _.setProps(); 1183 _.startLoad(); 1184 _.loadSlider(); 1185 _.initializeEvents(); 1186 _.updateArrows(); 1187 _.updateDots(); 1188 1189 } 1190 1191 if (creation) { 1192 _.$slider.trigger('init', [_]); 1193 } 1194 1195 if (_.options.accessibility === true) { 1196 _.initADA(); 1197 } 1198 1199 }; 1200 1201 Slick.prototype.initArrowEvents = function () { 1202 1203 var _ = this; 1204 1205 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 1206 _.$prevArrow.on('click.slick', { 1207 message: 'previous' 1208 }, _.changeSlide); 1209 _.$nextArrow.on('click.slick', { 1210 message: 'next' 1211 }, _.changeSlide); 1212 } 1213 1214 }; 1215 1216 Slick.prototype.initDotEvents = function () { 1217 1218 var _ = this; 1219 1220 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 1221 $('li', _.$dots).on('click.slick', { 1222 message: 'index' 1223 }, _.changeSlide); 1224 } 1225 1226 if (_.options.dots === true && _.options.pauseOnDotsHover === true && _.options.autoplay === true) { 1227 $('li', _.$dots) 1228 .on('mouseenter.slick', $.proxy(_.setPaused, _, true))
vendor: 4,423 bytes, lines 1229-1366
1229 .on('mouseleave.slick', $.proxy(_.setPaused, _, false)); 1230 } 1231 1232 }; 1233 1234 Slick.prototype.initializeEvents = function () { 1235 1236 var _ = this; 1237 1238 _.initArrowEvents(); 1239 1240 _.initDotEvents(); 1241 1242 _.$list.on('touchstart.slick mousedown.slick', { 1243 action: 'start' 1244 }, _.swipeHandler); 1245 _.$list.on('touchmove.slick mousemove.slick', { 1246 action: 'move' 1247 }, _.swipeHandler); 1248 _.$list.on('touchend.slick mouseup.slick', { 1249 action: 'end' 1250 }, _.swipeHandler); 1251 _.$list.on('touchcancel.slick mouseleave.slick', { 1252 action: 'end' 1253 }, _.swipeHandler); 1254 1255 _.$list.on('click.slick', _.clickHandler); 1256 1257 $(document).on(_.visibilityChange, $.proxy(_.visibility, _)); 1258 1259 _.$list.on('mouseenter.slick', $.proxy(_.setPaused, _, true)); 1260 _.$list.on('mouseleave.slick', $.proxy(_.setPaused, _, false)); 1261 1262 if (_.options.accessibility === true) { 1263 _.$list.on('keydown.slick', _.keyHandler); 1264 } 1265 1266 if (_.options.focusOnSelect === true) { 1267 $(_.$slideTrack).children().on('click.slick', _.selectHandler); 1268 } 1269 1270 $(window).on('orientationchange.slick.slick-' + _.instanceUid, $.proxy(_.orientationChange, _)); 1271 1272 $(window).on('resize.slick.slick-' + _.instanceUid, $.proxy(_.resize, _)); 1273 1274 $('[draggable!=true]', _.$slideTrack).on('dragstart', _.preventDefault); 1275 1276 $(window).on('load.slick.slick-' + _.instanceUid, _.setPosition); 1277 $(document).on('ready.slick.slick-' + _.instanceUid, _.setPosition); 1278 1279 }; 1280 1281 Slick.prototype.initUI = function () { 1282 1283 var _ = this; 1284 1285 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 1286 1287 _.$prevArrow.show(); 1288 _.$nextArrow.show(); 1289 1290 } 1291 1292 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 1293 1294 _.$dots.show(); 1295 1296 } 1297 1298 if (_.options.autoplay === true) { 1299 1300 _.autoPlay(); 1301 1302 } 1303 1304 }; 1305 1306 Slick.prototype.keyHandler = function (event) { 1307 1308 var _ = this; 1309 //Dont slide if the cursor is inside the form fields and arrow keys are pressed 1310 if (!event.target.tagName.match('TEXTAREA|INPUT|SELECT')) { 1311 if (event.keyCode === 37 && _.options.accessibility === true) { 1312 _.changeSlide({ 1313 data: { 1314 message: 'previous' 1315 } 1316 }); 1317 } else if (event.keyCode === 39 && _.options.accessibility === true) { 1318 _.changeSlide({ 1319 data: { 1320 message: 'next' 1321 } 1322 }); 1323 } 1324 } 1325 1326 }; 1327 1328 Slick.prototype.lazyLoad = function () { 1329 1330 var _ = this, 1331 loadRange, cloneRange, rangeStart, rangeEnd; 1332 1333 function loadImages(imagesScope) { 1334 $('img[data-lazy]', imagesScope).each(function () { 1335 1336 var image = $(this), 1337 imageSource = $(this).attr('data-lazy'), 1338 imageToLoad = document.createElement('img'); 1339 1340 imageToLoad.onload = function () { 1341 image 1342 .animate({ opacity: 0 }, 100, function () { 1343 image 1344 .attr('src', imageSource) 1345 .animate({ opacity: 1 }, 200, function () { 1346 image 1347 .removeAttr('data-lazy') 1348 .removeClass('slick-loading'); 1349 }); 1350 }); 1351 }; 1352 1353 imageToLoad.src = imageSource; 1354 1355 }); 1356 } 1357 1358 if (_.options.centerMode === true) { 1359 if (_.options.infinite === true) { 1360 rangeStart = _.currentSlide + (_.options.slidesToShow / 2 + 1); 1361 rangeEnd = rangeStart + _.options.slidesToShow + 2; 1362 } else { 1363 rangeStart = Math.max(0, _.currentSlide - (_.options.slidesToShow / 2 + 1)); 1364 rangeEnd = 2 + (_.options.slidesToShow / 2 + 1) + _.currentSlide; 1365 } 1366 } else {
1367 rangeStart = _.options.infinite ? _.options.slidesToShow + _.currentSlide : _.currentSlide; 1368 rangeEnd = rangeStart + _.options.slidesToShow; 1369 if (_.options.fade === true) { 1370 if (rangeStart > 0) rangeStart--; 1371 if (rangeEnd <= _.slideCount) rangeEnd++; 1372 } 1373 } 1374 1375 loadRange = _.$slider.find('.slick-slide').slice(rangeStart, rangeEnd); 1376 loadImages(loadRange); 1377 1378 if (_.slideCount <= _.options.slidesToShow) { 1379 cloneRange = _.$slider.find('.slick-slide'); 1380 loadImages(cloneRange); 1381 } else 1382 if (_.currentSlide >= _.slideCount - _.options.slidesToShow) { 1383 cloneRange = _.$slider.find('.slick-cloned').slice(0, _.options.slidesToShow); 1384 loadImages(cloneRange); 1385 } else if (_.currentSlide === 0) { 1386 cloneRange = _.$slider.find('.slick-cloned').slice(_.options.slidesToShow * -1); 1387 loadImages(cloneRange); 1388 } 1389 1390 }; 1391 1392 Slick.prototype.loadSlider = function () { 1393 1394 var _ = this; 1395 1396 _.setPosition(); 1397 1398 _.$slideTrack.css({ 1399 opacity: 1 1400 }); 1401 1402 _.$slider.removeClass('slick-loading'); 1403 1404 _.initUI(); 1405 1406 if (_.options.lazyLoad === 'progressive') { 1407 _.progressiveLazyLoad(); 1408 } 1409 1410 }; 1411 1412 Slick.prototype.next = Slick.prototype.slickNext = function () { 1413 1414 var _ = this; 1415 1416 _.changeSlide({ 1417 data: { 1418 message: 'next' 1419 } 1420 }); 1421 1422 }; 1423 1424 Slick.prototype.orientationChange = function () { 1425 1426 var _ = this; 1427 1428 _.checkResponsive(); 1429 _.setPosition(); 1430 1431 }; 1432 1433 Slick.prototype.pause = Slick.prototype.slickPause = function () { 1434 1435 var _ = this; 1436 1437 _.autoPlayClear(); 1438 _.paused = true; 1439 1440 }; 1441 1442 Slick.prototype.play = Slick.prototype.slickPlay = function () { 1443 1444 var _ = this; 1445 1446 _.paused = false; 1447 _.autoPlay(); 1448 1449 }; 1450 1451 Slick.prototype.postSlide = function (index) { 1452 1453 var _ = this; 1454 1455 _.$slider.trigger('afterChange', [_, index]); 1456 1457 _.animating = false; 1458 1459 _.setPosition(); 1460 1461 _.swipeLeft = null; 1462 1463 if (_.options.autoplay === true && _.paused === false) { 1464 _.autoPlay(); 1465 } 1466 if (_.options.accessibility === true) { 1467 _.initADA(); 1468 } 1469 1470 }; 1471 1472 Slick.prototype.prev = Slick.prototype.slickPrev = function () { 1473 1474 var _ = this; 1475 1476 _.changeSlide({ 1477 data: { 1478 message: 'previous' 1479 } 1480 }); 1481 1482 }; 1483 1484 Slick.prototype.preventDefault = function (event) { 1485 event.preventDefault(); 1486 }; 1487 1488 Slick.prototype.progressiveLazyLoad = function () { 1489 1490 var _ = this, 1491 imgCount, targetImage; 1492 1493 imgCount = $('img[data-lazy]', _.$slider).length; 1494 1495 if (imgCount > 0) { 1496 targetImage = $('img[data-lazy]', _.$slider).first(); 1497 targetImage.attr('src', targetImage.attr('data-lazy')).removeClass('slick-loading').load(function () { 1498 targetImage.removeAttr('data-lazy'); 1499 _.progressiveLazyLoad(); 1500 1501 if (_.options.adaptiveHeight === true) { 1502 _.setPosition(); 1503 } 1504 }) 1505 .error(function () { 1506 targetImage.removeAttr('data-lazy'); 1507 _.progressiveLazyLoad(); 1508 }); 1509 } 1510 1511 }; 1512 1513 Slick.prototype.refresh = function (initializing) { 1514 1515 var _ = this, 1516 currentSlide = _.currentSlide; 1517 1518 _.destroy(true); 1519 1520 $.extend(_, _.initials, { currentSlide: currentSlide }); 1521 1522 _.init(); 1523 1524 if (!initializing) { 1525 1526 _.changeSlide({ 1527 data: { 1528 message: 'index', 1529 index: currentSlide 1530 } 1531 }, false); 1532 1533 } 1534 1535 }; 1536 1537 Slick.prototype.registerBreakpoints = function () { 1538 1539 var _ = this, breakpoint, currentBreakpoint, l, 1540 responsiveSettings = _.options.responsive || null; 1541 1542 if ($.type(responsiveSettings) === "array" && responsiveSettings.length) { 1543 1544 _.respondTo = _.options.respondTo || 'window'; 1545 1546 for (breakpoint in responsiveSettings) { 1547 1548 l = _.breakpoints.length - 1; 1549 currentBreakpoint = responsiveSettings[breakpoint].breakpoint; 1550 1551 if (responsiveSettings.hasOwnProperty(breakpoint)) { 1552 1553 // loop through the breakpoints and cut out any existing 1554 // ones with the same breakpoint number, we don't want dupes. 1555 while (l >= 0) { 1556 if (_.breakpoints[l] && _.breakpoints[l] === currentBreakpoint) { 1557 _.breakpoints.splice(l, 1); 1558 } 1559 l--; 1560 } 1561 1562 _.breakpoints.push(currentBreakpoint); 1563 _.breakpointSettings[currentBreakpoint] = responsiveSettings[breakpoint].settings; 1564 1565 } 1566 1567 } 1568 1569 _.breakpoints.sort(function (a, b) { 1570 return (_.options.mobileFirst) ? a - b : b - a; 1571 }); 1572 1573 } 1574 1575 }; 1576 1577 Slick.prototype.reinit = function () { 1578 1579 var _ = this; 1580 1581 _.$slides = 1582 _.$slideTrack 1583 .children(_.options.slide) 1584 .addClass('slick-slide'); 1585 1586 _.slideCount = _.$slides.length; 1587 1588 if (_.currentSlide >= _.slideCount && _.currentSlide !== 0) { 1589 _.currentSlide = _.currentSlide - _.options.slidesToScroll; 1590 } 1591 1592 if (_.slideCount <= _.options.slidesToShow) { 1593 _.currentSlide = 0; 1594 } 1595 1596 _.registerBreakpoints();
vendor: 5,996 bytes, lines 1597-1792
1597 1598 _.setProps(); 1599 _.setupInfinite(); 1600 _.buildArrows(); 1601 _.updateArrows(); 1602 _.initArrowEvents(); 1603 _.buildDots(); 1604 _.updateDots(); 1605 _.initDotEvents(); 1606 1607 _.checkResponsive(false, true); 1608 1609 if (_.options.focusOnSelect === true) { 1610 $(_.$slideTrack).children().on('click.slick', _.selectHandler); 1611 } 1612 1613 _.setSlideClasses(0); 1614 1615 _.setPosition(); 1616 1617 _.$slider.trigger('reInit', [_]); 1618 1619 if (_.options.autoplay === true) { 1620 _.focusHandler(); 1621 } 1622 1623 }; 1624 1625 Slick.prototype.resize = function () { 1626 1627 var _ = this; 1628 1629 if ($(window).width() !== _.windowWidth) { 1630 clearTimeout(_.windowDelay); 1631 _.windowDelay = window.setTimeout(function () { 1632 _.windowWidth = $(window).width(); 1633 _.checkResponsive(); 1634 if (!_.unslicked) { _.setPosition(); } 1635 }, 50); 1636 } 1637 }; 1638 1639 Slick.prototype.removeSlide = Slick.prototype.slickRemove = function (index, removeBefore, removeAll) { 1640 1641 var _ = this; 1642 1643 if (typeof (index) === 'boolean') { 1644 removeBefore = index; 1645 index = removeBefore === true ? 0 : _.slideCount - 1; 1646 } else { 1647 index = removeBefore === true ? --index : index; 1648 } 1649 1650 if (_.slideCount < 1 || index < 0 || index > _.slideCount - 1) { 1651 return false; 1652 } 1653 1654 _.unload(); 1655 1656 if (removeAll === true) { 1657 _.$slideTrack.children().remove(); 1658 } else { 1659 _.$slideTrack.children(this.options.slide).eq(index).remove(); 1660 } 1661 1662 _.$slides = _.$slideTrack.children(this.options.slide); 1663 1664 _.$slideTrack.children(this.options.slide).detach(); 1665 1666 _.$slideTrack.append(_.$slides); 1667 1668 _.$slidesCache = _.$slides; 1669 1670 _.reinit(); 1671 1672 }; 1673 1674 Slick.prototype.setCSS = function (position) { 1675 1676 var _ = this, 1677 positionProps = {}, 1678 x, y; 1679 1680 if (_.options.rtl === true) { 1681 position = -position; 1682 } 1683 x = _.positionProp == 'left' ? Math.ceil(position) + 'px' : '0px'; 1684 y = _.positionProp == 'top' ? Math.ceil(position) + 'px' : '0px'; 1685 1686 positionProps[_.positionProp] = position; 1687 1688 if (_.transformsEnabled === false) { 1689 _.$slideTrack.css(positionProps); 1690 } else { 1691 positionProps = {}; 1692 if (_.cssTransitions === false) { 1693 positionProps[_.animType] = 'translate(' + x + ', ' + y + ')'; 1694 _.$slideTrack.css(positionProps); 1695 } else { 1696 positionProps[_.animType] = 'translate3d(' + x + ', ' + y + ', 0px)'; 1697 _.$slideTrack.css(positionProps); 1698 } 1699 } 1700 1701 }; 1702 1703 Slick.prototype.setDimensions = function () { 1704 1705 var _ = this; 1706 1707 if (_.options.vertical === false) { 1708 if (_.options.centerMode === true) { 1709 _.$list.css({ 1710 padding: ('0px ' + _.options.centerPadding) 1711 }); 1712 } 1713 } else { 1714 _.$list.height(_.$slides.first().outerHeight(true) * _.options.slidesToShow); 1715 if (_.options.centerMode === true) { 1716 _.$list.css({ 1717 padding: (_.options.centerPadding + ' 0px') 1718 }); 1719 } 1720 } 1721 1722 _.listWidth = _.$list.width(); 1723 _.listHeight = _.$list.height(); 1724 1725 1726 if (_.options.vertical === false && _.options.variableWidth === false) { 1727 _.slideWidth = Math.ceil(_.listWidth / _.options.slidesToShow); 1728 _.$slideTrack.width(Math.ceil((_.slideWidth * _.$slideTrack.children('.slick-slide').length))); 1729 1730 } else if (_.options.variableWidth === true) { 1731 _.$slideTrack.width(5000 * _.slideCount); 1732 } else { 1733 _.slideWidth = Math.ceil(_.listWidth); 1734 _.$slideTrack.height(Math.ceil((_.$slides.first().outerHeight(true) * _.$slideTrack.children('.slick-slide').length))); 1735 } 1736 1737 var offset = _.$slides.first().outerWidth(true) - _.$slides.first().width(); 1738 if (_.options.variableWidth === false) _.$slideTrack.children('.slick-slide').width(_.slideWidth - offset); 1739 1740 }; 1741 1742 Slick.prototype.setFade = function () { 1743 1744 var _ = this, 1745 targetLeft; 1746 1747 _.$slides.each(function (index, element) { 1748 targetLeft = (_.slideWidth * index) * -1; 1749 if (_.options.rtl === true) { 1750 $(element).css({ 1751 position: 'relative', 1752 right: targetLeft, 1753 top: 0, 1754 zIndex: _.options.zIndex - 2, 1755 opacity: 0 1756 }); 1757 } else { 1758 $(element).css({ 1759 position: 'relative', 1760 left: targetLeft, 1761 top: 0, 1762 zIndex: _.options.zIndex - 2, 1763 opacity: 0 1764 }); 1765 } 1766 }); 1767 1768 _.$slides.eq(_.currentSlide).css({ 1769 zIndex: _.options.zIndex - 1, 1770 opacity: 1 1771 }); 1772 1773 }; 1774 1775 Slick.prototype.setHeight = function () { 1776 1777 var _ = this; 1778 1779 if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) { 1780 var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true); 1781 _.$list.css('height', targetHeight); 1782 } 1783 1784 }; 1785 1786 Slick.prototype.setOption = Slick.prototype.slickSetOption = function (option, value, refresh) { 1787 1788 var _ = this, l, item; 1789 1790 if (option === "responsive" && $.type(value) === "array") { 1791 for (item in value) { 1792 if ($.type(_.options.responsive) !== "array") {
1793 _.options.responsive = [value[item]]; 1794 } else { 1795 l = _.options.responsive.length - 1; 1796 // loop through the responsive object and splice out duplicates. 1797 while (l >= 0) { 1798 if (_.options.responsive[l].breakpoint === value[item].breakpoint) { 1799 _.options.responsive.splice(l, 1); 1800 } 1801 l--; 1802 } 1803 _.options.responsive.push(value[item]); 1804 } 1805 } 1806 } else { 1807 _.options[option] = value; 1808 } 1809 1810 if (refresh === true) { 1811 _.unload(); 1812 _.reinit(); 1813 } 1814 1815 }; 1816 1817 Slick.prototype.setPosition = function () { 1818 1819 var _ = this; 1820 1821 _.setDimensions(); 1822 1823 _.setHeight(); 1824 1825 if (_.options.fade === false) { 1826 _.setCSS(_.getLeft(_.currentSlide)); 1827 } else { 1828 _.setFade(); 1829 } 1830 1831 _.$slider.trigger('setPosition', [_]); 1832 1833 }; 1834 1835 Slick.prototype.setProps = function () { 1836 1837 var _ = this, 1838 bodyStyle = document.body.style; 1839 1840 _.positionProp = _.options.vertical === true ? 'top' : 'left'; 1841 1842 if (_.positionProp === 'top') { 1843 _.$slider.addClass('slick-vertical'); 1844 } else { 1845 _.$slider.removeClass('slick-vertical'); 1846 } 1847 1848 if (bodyStyle.WebkitTransition !== undefined || 1849 bodyStyle.MozTransition !== undefined || 1850 bodyStyle.msTransition !== undefined) { 1851 if (_.options.useCSS === true) { 1852 _.cssTransitions = true; 1853 } 1854 } 1855 1856 if (_.options.fade) { 1857 if (typeof _.options.zIndex === 'number') { 1858 if (_.options.zIndex < 3) { 1859 _.options.zIndex = 3; 1860 } 1861 } else { 1862 _.options.zIndex = _.defaults.zIndex; 1863 } 1864 } 1865 1866 if (bodyStyle.OTransform !== undefined) { 1867 _.animType = 'OTransform'; 1868 _.transformType = '-o-transform'; 1869 _.transitionType = 'OTransition'; 1870 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false; 1871 } 1872 if (bodyStyle.MozTransform !== undefined) { 1873 _.animType = 'MozTransform'; 1874 _.transformType = '-moz-transform'; 1875 _.transitionType = 'MozTransition'; 1876 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.MozPerspective === undefined) _.animType = false; 1877 } 1878 if (bodyStyle.webkitTransform !== undefined) { 1879 _.animType = 'webkitTransform'; 1880 _.transformType = '-webkit-transform'; 1881 _.transitionType = 'webkitTransition'; 1882 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false; 1883 } 1884 if (bodyStyle.msTransform !== undefined) { 1885 _.animType = 'msTransform'; 1886 _.transformType = '-ms-transform'; 1887 _.transitionType = 'msTransition'; 1888 if (bodyStyle.msTransform === undefined) _.animType = false; 1889 } 1890 if (bodyStyle.transform !== undefined && _.animType !== false) { 1891 _.animType = 'transform'; 1892 _.transformType = 'transform'; 1893 _.transitionType = 'transition'; 1894 } 1895 _.transformsEnabled = (_.animType !== null && _.animType !== false); 1896 1897 }; 1898 1899 1900 Slick.prototype.setSlideClasses = function (index) { 1901 1902 var _ = this, 1903 centerOffset, allSlides, indexOffset, remainder; 1904 1905 allSlides = _.$slider 1906 .find('.slick-slide') 1907 .removeClass('slick-active slick-center slick-current') 1908 .attr('aria-hidden', 'true'); 1909 1910 _.$slides 1911 .eq(index) 1912 .addClass('slick-current'); 1913 1914 if (_.options.centerMode === true) { 1915 1916 centerOffset = Math.floor(_.options.slidesToShow / 2); 1917 1918 if (_.options.infinite === true) { 1919 1920 if (index >
1920= centerOffset && index <= (_.slideCount - 1) - centerOffset) { 1921 1922 _.$slides 1923 .slice(index - centerOffset, index + centerOffset + 1) 1924 .addClass('slick-active') 1925 .attr('aria-hidden', 'false'); 1926 1927 } else { 1928 1929 indexOffset = _.options.slidesToShow + index; 1930 allSlides 1931 .slice(indexOffset - centerOffset + 1, indexOffset + centerOffset + 2) 1932 .addClass('slick-active') 1933 .attr('aria-hidden', 'false'); 1934 1935 } 1936 1937 if (index === 0) { 1938 1939 allSlides 1940 .eq(allSlides.length - 1 - _.options.slidesToShow) 1941 .addClass('slick-center'); 1942 1943 } else if (index === _.slideCount - 1) { 1944 1945 allSlides 1946 .eq(_.options.slidesToShow) 1947 .addClass('slick-center'); 1948 1949 } 1950 1951 } 1952 1953 _.$slides 1954 .eq(index) 1955 .addClass('slick-center'); 1956 1957 } else { 1958 1959 if (index >= 0 && index <= (_.slideCount - _.options.slidesToShow)) { 1960 1961 _.$slides 1962 .slice(index, index + _.options.slidesToShow) 1963 .addClass('slick-active') 1964 .attr('aria-hidden', 'false'); 1965 1966 } else if (allSlides.length <= _.options.slidesToShow) { 1967 1968 allSlides 1969 .addClass('slick-active') 1970 .attr('aria-hidden', 'false'); 1971 1972 } else { 1973 1974 remainder = _.slideCount % _.options.slidesToShow; 1975 indexOffset = _.options.infinite === true ? _.options.slidesToShow + index : index; 1976 1977 if (_.options.slidesToShow == _.options.slidesToScroll && (_.slideCount - index) < _.options.slidesToShow) { 1978 1979 allSlides 1980 .slice(indexOffset - (_.options.slidesToShow - remainder), indexOffset + remainder) 1981 .addClass('slick-active') 1982 .attr('aria-hidden', 'false'); 1983 1984 } else { 1985 1986 allSlides 1987 .slice(indexOffset, indexOffset + _.options.slidesToShow) 1988 .addClass('slick-active') 1989 .attr('aria-hidden', 'false'); 1990 1991 } 1992 1993 } 1994 1995 } 1996 1997 if (_.options.lazyLoad === 'ondemand') { 1998 _.lazyLoad(); 1999 } 2000 2001 }; 2002 2003 Slick.prototype.setupInfinite = function () { 2004 2005 var _ = this, 2006 i, slideIndex, infiniteCount; 2007 2008 if (_.options.fade === true) { 2009 _.options.centerMode = false; 2010 } 2011 2012 if (_.options.infinite === true && _.options.fade === false) { 2013 2014 slideIndex = null; 2015 2016 if (_.slideCount > _.options.slidesToShow) { 2017 2018 if (_.options.centerMode === true) { 2019 infiniteCount = _.options.slidesToShow + 1; 2020 } else { 2021 infiniteCount = _.options.slidesToShow; 2022 } 2023 2024 for (i = _.slideCount; i > (_.slideCount - 2025 infiniteCount); i -= 1) { 2026 slideIndex = i - 1; 2027 $(_.$slides[slideIndex]).clone(true).attr('id', '') 2028 .attr('data-slick-index', slideIndex - _.slideCount) 2029 .prependTo(_.$slideTrack).addClass('slick-cloned'); 2030 } 2031 for (i = 0; i < infiniteCount; i += 1) { 2032 slideIndex = i; 2033 $(_.$slides[slideIndex]).clone(true).attr('id', '') 2034 .attr('data-slick-index', slideIndex + _.slideCount) 2035 .appendTo(_.$slideTrack).addClass('slick-cloned'); 2036 } 2037 _.$slideTrack.find('.slick-cloned').find('[id]').each(function () { 2038 $(this).attr('id', ''); 2039 }); 2040 2041 } 2042 2043 } 2044 2045 }; 2046 2047 Slick.prototype.setPaused = function (paused) { 2048 2049 var _ = this; 2050 2051 if (_.options.autoplay === true && _.options.pauseOnHover === true) { 2052 _.paused = paused; 2053 if (!paused) { 2054 _.autoPlay(); 2055 } else { 2056 _.autoPlayClear(); 2057 } 2058 } 2059 }; 2060 2061 Slick.prototype.selectHandler = function (event) { 2062 2063 var _ = this; 2064 2065 var targetElement = 2066 $(event.target).is('.slick-slide') ? 2067 $(event.target) : 2068 $(event.target).parents('.slick-slide'); 2069 2070 var index = parseInt(targetElement.attr('data-slick-index')); 2071 2072 if (!index) index = 0; 2073 2074 if (_.slideCount <= _.options.slidesToShow) { 2075 2076 _.setSlideClasses(index); 2077 _.asNavFor(index); 2078 return; 2079 2080 } 2081 2082 _.slideHandler(index); 2083 2084 }; 2085 2086 Slick.prototype.slideHandler = function (index, sync, dontAnimate) { 2087 2088 var targetSlide, animSlide, oldSlide, slideLeft, targetLeft = null, 2089 _ = this; 2090 2091 sync = sync || false; 2092 2093 if (_.animating === true && _.options.waitForAnimate === true) { 2094 return; 2095 } 2096 2097 if (_.options.fade === true && _.currentSlide === index) { 2098 return; 2099 } 2100 2101 if (_.slideCount <= _.options.slidesToShow) { 2102 return; 2103 } 2104 2105 if (sync === false) { 2106 _.asNavFor(index); 2107 } 2108 2109 targetSlide = index; 2110 targetLeft = _.getLeft(targetSlide); 2111 slideLeft = _.getLeft(_.currentSlide); 2112 2113 _.currentLeft = _.swipeLeft === null ? slideLeft : _.swipeLeft; 2114 2115 if (_.options.infinite === false && _.options.centerMode === false && (index < 0 || index > _.getDotCount() * _.options.slidesToScroll)) { 2116 if (_.options.fade === false) { 2117 targetSlide = _.currentSlide; 2118 if (dontAnimate !== true) { 2119 _.animateSlide(slideLeft, function () { 2120 _.postSlide(targetSlide); 2121 }); 2122 } else { 2123 _.postSlide(targetSlide); 2124 } 2125 } 2126 return; 2127 } else if (_.options.infinite === false && _.options.centerMode === true && (index < 0 || index > (_.slideCount - _.options.slidesToScroll))) { 2128 if (_.options.fade === false) { 2129 targetSlide = _.currentSlide; 2130 if (dontAnimate !== true) { 2131 _.animateSlide(slideLeft, function () { 2132 _.postSlide(targetSlide); 2133 }); 2134 } else { 2135 _.postSlide(targetSlide); 2136 } 2137 } 2138 return; 2139 } 2140 2141 if (_.options.autoplay === true) { 2142 clearInterval(_.autoPlayTimer); 2143 } 2144
vendor: 9,882 bytes, lines 2145-2475
2145 if (targetSlide < 0) { 2146 if (_.slideCount % _.options.slidesToScroll !== 0) { 2147 animSlide = _.slideCount - (_.slideCount % _.options.slidesToScroll); 2148 } else { 2149 animSlide = _.slideCount + targetSlide; 2150 } 2151 } else if (targetSlide >= _.slideCount) { 2152 if (_.slideCount % _.options.slidesToScroll !== 0) { 2153 animSlide = 0; 2154 } else { 2155 animSlide = targetSlide - _.slideCount; 2156 } 2157 } else { 2158 animSlide = targetSlide; 2159 } 2160 2161 _.animating = true; 2162 2163 _.$slider.trigger('beforeChange', [_, _.currentSlide, animSlide]); 2164 2165 oldSlide = _.currentSlide; 2166 _.currentSlide = animSlide; 2167 2168 _.setSlideClasses(_.currentSlide); 2169 2170 _.updateDots(); 2171 _.updateArrows(); 2172 2173 if (_.options.fade === true) { 2174 if (dontAnimate !== true) { 2175 2176 _.fadeSlideOut(oldSlide); 2177 2178 _.fadeSlide(animSlide, function () { 2179 _.postSlide(animSlide); 2180 }); 2181 2182 } else { 2183 _.postSlide(animSlide); 2184 } 2185 _.animateHeight(); 2186 return; 2187 } 2188 2189 if (dontAnimate !== true) { 2190 _.animateSlide(targetLeft, function () { 2191 _.postSlide(animSlide); 2192 }); 2193 } else { 2194 _.postSlide(animSlide); 2195 } 2196 2197 }; 2198 2199 Slick.prototype.startLoad = function () { 2200 2201 var _ = this; 2202 2203 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 2204 2205 _.$prevArrow.hide(); 2206 _.$nextArrow.hide(); 2207 2208 } 2209 2210 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 2211 2212 _.$dots.hide(); 2213 2214 } 2215 2216 _.$slider.addClass('slick-loading'); 2217 2218 }; 2219 2220 Slick.prototype.swipeDirection = function () { 2221 2222 var xDist, yDist, r, swipeAngle, _ = this; 2223 2224 xDist = _.touchObject.startX - _.touchObject.curX; 2225 yDist = _.touchObject.startY - _.touchObject.curY; 2226 r = Math.atan2(yDist, xDist); 2227 2228 swipeAngle = Math.round(r * 180 / Math.PI); 2229 if (swipeAngle < 0) { 2230 swipeAngle = 360 - Math.abs(swipeAngle); 2231 } 2232 2233 if ((swipeAngle <= 45) && (swipeAngle >= 0)) { 2234 return (_.options.rtl === false ? 'left' : 'right'); 2235 } 2236 if ((swipeAngle <= 360) && (swipeAngle >= 315)) { 2237 return (_.options.rtl === false ? 'left' : 'right'); 2238 } 2239 if ((swipeAngle >= 135) && (swipeAngle <= 225)) { 2240 return (_.options.rtl === false ? 'right' : 'left'); 2241 } 2242 if (_.options.verticalSwiping === true) { 2243 if ((swipeAngle >= 35) && (swipeAngle <= 135)) { 2244 return 'left'; 2245 } else { 2246 return 'right'; 2247 } 2248 } 2249 2250 return 'vertical'; 2251 2252 }; 2253 2254 Slick.prototype.swipeEnd = function (event) { 2255 2256 var _ = this, 2257 slideCount; 2258 2259 _.dragging = false; 2260 2261 _.shouldClick = (_.touchObject.swipeLength > 10) ? false : true; 2262 2263 if (_.touchObject.curX === undefined) { 2264 return false; 2265 } 2266 2267 if (_.touchObject.edgeHit === true) { 2268 _.$slider.trigger('edge', [_, _.swipeDirection()]); 2269 } 2270 2271 if (_.touchObject.swipeLength >= _.touchObject.minSwipe) { 2272 2273 switch (_.swipeDirection()) { 2274 case 'left': 2275 slideCount = _.options.swipeToSlide ? _.checkNavigable(_.currentSlide + _.getSlideCount()) : _.currentSlide + _.getSlideCount(); 2276 _.slideHandler(slideCount); 2277 _.currentDirection = 0; 2278 _.touchObject = {}; 2279 _.$slider.trigger('swipe', [_, 'left']); 2280 break; 2281 2282 case 'right': 2283 slideCount = _.options.swipeToSlide ? _.checkNavigable(_.currentSlide - _.getSlideCount()) : _.currentSlide - _.getSlideCount(); 2284 _.slideHandler(slideCount); 2285 _.currentDirection = 1; 2286 _.touchObject = {}; 2287 _.$slider.trigger('swipe', [_, 'right']); 2288 break; 2289 } 2290 } else { 2291 if (_.touchObject.startX !== _.touchObject.curX) { 2292 _.slideHandler(_.currentSlide); 2293 _.touchObject = {}; 2294 } 2295 } 2296 2297 }; 2298 2299 Slick.prototype.swipeHandler = function (event) { 2300 2301 var _ = this; 2302 2303 if ((_.options.swipe === false) || ('ontouchend' in document && _.options.swipe === false)) { 2304 return; 2305 } else if (_.options.draggable === false && event.type.indexOf('mouse') !== -1) { 2306 return; 2307 } 2308 2309 _.touchObject.fingerCount = event.originalEvent && event.originalEvent.touches !== undefined ? 2310 event.originalEvent.touches.length : 1; 2311 2312 _.touchObject.minSwipe = _.listWidth / _.options 2313 .touchThreshold; 2314 2315 if (_.options.verticalSwiping === true) { 2316 _.touchObject.minSwipe = _.listHeight / _.options 2317 .touchThreshold; 2318 } 2319 2320 switch (event.data.action) { 2321 2322 case 'start': 2323 _.swipeStart(event); 2324 break; 2325 2326 case 'move': 2327 _.swipeMove(event); 2328 break; 2329 2330 case 'end': 2331 _.swipeEnd(event); 2332 break; 2333 2334 } 2335 2336 }; 2337 2338 Slick.prototype.swipeMove = function (event) { 2339 2340 var _ = this, 2341 edgeWasHit = false, 2342 curLeft, swipeDirection, swipeLength, positionOffset, touches; 2343 2344 touches = event.originalEvent !== undefined ? event.originalEvent.touches : null; 2345 2346 if (!_.dragging || touches && touches.length !== 1) { 2347 return false; 2348 } 2349 2350 curLeft = _.getLeft(_.currentSlide); 2351 2352 _.touchObject.curX = touches !== undefined ? touches[0].pageX : event.clientX; 2353 _.touchObject.curY = touches !== undefined ? touches[0].pageY : event.clientY; 2354 2355 _.touchObject.swipeLength = Math.round(Math.sqrt( 2356 Math.pow(_.touchObject.curX - _.touchObject.startX, 2))); 2357 2358 if (_.options.verticalSwiping === true) { 2359 _.touchObject.swipeLength = Math.round(Math.sqrt( 2360 Math.pow(_.touchObject.curY - _.touchObject.startY, 2))); 2361 } 2362 2363 swipeDirection = _.swipeDirection(); 2364 2365 if (swipeDirection === 'vertical') { 2366 return; 2367 } 2368 2369 if (event.originalEvent !== undefined && _.touchObject.swipeLength > 4 && event.cancelable) { 2370 event.preventDefault(); 2371 } 2372 2373 positionOffset = (_.options.rtl === false ? 1 : -1) * (_.touchObject.curX > _.touchObject.startX ? 1 : -1); 2374 if (_.options.verticalSwiping === true) { 2375 positionOffset = _.touchObject.curY > _.touchObject.startY ? 1 : -1; 2376 } 2377 2378 2379 swipeLength = _.touchObject.swipeLength; 2380 2381 _.touchObject.edgeHit = false; 2382 2383 if (_.options.infinite === false) { 2384 if ((_.currentSlide === 0 && swipeDirection === 'right') || (_.currentSlide >= _.getDotCount() && swipeDirection === 'left')) { 2385 swipeLength = _.touchObject.swipeLength * _.options.edgeFriction; 2386 _.touchObject.edgeHit = true; 2387 } 2388 } 2389 2390 if (_.options.vertical === false) { 2391 _.swipeLeft = curLeft + swipeLength * positionOffset; 2392 } else { 2393 _.swipeLeft = curLeft + (swipeLength * (_.$list.height() / _.listWidth)) * positionOffset; 2394 } 2395 if (_.options.verticalSwiping === true) { 2396 _.swipeLeft = curLeft + swipeLength * positionOffset; 2397 } 2398 2399 if (_.options.fade === true || _.options.touchMove === false) { 2400 return false; 2401 } 2402 2403 if (_.animating === true) { 2404 _.swipeLeft = null; 2405 return false; 2406 } 2407 2408 _.setCSS(_.swipeLeft); 2409 2410 }; 2411 2412 Slick.prototype.swipeStart = function (event) { 2413 2414 var _ = this, 2415 touches; 2416 2417 if (_.touchObject.fingerCount !== 1 || _.slideCount <= _.options.slidesToShow) { 2418 _.touchObject = {}; 2419 return false; 2420 } 2421 2422 if (event.originalEvent !== undefined && event.originalEvent.touches !== undefined) { 2423 touches = event.originalEvent.touches[0]; 2424 } 2425 2426 _.touchObject.startX = _.touchObject.curX = touches !== undefined ? touches.pageX : event.clientX; 2427 _.touchObject.startY = _.touchObject.curY = touches !== undefined ? touches.pageY : event.clientY; 2428 2429 _.dragging = true; 2430 2431 }; 2432 2433 Slick.prototype.unfilterSlides = Slick.prototype.slickUnfilter = function () { 2434 2435 var _ = this; 2436 2437 if (_.$slidesCache !== null) { 2438 2439 _.unload(); 2440 2441 _.$slideTrack.children(this.options.slide).detach(); 2442 2443 _.$slidesCache.appendTo(_.$slideTrack); 2444 2445 _.reinit(); 2446 2447 } 2448 2449 }; 2450 2451 Slick.prototype.unload = function () { 2452 2453 var _ = this; 2454 2455 $('.slick-cloned', _.$slider).remove(); 2456 2457 if (_.$dots) { 2458 _.$dots.remove(); 2459 } 2460 2461 if (_.$prevArrow && _.htmlExpr.test(_.options.prevArrow)) { 2462 _.$prevArrow.remove(); 2463 } 2464 2465 if (_.$nextArrow && _.htmlExpr.test(_.options.nextArrow)) { 2466 _.$nextArrow.remove(); 2467 } 2468 2469 _.$slides 2470 .removeClass('slick-slide slick-active slick-visible slick-current') 2471 .attr('aria-hidden', 'true') 2472 .css('width', ''); 2473 2474 }; 2475
2476 Slick.prototype.unslick = function (fromBreakpoint) { 2477 2478 var _ = this; 2479 _.$slider.trigger('unslick', [_, fromBreakpoint]); 2480 _.destroy(); 2481 2482 }; 2483 2484 Slick.prototype.updateArrows = function () { 2485 2486 var _ = this, 2487 centerOffset; 2488 2489 centerOffset = Math.floor(_.options.slidesToShow / 2); 2490 2491 if (_.options.arrows === true && 2492 _.slideCount > _.options.slidesToShow && 2493 !_.options.infinite) { 2494 2495 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 2496 _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 2497 2498 if (_.currentSlide === 0) { 2499 2500 _.$prevArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 2501 _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 2502 2503 } else if (_.currentSlide >= _.slideCount - _.options.slidesToShow && _.options.centerMode === false) { 2504 2505 _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 2506 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 2507 2508 } else if (_.currentSlide >= _.slideCount - 1 && _.options.centerMode === true) { 2509 2510 _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true'); 2511 _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false'); 2512 2513 } 2514 2515 } 2516 2517 }; 2518 2519 Slick.prototype.updateDots = function () { 2520 2521 var _ = this; 2522 2523 if (_.$dots !== null) { 2524 2525 _.$dots 2526 .find('li') 2527 .removeClass('slick-active') 2528 .attr('aria-hidden', 'true'); 2529 2530 _.$dots 2531 .find('li') 2532 .eq(Math.floor(_.currentSlide / _.options.slidesToScroll)) 2533 .addClass('slick-active') 2534 .attr('aria-hidden', 'false'); 2535 2536 } 2537 2538 }; 2539 2540 Slick.prototype.visibility = function () { 2541 2542 var _ = this; 2543 2544 if (document[_.hidden]) { 2545 _.paused = true; 2546 _.autoPlayClear(); 2547 } else { 2548 if (_.options.autoplay === true) { 2549 _.paused = false; 2550 _.autoPlay(); 2551 } 2552 } 2553 2554 }; 2555 Slick.prototype.initADA = function () { 2556 var _ = this; 2557 try { 2558 _.$slides.add(_.$slideTrack.find('.slick-cloned')).attr({ 2559 'aria-hidden': 'true', 2560 'tabindex': '-1' 2561 }).find('a, input, button, select').attr({ 2562 'tabindex': '-1' 2563 }); 2564 } catch (e) { 2565 2566 } 2567 2568 2569 _.$slideTrack.attr('role', 'listbox'); 2570 2571 _.$slides.not(_.$slideTrack.find('.slick-cloned')).each(function (i) { 2572 $(this).attr({ 2573 'role': 'option', 2574 'aria-describedby': 'slick-slide' + _.instanceUid + i + '' 2575 }); 2576 }); 2577 2578 if (_.$dots !== null) { 2579 _.$dots.attr('role', 'tablist').find('li').each(function (i) { 2580 $(this).attr({ 2581 'role': 'presentation', 2582 'aria-selected': 'false', 2583 'aria-controls': 'navigation' + _.instanceUid + i + '', 2584 'id': 'slick-slide' + _.instanceUid + i + '' 2585 }); 2586 }) 2587 .first().attr('aria-selected', 'true').end() 2588 .find('button').attr('role', 'button').end() 2589 .closest('div').attr('role', 'toolbar'); 2590 } 2591 _.activateADA(); 2592 2593 }; 2594 2595 Slick.prototype.activateADA = function () { 2596 var _ = this, 2597 _isSlideOnFocus = _.$slider.find('*').is(':focus'); 2598 // _isSlideOnFocus = _.$slides.is(':focus') || _.$slides.find('*').is(':focus'); 2599 2600 _.$slideTrack.find('.slick-active').attr({ 2601 'aria-hidden': 'false', 2602 'tabindex': '0' 2603 }).find('a, input, button, select').attr({ 2604 'tabindex': '0' 2605 }); 2606 2607 (_isSlideOnFocus) && _.$slideTrack.find('.slick-active').focus(); 2608 2609 }; 2610
2611 Slick.prototype.focusHandler = function () { 2612 var _ = this; 2613 _.$slider.on('focus.slick blur.slick', '*', function (event) { 2614 event.stopImmediatePropagation(); 2615 var sf = $(this); 2616 setTimeout(function () { 2617 if (_.isPlay) { 2618 if (sf.is(':focus')) { 2619 _.autoPlayClear(); 2620 _.paused = true; 2621 } else { 2622 _.paused = false; 2623 _.autoPlay(); 2624 } 2625 } 2626 }, 0); 2627 }); 2628 }; 2629 2630 $.fn.slick = function () { 2631 var _ = this, 2632 opt = arguments[0], 2633 args = Array.prototype.slice.call(arguments, 1), 2634 l = _.length, 2635 i = 0, 2636 ret; 2637 for (i; i < l; i++) { 2638 if (typeof opt == 'object' || typeof opt == 'undefined') 2639 try { 2640 _[i].slick = new Slick(_[i], opt); 2641 } catch (e) { 2642 console.log(e); 2643 } 2644 2645 else 2646 ret = _[i].slick[opt].apply(_[i].slick, args); 2647 if (typeof ret != 'undefined') return ret; 2648 } 2649 return _; 2650 }; 2651 2652})); 2653 2654var ShopOnline = function (window, $) { 2655 var viewportWidth = (function () { 2656 if (window.Modernizr.touch) { 2657 return function () { 2658 return $(window).width(); 2659 }; 2660 } else { 2661 if (navigator.userAgent.match(/safari/i) && !navigator.userAgent.match(/chrome/i)) { 2662 return function () { 2663 return document.documentElement.clientWidth; 2664 }; 2665 } else { 2666 return function () { 2667 return window.innerWidth || document.documentElement.clientWidth; 2668 }; 2669 } 2670 } 2671 })(); 2672 2673 var viewportHeight = (function () { 2674 if (window.Modernizr.touch) { 2675 return function () { 2676 return $(window).height(); 2677 }; 2678 } else { 2679 if (navigator.userAgent.match(/safari/i) && !navigator.userAgent.match(/chrome/i)) { 2680 return function () { 2681 return document.documentElement.clientHeight; 2682 }; 2683 } else { 2684 return function () { 2685 return window.innerHeight || document.documentElement.clientHeight; 2686 }; 2687 } 2688 } 2689 })(); 2690 2691 /* 2692 * Init home sliders 2693 */ 2694 function homeSlider() { 2695 var hSlider = $('[data-slider="home-slider"]'); 2696 if (hSlider.length === 0) { 2697 return; 2698 } 2699 2700 /* 2701 * This slider should have dots only, 2702 * arrows is no need 2703 * */ 2704 hSlider.slick({ 2705 accessibility: false, 2706 arrows: false, 2707 dots: true, 2708 autoplay: true, 2709 autoplaySpeed: 5000 2710 }); 2711 } 2712 2713 function footerSlider() { 2714 var fSlider = $('[data-slider="footer-slider"]'); 2715 if (fSlider.length === 0) { 2716 return; 2717 } 2718 2719 /* 2720 * This slider should have dots only, 2721 * arrows is no need 2722 * */ 2723 fSlider.slick({ 2724 accessibility: false, 2725 arrows: false, 2726 dots: true, 2727 autoplay: true, 2728 autoplaySpeed: 5000 2729 }); 2730 } 2731 2732 /* 2733 * Init menu select sliders 2734 */ 2735 function menuSelectSlider() { 2736 var self = this, 2737 sliderWrap = $('.menu-slider-block'), 2738 cartWrap = $('.cart-block'), 2739 //cartContentWrap = $('.cart-block #content-cart'), 2740 colWrap = sliderWrap.parent(), 2741 win = $(window); 2742 self.options = { 2743 accessibility: false, 2744 arrows: true, 2745 dots: false, 2746 infinite: true, 2747 slidesToShow: 5, 2748 slidesToScroll: 5, 2749 };
2750 self.msSlider = $('[data-slider="menu-select-slider"]'); 2751 if (self.msSlider.length === 0) { 2752 return; 2753 } 2754 2755 /* 2756 * This slider should show 5 items for each view 2757 * have arrows 2758 * */ 2759 win.on('scroll.initMenuSelectSlider', function () { 2760 var headerInner = $('#header .inner'), 2761 headerContainer = $('header .container-fluid'); 2762 if (viewportWidth() >= 992) { 2763 if (win.scrollTop() > colWrap.offset().top - headerContainer.height()) { 2764 sliderWrap.addClass('sticky'); 2765 headerInner.addClass('sticky'); 2766 //cartWrap.addClass('cart-block-sticky'); 2767 //cartContentWrap.addClass('content-cart-sticky'); 2768 self.options.slidesToShow = 4; 2769 self.options.slidesToScroll = 4; 2770 } 2771 else { 2772 sliderWrap.removeClass('sticky'); 2773 headerInner.removeClass('sticky'); 2774 //cartWrap.removeClass('cart-block-sticky'); 2775 //cartContentWrap.removeClass('content-cart-sticky'); 2776 self.options.slidesToShow = 5; 2777 self.options.slidesToScroll = 5; 2778 } 2779 if (self.msSlider.hasClass('slick-initialized')) { 2780 self.msSlider.slick('unslick'); 2781 } 2782 self.msSlider.slick(self.options); 2783 } 2784 else { 2785 $('#header .navbar-toggle').toggleClass('sticky', $(window).scrollTop() > colWrap.offset().top - headerContainer.height()); 2786 $('#header .cart').toggleClass('sticky', $(window).scrollTop() > colWrap.offset().top - headerContainer.height()); 2787 $('#header .brand-name').toggleClass('sticky', $(window).scrollTop() >= colWrap.offset().top - headerContainer.height()); 2788 } 2789 }).trigger('scroll.initMenuSelectSlider'); 2790 } 2791 menuSelectSlider.prototype.config = function (options) { 2792 2793 $.extend(this.options, options); 2794 this.msSlider.slick(this.options); 2795 }; 2796 2797 /* 2798 * Init Food Menu sliders 2799 * */ 2800 function menuSlider() { 2801 var mSlider = $('[data-slider="menu-slider"]'), 2802 win = $(window); 2803 2804 if (mSlider.length === 0) { 2805 return; 2806 } 2807 2808 /* 2809 * This slider should show 3 items for each view 2810 * for SM screen (768 - 992): show 2 items 2811 * for XS screen (below 768): show 1 item 2812 * */ 2813 2814 win.on('resize.initMSlick', function () { 2815 if (viewportWidth() < 768) { 2816 if (mSlider.hasClass('slick-initialized')) { 2817 mSlider.slick('unslick'); 2818 } 2819 } 2820 else { 2821 if (!mSlider.hasClass('slick-initialized')) { 2822 mSlider.slick({ 2823 accessibility: false, 2824 arrows: false, 2825 dots: true, 2826 infinite: true, 2827 slidesToShow: 3, 2828 slidesToScroll: 3, 2829 responsive: [ 2830 { 2831 breakpoint: 992, 2832 settings: { 2833 slidesToShow: 3, 2834 slidesToScroll: 3 2835 } 2836 }, 2837 { 2838 breakpoint: 768, 2839 settings: 'unslick' 2840 } 2841 ] 2842 }); 2843 } 2844 } 2845 }).trigger('resize.initMSlick'); 2846 } 2847 2848 function initRightBar() { 2849 var rightBar = $('.cart-block'), 2850 rightBarWrap = rightBar.parent(), 2851 footer = $('#footer'), 2852 header = $('#header'), 2853 win = $(window), 2854 sliderBlockWrap = $('.menu-slider-block').parent(); 2855 2856 if (rightBar.length === 0) { 2857 return; 2858 } 2859 win.on('scroll.initRightBarPos', function () { 2860 if (viewportWidth() >= 992) { 2861 //var headerHeight = header.outerHeight(), 2862 // footerOffsetTop = footer.offset().top, 2863 // scrollTop = $(this).scrollTop(), 2864 // rightBarHeight, 2865 // topFixedPos; 2866 //if (rightBar.length) { 2867 // rightBarHeight = rightBar.outerHeight(); 2868 //} 2869 //if (sliderBlockWrap.length) { 2870 // //topFixedPos = sliderBlockWrap.offset().top; 2871 // var sliderBlockHeight = sliderBlockWrap.outerHeight(); 2872 // if (sliderBlockHeight > 0) { 2873 // topFixedPos = "587"; 2874 // } else { 2875 // topFixedPos = sliderBlockWrap.offset().top; 2876 // } 2877 //} 2878 //if (scrollTop >= topFixedPos - headerHeight) { 2879 // rightBar.css({ position: 'fixed', top: headerHeight + 'px' }); 2880 // if (scrollTop + headerHeight + rightBarHeight >= footerOffsetTop) { 2881 // rightBar.css({ 2882 // position: 'absolute', 2883 // top: footerOffsetTop - rightBarHeight - rightBarWrap.offset().top 2884 // }); 2885 // } 2886 //} 2887 //else { 2888 // rightBar.css({ position: 'inherit', top: 'inherit' }); 2889 //} 2890 } 2891 else { 2892 rightBar.css({ position: '', top: '' }); 2893 } 2894 win.trigger('resize.setHeightRightBar'); 2895 }); 2896 } 2897 2898 function setHeightRightBar() { 2899 var rightBar = $('.cart-block'), 2900 rightBarTop = $('.nav-tabs', rightBar), 2901 rightBarTotalPriceBlock1 = $('.total-price-block-1', rightBar), 2902 rightBarBottom = $('.total-price-block', rightBar), 2903 tabContentWrap = $('.tab-content', rightBar), 2904 content = $('[data-main-content]', rightBar), 2905 orderList = $('.order-list', content), 2906 activeContent, 2907 activeContentH, 2908 maxHeightContent, 2909 bottomHeight, 2910 win = $(window), 2911 heightCartPrice, 2912 heightCartCheckout, 2913 heightScrollTop = $(window).scrollTop(), 2914 topPos = 159; 2915 if (rightBar.length === 0) { 2916 return; 2917 } 2918 win.on('resize.setHeightRightBar', function () { 2919 orderList.css('padding-bottom', ''); 2920 content.css('height', ''); 2921 activeContent = content.filter(':visible'); 2922 bottomHeight = rightBarBottom.filter(':visible').outerHeight();
2923 maxHeightContent = viewportHeight() - rightBarTop.height() - bottomHeight; 2924 2925 heightCartPrice = $('#content-cart-price').height(); 2926 heightCartCheckout = $('#content-cart-checkout').height(); 2927 heightCartInforBlock = $('#content-cart .cart-info-block').height(); 2928 2929 if (!$('#content-cart-price').hasClass('hidden') && isGroupOrdering == false && isGroupOrderingMode == false && isAmendMore == false && heightCartPrice < 24) { 2930 heightCartPrice = 24; 2931 } 2932 else if (heightCartPrice < 0) { 2933 heightCartPrice = 0; 2934 } 2935 2936 //var mainSectionHeight = $("#main").height(), 2937 // headerHeight = $('#header').outerHeight(), 2938 // bodyHeight = $('#bodyMain').outerHeight(), 2939 // footerHeight = $('#footer').outerHeight(), 2940 // rightBarTopHeight = rightBarTop.outerHeight(), 2941 // rightBarTotalPriceBlock1Height = rightBarTotalPriceBlock1.outerHeight(), 2942 // rightBarBottomHeight = rightBarBottom.outerHeight(), 2943 // cartBlockTop = rightBar.offset().top; 2944 //var all_product_Height = 0; 2945 var content_cart_Height = 0; 2946 if (viewportWidth() > 991) { 2947 let headerInnerHeight = $('#header .inner').height(); 2948 if ($("#collapseOne").hasClass("in")) { 2949 content_cart_Height = $(window).height() - heightCartCheckout - 107 - headerInnerHeight; 2950 if ($('#content-cart').height() != content_cart_Height) { 2951 if (typeof isMerchantOS === 'undefined') { 2952 if (content_cart_Height > 550) { 2953 content_cart_Height = 550; 2954 } 2955 else if (content_cart_Height < 350) { 2956 content_cart_Height = 350; 2957 } 2958 } 2959 else { 2960 if (content_cart_Height < 350) { 2961 content_cart_Height = 350; 2962 } 2963 else { 2964 content_cart_Height += 35; 2965 2966 if (content_cart_Height > window.innerHeight) { 2967 content_cart_Height = window.innerHeight; 2968 } 2969 } 2970 } 2971 2972 $('#content-cart').attr('style', 'height: ' + content_cart_Height + 'px;'); 2973 $('#box-content-cart').attr('style', 'height: ' + (content_cart_Height - heightCartPrice) + 'px;'); 2974 } 2975 } 2976 else { 2977 content_cart_Height = $(window).height() - heightCartPrice - heightCartCheckout - 83 - headerInnerHeight; 2978 2979 if (isFacebookApp() === true && !ios) { 2980 $("html").addClass("padding-bottom-50"); 2981 content_cart_Height -= iosHeight; 2982 } 2983 else if (ios && !standalone && !safari && navigator.userAgent.match(/instagram/i)) { 2984 $("html").addClass("padding-bottom-50"); 2985 content_cart_Height -= iosHeight; 2986 } 2987 else { 2988 $("html").removeClass("padding-bottom-50"); 2989 } 2990 2991 if ($('#content-cart').height() != content_cart_Height) { 2992 if (typeof isMerchantOS === 'undefined') { 2993 if (content_cart_Height > 550) { 2994 content_cart_Height = 550; 2995 } 2996 else if (content_cart_Height < 350) { 2997 content_cart_Height = 350; 2998 } 2999 } 3000 else { 3001 if (content_cart_Height < 350) { 3002 content_cart_Height = 350; 3003 } 3004 else { 3005 content_cart_Height += 35; 3006 3007 if (content_cart_Height > window.innerHeight) { 3008 content_cart_Height = window.innerHeight; 3009 } 3010 } 3011 } 3012
3013 $('#content-cart').attr('style', 'height: ' + content_cart_Height + 'px;'); 3014 $('#box-content-cart').attr('style', 'height: ' + (content_cart_Height - 15) + 'px;'); 3015 } 3016 } 3017 3018 //maxHeightContent -= topPos; 3019 //activeContent.css({ 3020 // 'overflow-y': 'auto', 3021 // 'max-height': maxHeightContent 3022 //}); 3023 //activeContentH = activeContent.outerHeight(); 3024 //if (activeContentH < maxHeightContent) { 3025 // $('.order-list', activeContent).css('padding-bottom', maxHeightContent - activeContentH); 3026 // activeContent.css('height', maxHeightContent); 3027 //} 3028 //if (mainSectionHeight < cartBlockTop + maxHeightContent + footerHeight) { 3029 // maxHeightContent = maxHeightContent - footerHeight; 3030 // var height = maxHeightContent - (rightBarTotalPriceBlock1Height + topPos - 9); 3031 // $('.order-list', activeContent).css('padding-bottom', height); 3032 // activeContent.css('height', maxHeightContent); 3033 //} 3034 } else { 3035 //$('.cart-block').height(viewportHeight()); 3036 $('.cart-block').css("height", "100%"); 3037 if (tabContentWrap.height() < viewportHeight() - rightBarTop.height()) { 3038 //$('.order-list', activeContent).css('padding-bottom', viewportHeight() - rightBarTop.height() - tabContentWrap.height()); 3039 activeContent.css({ 3040 'overflow-y': '', 3041 'height': maxHeightContent - heightCartPrice 3042 }); 3043 } else { 3044 activeContent.css({ 3045 'overflow-y': 'auto', 3046 'height': maxHeightContent - heightCartPrice 3047 }); 3048 } 3049 var ua = navigator.userAgent.toLowerCase(); 3050 if (ua.indexOf("android") > -1) { 3051 activeContent.css({ 3052 'min-height': maxHeightContent - 24, 3053 }); 3054 var positionCartBlock = $('.cart-block').position(); 3055 if (positionCartBlock && positionCartBlock.top <= -160) { 3056 $('.cart-block').attr('style', 'top: 161px!important'); 3057 } 3058 } 3059 let mobileTab = 0; 3060 if (heightCartPrice > 0 && $("#collapseOne").hasClass("in")) { 3061 mobileTab = 10; 3062 } 3063 3064 var heightAdditionalRequestCart = $('#info-total-cart .additional-request').height(); 3065 var pwaNavOffset = (typeof window.getPwaBottomNavOffset === 'function') ? window.getPwaBottomNavOffset() : 0; 3066 content_cart_Height = $(window).height() - heightCartPrice - heightCartCheckout - 35 - mobileTab - heightAdditionalRequestCart - pwaNavOffset; 3067 3068 if (isFacebookApp() === true && !ios) { 3069 $("html").addClass("padding-bottom-50"); 3070 content_cart_Height -= iosHeight; 3071 } 3072 else if (ios && !standalone && !safari && navigator.userAgent.match(/instagram/i)) { 3073 $("html").addClass("padding-bottom-50"); 3074 content_cart_Height -= iosHeight; 3075 } 3076 else { 3077 $("html").removeClass("padding-bottom-50"); 3078 } 3079 3080 if (content_cart_Height < 0) content_cart_Height = 0; 3081 if ($('#content-cart').height() != content_cart_Height) { 3082 $('#content-cart').attr('style', 'height: ' + content_cart_Height + 'px;'); 3083 $('#box-content-cart').attr('style', 'height: ' + content_cart_Height + 'px;'); 3084 } 3085 } 3086 3087 }).trigger('resize.setHeightRightBar'); 3088 3089 $('[data-toggle="tab"]', rightBar).on('click.changeTab', function () { 3090 tabContentWrap.css('opacity', 0); 3091 setTimeout(function () { 3092 $(window).trigger('scroll.initRightBarPos'); 3093 tabContentWrap.animate({ 3094 'opacity': 1 3095 }, 100); 3096 }, 100); 3097 }); 3098 } 3099 3100 var aaa = -1; 3101 function fullHeightItem() { 3102 var win = $(window); 3103 $('[data-full-height-block]').each(function () { 3104 var block = $(this), 3105 allItem = $('[data-full-height-item]', block), 3106 itemPerRow = block.data('item-per-row'); 3107 3108 win.on('resize.setFullHeight', function () { 3109 allItem.height(''); 3110 if (viewportWidth() >= 768) { 3111 var maxHeight = 0, 3112 listItem = null; 3113 for (var i = 0, l = allItem.length; i < l; i++) { 3114 var item = allItem.eq(i), 3115 itemH = item.height(); 3116 if (itemH > maxHeight) { 3117 maxHeight = itemH; 3118 } 3119 if (!listItem) { 3120 listItem = item; 3121 } else { 3122 listItem = listItem.add(item); 3123 } 3124 if (i === l - 1) { 3125 aaa++; 3126 //console.log(aaa); 3127 listItem.height(maxHeight); 3128 maxHeight = 0; 3129 listItem = null; 3130 } 3131 } 3132 } 3133 }).trigger('resize.setFullHeight'); 3134 }); 3135 } 3136 3137 function setHeightItem(block) { 3138 //setTimeout(function () { 3139 var allItem = $('[data-full-height-item]', block), 3140 itemPerRow = block.data('item-per-row'); 3141 3142 allItem.height(''); 3143 if (viewportWidth() >= 768) { 3144 var maxHeight = 0, 3145 listItem = null; 3146 for (var i = 0, l = allItem.length; i < l; i++) { 3147 var item = allItem.eq(i), 3148 itemH = item.height(); 3149 if (itemH > maxHeight) { 3150 maxHeight = itemH; 3151 } 3152 if (!listItem) { 3153 listItem = item; 3154 } else { 3155 listItem = listItem.add(item); 3156 } 3157 if (i % itemPerRow === 2 || i === l - 1) { 3158 listItem.height(maxHeight); 3159 maxHeight = 0; 3160 listItem = null; 3161 } 3162 } 3163 } 3164 //}, 3000); 3165 } 3166 3167 return { 3168 viewportWidth: viewportWidth,
3169 viewportHeight: viewportHeight, 3170 homeSlider: homeSlider, 3171 menuSlider: menuSlider, 3172 menuSelectSlider: menuSelectSlider, 3173 initRightBar: initRightBar, 3174 setHeightRightBar: setHeightRightBar, 3175 fullHeightItem: fullHeightItem, 3176 footerSlider: footerSlider 3177 }; 3178}; 3179 3180(function (window, $) { 3181 /* 3182 * Call new ShopOnline instance 3183 * */ 3184 var isAndroidNativeBrowser = navigator.userAgent.match(/Android/i) && navigator.userAgent.match(/Safari/i); 3185 var duration = isAndroidNativeBrowser ? 250 : 0; 3186 var shopOnline = new ShopOnline(window, $); 3187 3188 /* 3189 * Execute Shop Online functions 3190 * */ 3191 //shopOnline.homeSlider(); 3192 //shopOnline.menuSlider(); 3193 //shopOnline.menuSelectSlider(); 3194 //shopOnline.initRightBar(); 3195 //shopOnline.setHeightRightBar(); 3196 //shopOnline.fullHeightItem(); 3197 3198 function openMenu() { 3199 if (shopOnline.viewportWidth() < 992) { 3200 if (!$('body').hasClass('open-menu')) { 3201 //$(window).scrollTop(0); 3202 $('#header .navbar-toggle, #header .cart, #header .brand-name').removeClass('sticky-mb').css('position', 'relative'); 3203 setTimeout(function () { 3204 $('body').addClass('open-menu'); 3205 $('#menu-mb').css({ 'transform': 'translateX(0)', '-webkit-transform': 'translateX(0)' }); 3206 $('#wrapper').css({ 'overflow-y': 'hidden' }); 3207 $('html, body, #wrapper').css({ 'height': '100%' }); 3208 $('#menu-mb').height(shopOnline.viewportHeight()); 3209 }, duration); 3210 } else { 3211 $('body').removeClass('open-menu'); 3212 $('#menu-mb').css({ 'transform': 'translateX(-101%)', '-webkit-transform': 'translateX(-101%)' }); 3213 $('#wrapper').css({ 'overflow-y': 'auto' }); 3214 $('html, body, #wrapper').css({ 'height': 'auto' }); 3215 $('#menu-mb').height('auto'); 3216 } 3217 } 3218 } 3219 function openCart() { 3220 if (shopOnline.viewportWidth() < 992) { 3221 if (!$('body').hasClass('open-cart')) { 3222 scrTop = $(window).scrollTop(); 3223 //if ($('#hdCartFooterCollapse').val() != 'in') { 3224 //$(window).scrollTop(0); 3225 //} 3226 $('#header .navbar-toggle, #header .cart, #header .brand-name').removeClass('sticky-mb').css('position', 'relative'); 3227 setTimeout(function () { 3228 $('#wrapper').css({ 'overflow-y': 'hidden' }); 3229 $('html, body, #wrapper').css({ 'height': '100%' }); 3230 3231 var viewportHeight = shopOnline.viewportHeight(); 3232 3233 if (isFacebookApp() === true && !ios) { 3234 $("html").addClass("padding-bottom-50"); 3235 viewportHeight -= iosHeight; 3236 } 3237 else if (ios && !standalone && !safari && navigator.userAgent.match(/instagram/i)) { 3238 $("html").addClass("padding-bottom-50"); 3239 viewportHeight -= iosHeight; 3240 } 3241 //else if (ios && !standalone && !safari && navigator.userAgent.match(/instagram/i)) { 3242 // $("html").addClass("padding-bottom-50"); 3243 // if (topHeaderScroll < 43) { 3244 // $("html").addClass("padding-bottom-100").removeClass("padding-top-50"); 3245 // } else { 3246 3247 // $("html").addClass("padding-top-50").removeClass("padding-bottom-100"); 3248 // } 3249 // viewportHeight -= iosHeight; 3250 //} 3251 else { 3252 $("html").removeClass("padding-bottom-50"); 3253 } 3254 3255 $('.cart-block').height(viewportHeight); 3256 3257 var heightOfContent = $('#content-cart .cart-info-block.bg-pink').height(); 3258 if (heightOfContent) { 3259 heightOfContent = heightOfContent + 9; 3260 var width = $(window).width(); 3261 if (isMobile.any() && width < 1024) { 3262 if (heightOfContent < 177) { 3263 heightOfContent = 258; 3264 } 3265 $('.open-cart #header .cart').attr('style', 'he
3265ight:' + 0 + 'px');//heightOfContent.toString() 3266 3267 var mycartcountheight = heightOfContent; 3268 var mycarticonheight = $('#my-cart-count .fa-arrow-left span').width(); 3269 3270 var heights = mycartcountheight - 20; 3271 heights = heights / 2; 3272 $('#my-cart-count .fa-arrow-left span').attr('style', 'top:' + 0 + 'px !important'); 3273 } 3274 } 3275 3276 var heightCartPrice = $('#content-cart-price').height(); 3277 var heightCartCheckout = $('#content-cart-checkout').height(); 3278 var maxHeightContent = $(window).height() - heightCartPrice - heightCartCheckout - 33; 3279 3280 //$('#content-cart').height(maxHeightContent); 3281 //if ($('#content-cart').height() != maxHeightContent) { 3282 // $('#content-cart').removeAttr('style'); 3283 // $('#content-cart').attr('style', ';height: ' + maxHeightContent + 'px;'); 3284 //} 3285 $('body').addClass('open-cart'); 3286 3287 setTimeout(function () { 3288 $('html, body').addClass('overflow-hidden'); 3289 $('body').addClass('open-cart-color'); 3290 }, 350); 3291 }, duration); 3292 3293 3294 } else { 3295 $('.open-cart #header .cart').removeAttr('style'); 3296 $('body').removeClass('open-cart open-cart-color'); 3297 $('html, body').removeClass('overflow-hidden'); 3298 $('#header .navbar-toggle, #header .cart, #header .brand-name').css('position', ''); 3299 $('#wrapper').css({ 'overflow-y': 'auto' }); 3300 $('html, body, #wrapper').css({ 'height': 'auto' }); 3301 $('.cart-block').height('auto'); 3302 3303 $("#scroll-top").css("bottom", $("#show-progress-bar-when-add-item").height() + $(".homepage-cart-button-display").innerHeight() + 10);
3304 } 3305 } 3306 } 3307 3308 //function closeCart() { 3309 // if (ios && !standalone && !safari && navigator.userAgent.match(/instagram/i)) { 3310 // $("html").removeClass("padding-bottom-100 padding-top-50"); 3311 // } 3312 //} 3313 3314 function removeOpenClass() { 3315 if (shopOnline.viewportWidth() > 991) { 3316 $('body').removeClass('open-menu'); 3317 $('#header .navbar-toggle, #header .cart, #header .brand-name').css('position', ''); 3318 $('#wrapper').css({ 'overflow-y': 'auto' }); 3319 $('html, body, #wrapper, #container').css({ 'height': 'auto' }); 3320 } 3321 else { 3322 $(window).trigger('scroll.sticky'); 3323 } 3324 } 3325 3326 function removeOpenCart() { 3327 if (shopOnline.viewportWidth() > 991) { 3328 $('body').removeClass('open-cart'); 3329 $('#header .navbar-toggle, #header .cart, #header .brand-name').css('position', ''); 3330 $('#wrapper').css({ 'overflow-y': 'auto' }); 3331 $('html, body, #wrapper, #container, .cart-block').css({ 'height': 'auto' }); 3332 } 3333 } 3334 3335 $('.navbar-toggle').click(openMenu); 3336 $('.menu__cart').click(openCart); 3337 //$('#mobile-tab .back-to-menu').click(closeCart); 3338 3339 $(window).resize(removeOpenClass); 3340 $(window).resize(removeOpenCart); 3341 3342 $(window).on('scroll.sticky', function () { 3343 if (shopOnline.viewportWidth() < 992) { 3344 $('.dropdown-2').toggleClass('sticky', $(window).scrollTop() > 0); 3345 //$('#header .navbar-toggle, #header .cart, #header .brand-name').toggleClass('sticky-mb', $(window).scrollTop() > 10); 3346 $('#my-cart-dine-in-ordering').toggleClass('sticky', $(window).scrollTop() > 10); 3347 } 3348 }); 3349 3350 var navU = navigator.userAgent; 3351 3352 // Android Mobile 3353 var isAndroidMobile = navU.indexOf('Android') > -1 && navU.indexOf('Mozilla/5.0') > -1 && navU.indexOf('AppleWebKit') > -1; 3354 3355 // Apple webkit 3356 var regExAppleWebKit = new RegExp(/AppleWebKit\/([\d.]+)/); 3357 var resultAppleWebKitRegEx = regExAppleWebKit.exec(navU); 3358 var appleWebKitVersion = (resultAppleWebKitRegEx === null ? null : parseFloat(regExAppleWebKit.exec(navU)[1])); 3359 3360 // Chrome 3361 var regExChrome = new RegExp(/Chrome\/([\d.]+)/); 3362 var resultChromeRegEx = regExChrome.exec(navU); 3363 var chromeVersion = (resultChromeRegEx === null ? null : parseFloat(regExChrome.exec(navU)[1])); 3364 3365 // Native Android Browser 3366 var isAndroidBrowser = isAndroidMobile && (appleWebKitVersion !== null && appleWebKitVersion < 537) || (chromeVersion !== null && chromeVersion < 37); 3367 3368 if (isAndroidBrowser) { 3369 $('html').addClass('android-native'); 3370 } 3371 3372})(window, jQuery, undefined);
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.