vendor: 4,265 bytes, lines 1-125
1/******/ (function(modules) { // webpackBootstrap 2/******/ // The module cache 3/******/ var installedModules = {}; 4/******/ 5/******/ // The require function 6/******/ function __webpack_require__(moduleId) { 7/******/ 8/******/ // Check if module is in cache 9/******/ if(installedModules[moduleId]) { 10/******/ return installedModules[moduleId].exports; 11/******/ } 12/******/ // Create a new module (and put it into the cache) 13/******/ var module = installedModules[moduleId] = { 14/******/ i: moduleId, 15/******/ l: false, 16/******/ exports: {} 17/******/ }; 18/******/ 19/******/ // Execute the module function 20/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); 21/******/ 22/******/ // Flag the module as loaded 23/******/ module.l = true; 24/******/ 25/******/ // Return the exports of the module 26/******/ return module.exports; 27/******/ } 28/******/ 29/******/ 30/******/ // expose the modules object (__webpack_modules__) 31/******/ __webpack_require__.m = modules; 32/******/ 33/******/ // expose the module cache 34/******/ __webpack_require__.c = installedModules; 35/******/ 36/******/ // identity function for calling harmony imports with the correct context 37/******/ __webpack_require__.i = function(value) { return value; }; 38/******/ 39/******/ // define getter function for harmony exports 40/******/ __webpack_require__.d = function(exports, name, getter) { 41/******/ if(!__webpack_require__.o(exports, name)) { 42/******/ Object.defineProperty(exports, name, { 43/******/ configurable: false, 44/******/ enumerable: true, 45/******/ get: getter 46/******/ }); 47/******/ } 48/******/ }; 49/******/ 50/******/ // getDefaultExport function for compatibility with non-harmony modules 51/******/ __webpack_require__.n = function(module) { 52/******/ var getter = module && module.__esModule ? 53/******/ function getDefault() { return module['default']; } : 54/******/ function getModuleExports() { return module; }; 55/******/ __webpack_require__.d(getter, 'a', getter); 56/******/ return getter; 57/******/ }; 58/******/ 59/******/ // Object.prototype.hasOwnProperty.call 60/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; 61/******/ 62/******/ // __webpack_public_path__ 63/******/ __webpack_require__.p = ""; 64/******/ 65/******/ // Load entry module and return exports 66/******/ return __webpack_require__(__webpack_require__.s = 8); 67/******/ }) 68/************************************************************************/ 69/******/ ([ 70/* 0 */ 71/***/ (function(module, exports, __webpack_require__) { 72 73"use strict"; 74 75 76// to check if main.js is loaded in the browser at all 77// console.info('Let the games begin - Hello main.js! :)'); 78 79// import some (vendor) libs 80// import $ from 'jquery'; 81// import Foundation from 'foundation-sites'; 82 83var _vanillaLazyload = __webpack_require__(5); 84 85var _vanillaLazyload2 = _interopRequireDefault(_vanillaLazyload); 86 87var _viewportUnitsBuggyfill = __webpack_require__(6); 88 89var _viewportUnitsBuggyfill2 = _interopRequireDefault(_viewportUnitsBuggyfill); 90 91var _smoothScroll = __webpack_require__(4); 92 93var _smoothScroll2 = _interopRequireDefault(_smoothScroll); 94 95var _GlideSlider = __webpack_require__(3); 96 97var _GlideSlider2 = _interopRequireDefault(_GlideSlider); 98 99var _EventsMap = __webpack_require__(2); 100 101var _EventsMap2 = _interopRequireDefault(_EventsMap); 102 103function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 104 105// let's create our own instance and say something 106// let start = new myGreeter(); 107 108 109// TODO: crop BMWi JS into modules and include smaller files here instead of one 22k lines monster - remove it from TS again, then 110// import bmwiLib from './vendor/bmwi.production'; 111 112 113// import / include the class definition 114// import myGreeter from './modules/Greet.js'; 115var myGlideSlider = new _GlideSlider2.default(); 116var myEventsMap = new _EventsMap2.default(); 117 118/** 119 * 120 * Let the games begin! This is the very entry point of our app / website js. 121 * 122 * 123 */ 124 125// see http://gregfranko.com/jquery-best-practices/#/4 - TODO: maybe tr
125y an IIFE (Immediately Invoked Function Expression) approach 126$(function () { 127 //console.log('jquery test in main.js'); 128 129 // if load the page, check the position of scrollbar and add or delete the class 'header-small' 130 $(window).load(function () { 131 if ($(this).scrollTop() > 100 && $(this).width() > 768) { 132 $('.header-animated').addClass('header-small'); 133 } else if ($(this).width() > 768) { 134 $('.header-animated').removeClass('header-small'); 135 } 136 }); 137 138 // corrected position of right column 139 if ($('.multi_content_left').length && $('.multi_content_right').length) { 140 $('.multi_content_right').css('margin-top', $('.multi_content_left header h1').outerHeight(true) + 'px'); 141 } 142 143 // active smaller sticky header if scroll down 100px 144 $(window).scroll(function () { 145 if ($(this).scrollTop() > 100 && $(this).width() > 768) { 146 $('.header-animated').addClass('header-small'); 147 } else if ($(this).width() > 768) { 148 $('.header-animated').removeClass('header-small'); 149 } 150 }); 151 152 // active smaller sticky header in tablet and mobile 153 $(window).resize(function () { 154 if ($(window).width() <= 768) { 155 $('.header-animated').addClass('header-small'); 156 } else { 157 $('.header-animated').removeClass('header-small'); 158 } 159 }); 160 161 // click to open and close the search form in header to focus input 162 $('.main-navbar-item-search-open').click(function () { 163 $(this).parents('li').toggleClass('open'); 164 $('#navigation').toggleClass('open'); 165 $('#header-search__input').focus(); 166 }); 167 168 $('#header-search__input').blur(function () { 169 if ($(".main-navbar-search-submit").is(":active")) { 170 console.log("Blur: open search"); 171 return true; 172 } else { 173 $(this).parents('li').removeClass('open'); 174 $('#navigation').removeClass('open'); 175 console.log("Blur: delete class"); 176 } 177 }); 178 179 // click to open the subnavi of standart.html 180 $('.btn-subnav-scroll').click(function () { 181 $(this).toggleClass('expanded'); 182 $('.subnav__item a').toggleClass('expanded'); 183 return false; 184 }); 185 186 // click to open the main menu 187 $('#navigation .main-navbar-open').click(function () { 188 $('#main-menu-container').addClass('is-main-menu-open'); 189 $('#navigation').addClass('is-main-menu-open'); 190 $('body').addClass('is-main-menu-open'); 191 return false; 192 }); 193 194 //click to close the main menu 195 $('#navigation .main-navbar-close').click(function () { 196 $('#main-menu-container').removeClass('is-main-menu-open'); 197 $('#navigation').removeClass('is-main-menu-open'); 198 $('body').removeClass('is-main-menu-open'); 199 return false; 200 }); 201 202 // click to open the main header 203 $('.header__hero-nav-elements .main-navbar-open').click(function () { 204 $('#navigation .main-navbar-open').trigger('click'); 205 return false; 206 }); 207 208 // click to scroll to main container in Home.html 209 $('.intro__btn-icon').click(function () { 210 $('html, body').animate({ 211 scrollTop: $(this).parents('.intro').next().offset().top - 100 212 }, 700); 213 }); 214 215 // hidden the subnavi, if the element is empty 216 if ($('#subnav-scroll').find('li').length == 0) { 217 $('#subnav-scroll').hide(); 218 } 219 220 // slider news in header 221 var isPaused = false; 222 223 $('.button__pause').click(function () { 224 isPaused = true; 225 $('.button__pause').hide(); 226 $('.button__play').show(); 227 }); 228 229 $('.button__play').click(function () { 230 isPaused = false; 231 $('.button__play').hide(); 232 $('.button__pause').show(); 233 }); 234 235 $('.button__next').click(function () { 236 if ($('.container--koinno_newslatest').find('.card-is-linked').last().hasClass('open')) { 237 $('.container--koinno_newslatest').find('.open').removeClass('open'); 238 $('.container--koinno_newslatest').find('.card-is-linked').first().addClass('open'); 239 } else { 240 $('.container--koinno_newslatest').find('.open').removeClass('open').next().addClass('open'); 241 } 242 }); 243 244 $('.button__prev').click(function () { 245 if ($('.container--koinno_newslatest').find('.card-is-linked').first().hasClass('open')) { 246 $('.container--koinno_newslatest').find('.open').removeClass('open'); 247 $('.container--koinno_newslatest').find('.card-is-linked').last().addClass('open'); 248 } else { 249 $('.container--koinno_newslatest').find('.open').removeClass('open').prev().addClass('open'); 250 } 251 }); 252 253 function sliderLastNews() { 254 255 var newsItems = $('.container--koinno_newslatest'); 256 257 if (newsItems.find('.open').length == 0 || newsItems.find('.card-is-linked').last().hasClass('open')) { 258 newsItems.find('.open').removeClass('open'); 259 newsItems.find('.card-is-linked').first().addClass('open'); 260 } else { 261 newsItems.find('.open').removeClass('open').next().addClass('open'); 262 } 263 } 264 // initial slider news 265 sliderLastNews(); 266 267 // repeat per 5 seconds 268 setInterval(function () { 269 if (!isPaused) { 270 sliderLastNews(); 271 } 272 }, 7000); 273 274 // Gallery Image: Bxslider js with Modal function of Bootstrap 275 276 // Init bxSlider 277 var bxSlider = $('.bxslider').bxSlider({ 278 pager: true, 279 touchEnabled: false, 280 captions: true, 281 slideWidth: 350, 282 slideMargin: 10,
283 minSlides: 1, 284 maxSlides: 3, 285 moveSlides: 1 286 }); 287 288 // Init bxSlider overlay 289 var bxSliderOverlay = $('.bxslider-overlay').bxSlider({ 290 pager: true, 291 touchEnabled: false, 292 captions: true 293 }); 294 295 // init current slider img 296 var currentBxSlider = 0; 297 298 $('.bxslider-span').click(function () { 299 // update current slider img 300 currentBxSlider = $(this).data('toClick'); 301 }); 302 303 // if loaded overlay then reload bxslider overlay with the current position 304 $('#bxslider-modal').on('shown.bs.modal', function () { 305 306 bxSliderOverlay.reloadSlider({ 307 pager: true, 308 touchEnabled: false, 309 captions: true, 310 startSlide: --currentBxSlider 311 }); 312 }); 313 314 // if closed bxslider overlay then update current position in bxslider standart 315 $('#bxslider-modal').on('hidden.bs.modal', function () { 316 bxSlider.goToSlide(bxSliderOverlay.getCurrentSlide()); 317 }); 318 319 //multiselect - fastselect 320 jQuery(document).ready(function () { 321 $(function () { 322 $('#my-select').searchableOptionList(); 323 $('#my-select_2').searchableOptionList(); 324 $('#my-select_3').searchableOptionList(); 325 }); 326 }); 327 328 // relaunch home 329 330 if (document.getElementsByClassName('page-header').length) { 331 // ignore user agent force initialization 332 // active only on tablet and mobile 333 if (window.innerWidth < 1024) { 334 _viewportUnitsBuggyfill2.default.init({ 335 force: true, 336 refreshDebounceWait: 99999999999 // refresh only once 337 }); 338 } 339 340 // init slider glide 341 myGlideSlider.init(); 342 343 // init lazyloading 344 new _vanillaLazyload2.default({ 345 elements_selector: ".lazy", 346 load_delay: 500 //adjust according to use case 347 // ... more custom settings? 348 }); 349 350 // init smooth scroll 351 new _smoothScroll2.default('a[href*="#"]', { 352 speed: 500, 353 offset: 70 // headers height on scrolling 354 }); 355 356 // open mobile navigation 357 var burgerButton = document.getElementById('menuMainButton'); 358 var pageHeader = document.getElementsByClassName('page-header')[0]; 359 360 // listen click event to burger menu 361 if (burgerButton) { 362 burgerButton.addEventListener('click', function () { 363 this.classList.toggle('open'); 364 pageHeader.classList.toggle('open'); 365 document.body.classList.toggle('not-scroll'); 366 }); 367 } 368 369 // checking scrolling and active it 370 window.addEventListener('scroll', function () { 371 var distanceY = window.pageYOffset || document.documentElement.scrollTop, 372 headerEl = document.getElementsByClassName('page-header')[0]; 373 var shrinkOn = 50; 374 375 if (distanceY > shrinkOn) { 376 headerEl.classList.add("scrolled"); 377 } else { 378 headerEl.classList.remove("scrolled"); 379 } 380 }); 381 382 // load a new placeholder for google search 383 window.addEventListener('load', function (event) { 384 if (document.documentElement.lang == 'de') { 385 document.getElementById('gsc-i-id1').placeholder = 'Suche ...'; 386 } else { 387 document.getElementById('gsc-i-id1').placeholder = 'Search ...'; 388 } 389 }); 390 } 391 392 // init eents map if exists in source 393 myEventsMap.init(); 394}); 395 396/** 397 * Do our class methods and vars work? 398 * Let's check the browser console: 399 */ 400// console.log(start.sayToConsole('yo!')); 401// Expected console output:
402// I say: yo! 403// ...and this is another line. 404 405// console.log(start.sayHelloToConsole()); 406// Expected console output: 407// Hello World! I'm an ES6 class 408 409/***/ }), 410/* 1 */ 411/***/ (function(module, __webpack_exports__, __webpack_require__) { 412 413"use strict"; 414Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); 415/*! 416 * Glide.js v3.3.0 417 * (c) 2013-2019 JÃâ¢drzej ChaĹâubek <[email protected]> (http://jedrzejchalubek.com/) 418 * Released under the MIT License. 419 */ 420 421var defaults = { 422 /** 423 * Type of the movement. 424 * 425 * Available types: 426 * `slider` - Rewinds slider to the start/end when it reaches the first or last slide. 427 * `carousel` - Changes slides without starting over when it reaches the first or last slide. 428 * 429 * @type {String} 430 */ 431 type: 'slider', 432 433 /** 434 * Start at specific slide number defined with zero-based index. 435 * 436 * @type {Number} 437 */ 438 startAt: 0, 439 440 /** 441 * A number of slides visible on the single viewport. 442 * 443 * @type {Number} 444 */ 445 perView: 1, 446 447 /** 448 * Focus currently active slide at a specified position in the track. 449 * 450 * Available inputs: 451 * `center` - Current slide will be always focused at the center of a track. 452 * `0,1,2,3...` - Current slide will be focused on the specified zero-based index. 453 * 454 * @type {String|Number} 455 */ 456 focusAt: 0, 457 458 /** 459 * A size of the gap added between slides. 460 * 461 * @type {Number} 462 */ 463 gap: 10, 464 465 /** 466 * Change slides after a specified interval. Use `false` for turning off autoplay. 467 * 468 * @type {Number|Boolean} 469 */ 470 autoplay: false, 471 472 /** 473 * Stop autoplay on mouseover event. 474 * 475 * @type {Boolean} 476 */ 477 hoverpause: true, 478 479 /** 480 * Allow for changing slides with left and right keyboard arrows. 481 * 482 * @type {Boolean} 483 */ 484 keyboard: true, 485 486 /** 487 * Stop running `perView` number of slides from the end. Use this 488 * option if you don't want to have an empty space after 489 * a slider. Works only with `slider` type and a 490 * non-centered `focusAt` setting. 491 * 492 * @type {Boolean} 493 */ 494 bound: false, 495 496 /** 497 * Minimal swipe distance needed to change the slide. Use `false` for turning off a swiping. 498 * 499 * @type {Number|Boolean} 500 */ 501 swipeThreshold: 80, 502 503 /** 504 * Minimal mouse drag distance needed to change the slide. Use `false` for turning off a dragging. 505 * 506 * @type {Number|Boolean} 507 */ 508 dragThreshold: 120, 509 510 /** 511 * A maximum number of slides to which movement will be made on swiping or dragging. Use `false` for unlimited. 512 * 513 * @type {Number|Boolean} 514 */ 515 perTouch: false, 516 517 /** 518 * Moving distance ratio of the slides on a swiping and dragging. 519 * 520 * @type {Number} 521 */ 522 touchRatio: 0.5, 523 524 /** 525 * Angle required to activate slides moving on swiping or dragging. 526 * 527 * @type {Number} 528 */ 529 touchAngle: 45, 530 531 /** 532 * Duration of the animation in milliseconds. 533 * 534 * @type {Number} 535 */ 536 animationDuration: 400, 537 538 /** 539 * Allows looping the `slider` type. Slider will rewind to the first/last slide when it's at the start/end. 540 * 541 * @type {Boolean} 542 */ 543 rewind: true, 544 545 /** 546 * Duration of the rewinding animation of the `slider` type in milliseconds. 547 * 548 * @type {Number} 549 */ 550 rewindDuration: 800, 551 552 /** 553 * Easing function for the animation. 554 * 555 * @type {String} 556 */ 557 animationTimingFunc: 'cubic-bezier(.165, .840, .440, 1)', 558 559 /** 560 * Throttle costly events at most once per every wait milliseconds. 561 * 562 * @type {Number} 563 */ 564 throttle: 10, 565 566 /** 567 * Moving direction mode. 568 * 569 * Available inputs: 570 * - 'ltr' - left to right movement, 571 * - 'rtl' - right to left movement. 572 * 573 * @type {String} 574 */ 575 direction: 'ltr', 576 577 /** 578 * The distance value of the next and previous viewports which 579 * have to peek in the current view. Accepts number and 580 * pixels as a string. Left and right peeking can be 581 * set up separately with a directions object. 582 * 583 * For example:
584 * `100` - Peek 100px on the both sides. 585 * { before: 100, after: 50 }` - Peek 100px on the left side and 50px on the right side. 586 * 587 * @type {Number|String|Object} 588 */ 589 peek: 0, 590 591 /** 592 * Collection of options applied at specified media breakpoints. 593 * For example: display two slides per view under 800px. 594 * `{ 595 * '800px': { 596 * perView: 2 597 * } 598 * }` 599 */ 600 breakpoints: {}, 601 602 /** 603 * Collection of internally used HTML classes. 604 * 605 * @todo Refactor `slider` and `carousel` properties to single `type: { slider: '', carousel: '' }` object 606 * @type {Object} 607 */ 608 classes: { 609 direction: { 610 ltr: 'glide--ltr', 611 rtl: 'glide--rtl' 612 }, 613 slider: 'glide--slider', 614 carousel: 'glide--carousel', 615 swipeable: 'glide--swipeable', 616 dragging: 'glide--dragging', 617 cloneSlide: 'glide__slide--clone', 618 activeNav: 'glide__bullet--active', 619 activeSlide: 'glide__slide--active', 620 disabledArrow: 'glide__arrow--disabled' 621 } 622}; 623 624/** 625 * Outputs warning message to the bowser console. 626 * 627 * @param {String} msg 628 * @return {Void} 629 */ 630function warn(msg) { 631 console.error("[Glide warn]: " + msg); 632} 633 634var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { 635 return typeof obj; 636} : function (obj) { 637 return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; 638}; 639 640var classCallCheck = function (instance, Constructor) { 641 if (!(instance instanceof Constructor)) { 642 throw new TypeError("Cannot call a class as a function"); 643 } 644}; 645 646var createClass = function () { 647 function defineProperties(target, props) { 648 for (var i = 0; i < props.length; i++) { 649 var descriptor = props[i]; 650 descriptor.enumerable = descriptor.enumerable || false; 651 descriptor.configurable = true; 652 if ("value" in descriptor) descriptor.writable = true; 653 Object.defineProperty(target, descriptor.key, descriptor); 654 } 655 } 656 657 return function (Constructor, protoProps, staticProps) { 658 if (protoProps) defineProperties(Constructor.prototype, protoProps); 659 if (staticProps) defineProperties(Constructor, staticProps); 660 return Constructor; 661 }; 662}(); 663 664var _extends = Object.assign || function (target) { 665 for (var i = 1; i < arguments.length; i++) { 666 var source = arguments[i]; 667 668 for (var key in source) { 669 if (Object.prototype.hasOwnProperty.call(source, key)) { 670 target[key] = source[key]; 671 } 672 } 673 } 674 675 return target; 676}; 677 678var get = function get(object, property, receiver) { 679 if (object === null) object = Function.prototype; 680 var desc = Object.getOwnPropertyDescriptor(object, property); 681 682 if (desc === undefined) { 683 var parent = Object.getPrototypeOf(object); 684 685 if (parent === null) { 686 return undefined; 687 } else { 688 return get(parent, property, receiver); 689 } 690 } else if ("value" in desc) { 691 return desc.value; 692 } else { 693 var getter = desc.get; 694 695 if (getter === undefined) { 696 return undefined; 697 } 698 699 return getter.call(receiver); 700 } 701}; 702 703var inherits = function (subClass, superClass) { 704 if (typeof superClass !== "function" && superClass !== null) { 705 throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); 706 } 707 708 subClass.prototype = Object.create(superClass && superClass.prototype, { 709 constructor: { 710 value: subClass, 711 enumerable: false, 712 writable: true, 713 configurable: true 714 } 715 }); 716 if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; 717}; 718 719var possibleConstructorReturn = function (self, call) { 720 if (!self) { 721 throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 722 } 723 724 return call && (typeof call === "object" || typeof call === "function") ? call : self; 725}; 726 727/** 728 * Converts value entered as number 729 * or string to integer value. 730 * 731 * @param {String} value 732 * @returns {Number} 733 */ 734function toInt(value) { 735 return parseInt(value); 736} 737 738/** 739 * Converts value entered as number 740 * or string to flat value. 741 * 742 * @param {String} value 743 * @returns {Number} 744 */ 745function toFloat(value) { 746 return parseFloat(value); 747} 748 749/** 750 * Indicates whether the specified value is a string. 751 * 752 * @param {*} value 753 * @return {Boolean} 754 */ 755function isString(value) { 756 return typeof value === 'string'; 757} 758 759/** 760 * Indicates whether the specified value is an object. 761 * 762 * @param {*} value 763 * @return {Boolean} 764 * 765 * @see https://github.com/jashkenas/underscore 766 */ 767function isObject(value) { 768 var type = typeof value === 'undefined' ? 'undefined' : _typeof(value); 769 770 return type === 'function' || type === 'object' && !!value; // eslint-disable-line no-mixed-operators 771} 772 773/** 774 * Indicates whether the specified value is a number. 775 * 776 * @param {*} value 777 * @return {Boolean} 778 */ 779function isNumber(value) { 780 return typeof value === 'number'; 781} 782 783/** 784 * Indicates whether the specified value is a function. 785 * 786 * @param {*} value 787 * @return {Boolean} 788 */ 789function isFunction(value) { 790 return typeof value === 'function'; 791} 792 793/** 794 * Indicates whether the specified value is undefined. 795 * 796 * @param {*} value 797 * @return {Boolean} 798 */ 799function isUndefined(value) { 800 return typeof value === 'undefined'; 801} 802 803/** 804 * Indicates whether the specified value is an array. 805 * 806 * @param {*} value 807 * @return {Boolean} 808 */ 809function isArray(value) { 810 return value.constructor === Array; 811} 812 813/** 814 * Creates and initializes specified collection of extensions. 815 * Each extension receives access to instance of glide and rest of components. 816 * 817 * @param {Object} glide 818 * @param {Object} extensions 819 * 820 * @returns {Object} 821 */ 822function mount(glide, extensions, events) { 823 var components = {}; 824 825 for (var name in extensions) { 826 if (isFunction(extensions[name])) { 827 components[name] = extensions[name](glide, components, events); 828 } else { 829 warn('Extension must be a function'); 830 } 831 } 832 833 for (var _name in components) { 834 if (isFunction(components[_name].mount)) { 835 components[_name].mount(); 836 } 837 } 838 839 return components; 840} 841 842/** 843 * Defines getter and setter property on the specified object. 844 * 845 * @param {Object} obj Object where property has to be defined. 846 * @param {String} prop Name of the defined property. 847 * @param {Object} definition Get and set definitions for the property. 848 * @return {Void} 849 */ 850function define(obj, prop, definition) { 851 Object.defineProperty(obj, prop, definition); 852} 853 854/** 855 * Sorts aphabetically object keys. 856 * 857 * @param {Object} obj 858 * @return {Object} 859 */ 860function sortKeys(obj) {
vendor: 9,198 bytes, lines 861-1292
861 return Object.keys(obj).sort().reduce(function (r, k) { 862 r[k] = obj[k]; 863 864 return r[k], r; 865 }, {}); 866} 867 868/** 869 * Merges passed settings object with default options. 870 * 871 * @param {Object} defaults 872 * @param {Object} settings 873 * @return {Object} 874 */ 875function mergeOptions(defaults, settings) { 876 var options = _extends({}, defaults, settings); 877 878 // `Object.assign` do not deeply merge objects, so we 879 // have to do it manually for every nested object 880 // in options. Although it does not look smart, 881 // it's smaller and faster than some fancy 882 // merging deep-merge algorithm script. 883 if (settings.hasOwnProperty('classes')) { 884 options.classes = _extends({}, defaults.classes, settings.classes); 885 886 if (settings.classes.hasOwnProperty('direction')) { 887 options.classes.direction = _extends({}, defaults.classes.direction, settings.classes.direction); 888 } 889 } 890 891 if (settings.hasOwnProperty('breakpoints')) { 892 options.breakpoints = _extends({}, defaults.breakpoints, settings.breakpoints); 893 } 894 895 return options; 896} 897 898var EventsBus = function () { 899 /** 900 * Construct a EventBus instance. 901 * 902 * @param {Object} events 903 */ 904 function EventsBus() { 905 var events = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 906 classCallCheck(this, EventsBus); 907 908 this.events = events; 909 this.hop = events.hasOwnProperty; 910 } 911 912 /** 913 * Adds listener to the specifed event. 914 * 915 * @param {String|Array} event 916 * @param {Function} handler 917 */ 918 919 920 createClass(EventsBus, [{ 921 key: 'on', 922 value: function on(event, handler) { 923 if (isArray(event)) { 924 for (var i = 0; i < event.length; i++) { 925 this.on(event[i], handler); 926 } 927 } 928 929 // Create the event's object if not yet created 930 if (!this.hop.call(this.events, event)) { 931 this.events[event] = []; 932 } 933 934 // Add the handler to queue 935 var index = this.events[event].push(handler) - 1; 936 937 // Provide handle back for removal of event 938 return { 939 remove: function remove() { 940 delete this.events[event][index]; 941 } 942 }; 943 } 944 945 /** 946 * Runs registered handlers for specified event. 947 * 948 * @param {String|Array} event 949 * @param {Object=} context 950 */ 951 952 }, { 953 key: 'emit', 954 value: function emit(event, context) { 955 if (isArray(event)) { 956 for (var i = 0; i < event.length; i++) { 957 this.emit(event[i], context); 958 } 959 } 960 961 // If the event doesn't exist, or there's no handlers in queue, just leave 962 if (!this.hop.call(this.events, event)) { 963 return; 964 } 965 966 // Cycle through events queue, fire! 967 this.events[event].forEach(function (item) { 968 item(context || {}); 969 }); 970 } 971 }]); 972 return EventsBus; 973}(); 974 975var Glide = function () { 976 /** 977 * Construct glide. 978 * 979 * @param {String} selector 980 * @param {Object} options 981 */ 982 function Glide(selector) { 983 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 984 classCallCheck(this, Glide); 985 986 this._c = {}; 987 this._t = []; 988 this._e = new EventsBus(); 989 990 this.disabled = false; 991 this.selector = selector; 992 this.settings = mergeOptions(defaults, options); 993 this.index = this.settings.startAt; 994 } 995 996 /** 997 * Initializes glide. 998 * 999 * @param {Object} extensions Collection of extensions to initialize. 1000 * @return {Glide} 1001 */ 1002 1003 1004 createClass(Glide, [{ 1005 key: 'mount', 1006 value: function mount$$1() { 1007 var extensions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 1008 1009 this._e.emit('mount.before'); 1010 1011 if (isObject(extensions)) { 1012 this._c = mount(this, extensions, this._e); 1013 } else { 1014 warn('You need to provide a object on `mount()`'); 1015 } 1016 1017 this._e.emit('mount.after'); 1018 1019 return this; 1020 } 1021 1022 /** 1023 * Collects an instance `translate` transformers. 1024 * 1025 * @param {Array} transformers Collection of transformers. 1026 * @return {Void} 1027 */ 1028 1029 }, { 1030 key: 'mutate', 1031 value: function mutate() { 1032 var transformers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; 1033 1034 if (isArray(transformers)) { 1035 this._t = transformers; 1036 } else { 1037 warn('You need to provide a array on `mutate()`'); 1038 } 1039 1040 return this; 1041 } 1042 1043 /** 1044 * Updates glide with specified settings. 1045 * 1046 * @param {Object} settings 1047 * @return {Glide} 1048 */ 1049 1050 }, { 1051 key: 'update', 1052 value: function update() { 1053 var settings = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 1054 1055 this.settings = mergeOptions(this.settings, settings); 1056 1057 if (settings.hasOwnProperty('startAt')) { 1058 this.index = settings.startAt; 1059 } 1060 1061 this._e.emit('update'); 1062 1063 return this; 1064 } 1065 1066 /** 1067 * Change slide with specified pattern. A pattern must be in the special format: 1068 * `>` - Move one forward 1069 * `<` - Move one backward 1070 * `={i}` - Go to {i} zero-based slide (eq. '=1', will go to second slide) 1071 * `>>` - Rewinds to end (last slide) 1072 * `<<` - Rewinds to start (first slide) 1073 * 1074 * @param {String} pattern 1075 * @return {Glide} 1076 */ 1077 1078 }, { 1079 key: 'go', 1080 value: function go(pattern) { 1081 this._c.Run.make(pattern); 1082 1083 return this; 1084 } 1085 1086 /** 1087 * Move track by specified distance. 1088 * 1089 * @param {String} distance 1090 * @return {Glide} 1091 */ 1092 1093 }, { 1094 key: 'move', 1095 value: function move(distance) { 1096 this._c.Transition.disable(); 1097 this._c.Move.make(distance); 1098 1099 return this; 1100 } 1101 1102 /** 1103 * Destroy instance and revert all changes done by this._c. 1104 * 1105 * @return {Glide} 1106 */ 1107 1108 }, { 1109 key: 'destroy', 1110 value: function destroy() { 1111 this._e.emit('destroy'); 1112 1113 return this; 1114 } 1115 1116 /** 1117 * Start instance autoplaying. 1118 * 1119 * @param {Boolean|Number} interval Run autoplaying with passed interval regardless of `autoplay` settings 1120 * @return {Glide} 1121 */ 1122 1123 }, { 1124 key: 'play', 1125 value: function play() { 1126 var interval = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; 1127 1128 if (interval) { 1129 this.settings.autoplay = interval; 1130 } 1131 1132 this._e.emit('play'); 1133 1134 return this; 1135 } 1136 1137 /** 1138 * Stop instance autoplaying. 1139 * 1140 * @return {Glide} 1141 */ 1142 1143 }, { 1144 key: 'pause', 1145 value: function pause() { 1146 this._e.emit('pause'); 1147 1148 return this; 1149 } 1150 1151 /** 1152 * Sets glide into a idle status. 1153 * 1154 * @return {Glide} 1155 */ 1156 1157 }, { 1158 key: 'disable', 1159 value: function disable() { 1160 this.disabled = true; 1161 1162 return this; 1163 } 1164 1165 /** 1166 * Sets glide into a active status. 1167 * 1168 * @return {Glide} 1169 */ 1170 1171 }, { 1172 key: 'enable', 1173 value: function enable() { 1174 this.disabled = false; 1175 1176 return this; 1177 } 1178 1179 /** 1180 * Adds cuutom event listener with handler. 1181 * 1182 * @param {String|Array} event 1183 * @param {Function} handler 1184 * @return {Glide} 1185 */ 1186 1187 }, { 1188 key: 'on', 1189 value: function on(event, handler) { 1190 this._e.on(event, handler); 1191 1192 return this; 1193 } 1194 1195 /** 1196 * Checks if glide is a precised type. 1197 * 1198 * @param {String} name 1199 * @return {Boolean} 1200 */ 1201 1202 }, { 1203 key: 'isType', 1204 value: function isType(name) { 1205 return this.settings.type === name; 1206 } 1207 1208 /** 1209 * Gets value of the core options. 1210 * 1211 * @return {Object} 1212 */ 1213 1214 }, { 1215 key: 'settings', 1216 get: function get$$1() { 1217 return this._o; 1218 } 1219 1220 /** 1221 * Sets value of the core options. 1222 * 1223 * @param {Object} o 1224 * @return {Void} 1225 */ 1226 , 1227 set: function set$$1(o) { 1228 if (isObject(o)) { 1229 this._o = o; 1230 } else { 1231 warn('Options must be an `object` instance.'); 1232 } 1233 } 1234 1235 /** 1236 * Gets current index of the slider. 1237 * 1238 * @return {Object} 1239 */ 1240 1241 }, { 1242 key: 'index', 1243 get: function get$$1() { 1244 return this._i; 1245 } 1246 1247 /** 1248 * Sets current index a slider. 1249 * 1250 * @return {Object} 1251 */ 1252 , 1253 set: function set$$1(i) { 1254 this._i = toInt(i); 1255 } 1256 1257 /** 1258 * Gets type name of the slider. 1259 * 1260 * @return {String} 1261 */ 1262 1263 }, { 1264 key: 'type', 1265 get: function get$$1() { 1266 return this.settings.type; 1267 } 1268 1269 /** 1270 * Gets value of the idle status. 1271 * 1272 * @return {Boolean} 1273 */ 1274 1275 }, { 1276 key: 'disabled', 1277 get: function get$$1() { 1278 return this._d; 1279 } 1280 1281 /** 1282 * Sets value of the idle status. 1283 * 1284 * @return {Boolean} 1285 */ 1286 , 1287 set: function set$$1(status) { 1288 this._d = !!status; 1289 } 1290 }]); 1291 return Glide; 1292}();
1293 1294function Run (Glide, Components, Events) { 1295 var Run = { 1296 /** 1297 * Initializes autorunning of the glide. 1298 * 1299 * @return {Void} 1300 */ 1301 mount: function mount() { 1302 this._o = false; 1303 }, 1304 1305 1306 /** 1307 * Makes glides running based on the passed moving schema. 1308 * 1309 * @param {String} move 1310 */ 1311 make: function make(move) { 1312 var _this = this; 1313 1314 if (!Glide.disabled) { 1315 Glide.disable(); 1316 1317 this.move = move; 1318 1319 Events.emit('run.before', this.move); 1320 1321 this.calculate(); 1322 1323 Events.emit('run', this.move); 1324 1325 Components.Transition.after(function () { 1326 if (_this.isStart()) { 1327 Events.emit('run.start', _this.move); 1328 } 1329 1330 if (_this.isEnd()) { 1331 Events.emit('run.end', _this.move); 1332 } 1333 1334 if (_this.isOffset('<') || _this.isOffset('>')) { 1335 _this._o = false; 1336 1337 Events.emit('run.offset', _this.move); 1338 } 1339 1340 Events.emit('run.after', _this.move); 1341 1342 Glide.enable(); 1343 }); 1344 } 1345 }, 1346 1347 1348 /** 1349 * Calculates current index based on defined move. 1350 * 1351 * @return {Void} 1352 */ 1353 calculate: function calculate() { 1354 var move = this.move, 1355 length = this.length; 1356 var steps = move.steps, 1357 direction = move.direction; 1358 1359 1360 var countableSteps = isNumber(toInt(steps)) && toInt(steps) !== 0; 1361 1362 switch (direction) { 1363 case '>': 1364 if (steps === '>') { 1365 Glide.index = length; 1366 } else if (this.isEnd()) { 1367 if (!(Glide.isType('slider') && !Glide.settings.rewind)) { 1368 this._o = true; 1369 1370 Glide.index = 0; 1371 } 1372 } else if (countableSteps) { 1373 Glide.index += Math.min(length - Glide.index, -toInt(steps)); 1374 } else { 1375 Glide.index++; 1376 } 1377 break; 1378 1379 case '<': 1380 if (steps === '<') { 1381 Glide.index = 0; 1382 } else if (this.isStart()) { 1383 if (!(Glide.isType('slider') && !Glide.settings.rewind)) { 1384 this._o = true; 1385 1386 Glide.index = length; 1387 } 1388 } else if (countableSteps) { 1389 Glide.index -= Math.min(Glide.index, toInt(steps)); 1390 } else { 1391 Glide.index--; 1392 } 1393 break; 1394 1395 case '=': 1396 Glide.index = steps; 1397 break; 1398 1399 default: 1400 warn('Invalid direction pattern [' + direction + steps + '] has been used'); 1401 break; 1402 } 1403 }, 1404 1405 1406 /** 1407 * Checks if we are on the first slide. 1408 * 1409 * @return {Boolean} 1410 */ 1411 isStart: function isStart() { 1412 return Glide.index === 0; 1413 }, 1414 1415 1416 /** 1417 * Checks if we are on the last slide. 1418 * 1419 * @return {Boolean} 1420 */ 1421 isEnd: function isEnd() { 1422 return Glide.index === this.length; 1423 }, 1424 1425 1426 /** 1427 * Checks if we are making a offset run. 1428 * 1429 * @param {String} direction 1430 * @return {Boolean} 1431 */ 1432 isOffset: function isOffset(direction) { 1433 return this._o && this.move.direction === direction; 1434 } 1435 }; 1436 1437 define(Run, 'move', { 1438 /** 1439 * Gets value of the move schema. 1440 * 1441 * @returns {Object} 1442 */ 1443 get: function get() { 1444 return this._m; 1445 }, 1446 1447 1448 /** 1449 * Sets value of the move schema. 1450 * 1451 * @returns {Object} 1452 */ 1453 set: function set(value) { 1454 var step = value.substr(1); 1455 1456 this._m = { 1457 direction: value.substr(0, 1), 1458 steps: step ? toInt(step) ? toInt(step) : step : 0 1459 }; 1460 } 1461 }); 1462 1463 define(Run, 'length', { 1464 /** 1465 * Gets value of the running distance based 1466 * on zero-indexing number of slides. 1467 * 1468 * @return {Number} 1469 */ 1470 get: function get() { 1471 var settings = Glide.settings; 1472 var length = Components.Html.slides.length; 1473 1474 // If the `bound` option is acitve, a maximum running distance should be 1475 // reduced by `perView` and `focusAt` settings. Running distance 1476 // should end before creating an empty space after instance. 1477 1478 if (Glide.isType('slider') && settings.focusAt !== 'center' && settings.bound) {
vendor: 35,874 bytes, lines 1479-3043
1479 return length - 1 - (toInt(settings.perView) - 1) + toInt(settings.focusAt); 1480 } 1481 1482 return length - 1; 1483 } 1484 }); 1485 1486 define(Run, 'offset', { 1487 /** 1488 * Gets status of the offsetting flag. 1489 * 1490 * @return {Boolean} 1491 */ 1492 get: function get() { 1493 return this._o; 1494 } 1495 }); 1496 1497 return Run; 1498} 1499 1500/** 1501 * Returns a current time. 1502 * 1503 * @return {Number} 1504 */ 1505function now() { 1506 return new Date().getTime(); 1507} 1508 1509/** 1510 * Returns a function, that, when invoked, will only be triggered 1511 * at most once during a given window of time. 1512 * 1513 * @param {Function} func 1514 * @param {Number} wait 1515 * @param {Object=} options 1516 * @return {Function} 1517 * 1518 * @see https://github.com/jashkenas/underscore 1519 */ 1520function throttle(func, wait, options) { 1521 var timeout = void 0, 1522 context = void 0, 1523 args = void 0, 1524 result = void 0; 1525 var previous = 0; 1526 if (!options) options = {}; 1527 1528 var later = function later() { 1529 previous = options.leading === false ? 0 : now(); 1530 timeout = null; 1531 result = func.apply(context, args); 1532 if (!timeout) context = args = null; 1533 }; 1534 1535 var throttled = function throttled() { 1536 var at = now(); 1537 if (!previous && options.leading === false) previous = at; 1538 var remaining = wait - (at - previous); 1539 context = this; 1540 args = arguments; 1541 if (remaining <= 0 || remaining > wait) { 1542 if (timeout) { 1543 clearTimeout(timeout); 1544 timeout = null; 1545 } 1546 previous = at; 1547 result = func.apply(context, args); 1548 if (!timeout) context = args = null; 1549 } else if (!timeout && options.trailing !== false) { 1550 timeout = setTimeout(later, remaining); 1551 } 1552 return result; 1553 }; 1554 1555 throttled.cancel = function () { 1556 clearTimeout(timeout); 1557 previous = 0; 1558 timeout = context = args = null; 1559 }; 1560 1561 return throttled; 1562} 1563 1564var MARGIN_TYPE = { 1565 ltr: ['marginLeft', 'marginRight'], 1566 rtl: ['marginRight', 'marginLeft'] 1567}; 1568 1569function Gaps (Glide, Components, Events) { 1570 var Gaps = { 1571 /** 1572 * Applies gaps between slides. First and last 1573 * slides do not receive it's edge margins. 1574 * 1575 * @param {HTMLCollection} slides 1576 * @return {Void} 1577 */ 1578 apply: function apply(slides) { 1579 for (var i = 0, len = slides.length; i < len; i++) { 1580 var style = slides[i].style; 1581 var direction = Components.Direction.value; 1582 1583 if (i !== 0) { 1584 style[MARGIN_TYPE[direction][0]] = this.value / 2 + 'px'; 1585 } else { 1586 style[MARGIN_TYPE[direction][0]] = ''; 1587 } 1588 1589 if (i !== slides.length - 1) { 1590 style[MARGIN_TYPE[direction][1]] = this.value / 2 + 'px'; 1591 } else { 1592 style[MARGIN_TYPE[direction][1]] = ''; 1593 } 1594 } 1595 }, 1596 1597 1598 /** 1599 * Removes gaps from the slides. 1600 * 1601 * @param {HTMLCollection} slides 1602 * @returns {Void} 1603 */ 1604 remove: function remove(slides) { 1605 for (var i = 0, len = slides.length; i < len; i++) { 1606 var style = slides[i].style; 1607 1608 style.marginLeft = ''; 1609 style.marginRight = ''; 1610 } 1611 } 1612 }; 1613 1614 define(Gaps, 'value', { 1615 /** 1616 * Gets value of the gap. 1617 * 1618 * @returns {Number} 1619 */ 1620 get: function get() { 1621 return toInt(Glide.settings.gap); 1622 } 1623 }); 1624 1625 define(Gaps, 'grow', { 1626 /** 1627 * Gets additional dimentions value caused by gaps. 1628 * Used to increase width of the slides wrapper. 1629 * 1630 * @returns {Number} 1631 */ 1632 get: function get() { 1633 return Gaps.value * (Components.Sizes.length - 1); 1634 } 1635 }); 1636 1637 define(Gaps, 'reductor', { 1638 /** 1639 * Gets reduction value caused by gaps. 1640 * Used to subtract width of the slides. 1641 * 1642 * @returns {Number} 1643 */ 1644 get: function get() { 1645 var perView = Glide.settings.perView; 1646 1647 return Gaps.value * (perView - 1) / perView; 1648 } 1649 }); 1650 1651 /** 1652 * Apply calculated gaps: 1653 * - after building, so slides (including clones) will receive proper margins 1654 * - on updating via API, to recalculate gaps with new options 1655 */ 1656 Events.on(['build.after', 'update'], throttle(function () { 1657 Gaps.apply(Components.Html.wrapper.children); 1658 }, 30)); 1659 1660 /** 1661 * Remove gaps: 1662 * - on destroying to bring markup to its inital state 1663 */ 1664 Events.on('destroy', function () { 1665 Gaps.remove(Components.Html.wrapper.children); 1666 }); 1667 1668 return Gaps; 1669} 1670 1671/** 1672 * Finds siblings nodes of the passed node. 1673 * 1674 * @param {Element} node 1675 * @return {Array} 1676 */ 1677function siblings(node) { 1678 if (node && node.parentNode) { 1679 var n = node.parentNode.firstChild; 1680 var matched = []; 1681 1682 for (; n; n = n.nextSibling) { 1683 if (n.nodeType === 1 && n !== node) { 1684 matched.push(n); 1685 } 1686 } 1687 1688 return matched; 1689 } 1690 1691 return []; 1692} 1693 1694/** 1695 * Checks if passed node exist and is a valid element. 1696 * 1697 * @param {Element} node 1698 * @return {Boolean} 1699 */ 1700function exist(node) { 1701 if (node && node instanceof window.HTMLElement) { 1702 return true; 1703 } 1704 1705 return false; 1706} 1707 1708var TRACK_SELECTOR = '[data-glide-el="track"]'; 1709 1710function Html (Glide, Components) { 1711 var Html = { 1712 /** 1713 * Setup slider HTML nodes. 1714 * 1715 * @param {Glide} glide 1716 */ 1717 mount: function mount() { 1718 this.root = Glide.selector; 1719 this.track = this.root.querySelector(TRACK_SELECTOR); 1720 this.slides = Array.prototype.slice.call(this.wrapper.children).filter(function (slide) { 1721 return !slide.classList.contains(Glide.settings.classes.cloneSlide); 1722 }); 1723 } 1724 }; 1725 1726 define(Html, 'root', { 1727 /** 1728 * Gets node of the glide main element. 1729 * 1730 * @return {Object} 1731 */ 1732 get: function get() { 1733 return Html._r; 1734 }, 1735 1736 1737 /** 1738 * Sets node of the glide main element. 1739 * 1740 * @return {Object} 1741 */ 1742 set: function set(r) { 1743 if (isString(r)) { 1744 r = document.querySelector(r); 1745 } 1746 1747 if (exist(r)) { 1748 Html._r = r; 1749 } else { 1750 warn('Root element must be a existing Html node'); 1751 } 1752 } 1753 }); 1754 1755 define(Html, 'track', { 1756 /** 1757 * Gets node of the glide track with slides. 1758 * 1759 * @return {Object} 1760 */ 1761 get: function get() { 1762 return Html._t; 1763 }, 1764 1765 1766 /** 1767 * Sets node of the glide track with slides. 1768 * 1769 * @return {Object} 1770 */ 1771 set: function set(t) { 1772 if (exist(t)) { 1773 Html._t = t; 1774 } else { 1775 warn('Could not find track element. Please use ' + TRACK_SELECTOR + ' attribute.'); 1776 } 1777 } 1778 }); 1779 1780 define(Html, 'wrapper', { 1781 /** 1782 * Gets node of the slides wrapper. 1783 * 1784 * @return {Object} 1785 */ 1786 get: function get() { 1787 return Html.track.children[0]; 1788 } 1789 }); 1790 1791 return Html; 1792} 1793 1794function Peek (Glide, Components, Events) { 1795 var Peek = { 1796 /** 1797 * Setups how much to peek based on settings. 1798 * 1799 * @return {Void} 1800 */ 1801 mount: function mount() { 1802 this.value = Glide.settings.peek; 1803 } 1804 }; 1805 1806 define(Peek, 'value', { 1807 /** 1808 * Gets value of the peek. 1809 * 1810 * @returns {Number|Object} 1811 */ 1812 get: function get() { 1813 return Peek._v; 1814 }, 1815 1816 1817 /** 1818 * Sets value of the peek. 1819 * 1820 * @param {Number|Object} value 1821 * @return {Void} 1822 */ 1823 set: function set(value) { 1824 if (isObject(value)) { 1825 value.before = toInt(value.before); 1826 value.after = toInt(value.after); 1827 } else { 1828 value = toInt(value); 1829 } 1830 1831 Peek._v = value; 1832 } 1833 }); 1834 1835 define(Peek, 'reductor', { 1836 /** 1837 * Gets reduction value caused by peek. 1838 * 1839 * @returns {Number} 1840 */ 1841 get: function get() { 1842 var value = Peek.value; 1843 var perView = Glide.settings.perView; 1844 1845 if (isObject(value)) { 1846 return value.before / perView + value.after / perView; 1847 } 1848 1849 return value * 2 / perView; 1850 } 1851 }); 1852 1853 /** 1854 * Recalculate peeking sizes on: 1855 * - when resizing window to update to proper percents 1856 */ 1857 Events.on(['resize', 'update'], function () { 1858 Peek.mount(); 1859 }); 1860 1861 return Peek; 1862} 1863 1864function Move (Glide, Components, Events) { 1865 var Move = { 1866 /** 1867 * Constructs move component. 1868 * 1869 * @returns {Void} 1870 */ 1871 mount: function mount() { 1872 this._o = 0; 1873 }, 1874 1875 1876 /** 1877 * Calculates a movement value based on passed offset and currently active index. 1878 * 1879 * @param {Number} offset 1880 * @return {Void} 1881 */ 1882 make: function make() { 1883 var _this = this; 1884 1885 var offset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; 1886 1887 this.offset = offset; 1888 1889 Events.emit('move', { 1890 movement: this.value 1891 }); 1892 1893 Components.Transition.after(function () { 1894 Events.emit('move.after', { 1895 movement: _this.value 1896 }); 1897 }); 1898 } 1899 }; 1900 1901 define(Move, 'offset', { 1902 /** 1903 * Gets an offset value used to modify current translate. 1904 * 1905 * @return {Object} 1906 */ 1907 get: function get() { 1908 return Move._o; 1909 }, 1910 1911 1912 /** 1913 * Sets an offset value used to modify current translate. 1914 * 1915 * @return {Object} 1916 */ 1917 set: function set(value) { 1918 Move._o = !isUndefined(value) ? toInt(value) : 0; 1919 } 1920 }); 1921 1922 define(Move, 'translate', { 1923 /** 1924 * Gets a raw movement value. 1925 * 1926 * @return {Number} 1927 */ 1928 get: function get() { 1929 return Components.Sizes.slideWidth * Glide.index; 1930 } 1931 }); 1932 1933 define(Move, 'value', { 1934 /** 1935 * Gets an actual movement value corrected by offset. 1936 * 1937 * @return {Number} 1938 */ 1939 get: function get() { 1940 var offset = this.offset; 1941 var translate = this.translate; 1942 1943 if (Components.Direction.is('rtl')) { 1944 return translate + offset; 1945 } 1946 1947 return translate - offset; 1948 } 1949 }); 1950 1951 /** 1952 * Make movement to proper slide on: 1953 * - before build, so glide will start at `startAt` index 1954 * - on each standard run to move to newly calculated index 1955 */ 1956 Events.on(['build.before', 'run'], function () { 1957 Move.make(); 1958 }); 1959 1960 return Move; 1961} 1962 1963function Sizes (Glide, Components, Events) { 1964 var Sizes = { 1965 /** 1966 * Setups dimentions of slides. 1967 * 1968 * @return {Void} 1969 */ 1970 setupSlides: function setupSlides() { 1971 var width = this.slideWidth + 'px'; 1972 var slides = Components.Html.slides; 1973 1974 for (var i = 0; i < slides.length; i++) { 1975 slides[i].style.width = width; 1976 } 1977 }, 1978 1979 1980 /** 1981 * Setups dimentions of slides wrapper. 1982 * 1983 * @return {Void} 1984 */ 1985 setupWrapper: function setupWrapper(dimention) { 1986 Components.Html.wrapper.style.width = this.wrapperSize + 'px'; 1987 }, 1988 1989 1990 /** 1991 * Removes applied styles from HTML elements. 1992 * 1993 * @returns {Void} 1994 */ 1995 remove: function remove() { 1996 var slides = Components.Html.slides; 1997 1998 for (var i = 0; i < slides.length; i++) { 1999 slides[i].style.width = ''; 2000 } 2001 2002 Components.Html.wrapper.style.width = ''; 2003 } 2004 }; 2005 2006 define(Sizes, 'length', { 2007 /** 2008 * Gets count number of the slides. 2009 * 2010 * @return {Number} 2011 */ 2012 get: function get() { 2013 return Components.Html.slides.length; 2014 } 2015 }); 2016 2017 define(Sizes, 'width', { 2018 /** 2019 * Gets width value of the glide. 2020 * 2021 * @return {Number} 2022 */ 2023 get: function get() { 2024 return Components.Html.root.offsetWidth; 2025 } 2026 }); 2027 2028 define(Sizes, 'wrapperSize', { 2029 /** 2030 * Gets size of the slides wrapper. 2031 * 2032 * @return {Number} 2033 */ 2034 get: function get() { 2035 return Sizes.slideWidth * Sizes.length + Components.Gaps.grow + Components.Clones.grow; 2036 } 2037 }); 2038 2039 define(Sizes, 'slideWidth', { 2040 /** 2041 * Gets width value of the single slide. 2042 * 2043 * @return {Number} 2044 */ 2045 get: function get() { 2046 return Sizes.width / Glide.settings.perView - Components.Peek.reductor - Components.Gaps.reductor; 2047 } 2048 }); 2049 2050 /** 2051 * Apply calculated glide's dimensions: 2052 * - before building, so other dimentions (e.g. translate) will be calculated propertly 2053 * - when resizing window to recalculate sildes dimensions 2054 * - on updating via API, to calculate dimensions based on new options 2055 */ 2056 Events.on(['build.before', 'resize', 'update'], function () { 2057 Sizes.setupSlides(); 2058 Sizes.setupWrapper(); 2059 }); 2060 2061 /** 2062 * Remove calculated glide's dimensions: 2063 * - on destoting to bring markup to its inital state 2064 */ 2065 Events.on('destroy', function () { 2066 Sizes.remove(); 2067 }); 2068 2069 return Sizes; 2070} 2071 2072function Build (Glide, Components, Events) { 2073 var Build = { 2074 /** 2075 * Init glide building. Adds classes, sets 2076 * dimensions and setups initial state. 2077 * 2078 * @return {Void} 2079 */ 2080 mount: function mount() { 2081 Events.emit('build.before'); 2082 2083 this.typeClass(); 2084 this.activeClass(); 2085 2086 Events.emit('build.after'); 2087 }, 2088 2089 2090 /** 2091 * Adds `type` class to the glide element. 2092 * 2093 * @return {Void} 2094 */ 2095 typeClass: function typeClass() { 2096 Components.Html.root.classList.add(Glide.settings.classes[Glide.settings.type]); 2097 }, 2098 2099 2100 /** 2101 * Sets active class to current slide. 2102 * 2103 * @return {Void} 2104 */ 2105 activeClass: function activeClass() { 2106 var classes = Glide.settings.classes; 2107 var slide = Components.Html.slides[Glide.index]; 2108 2109 if (slide) { 2110 slide.classList.add(classes.activeSlide); 2111 2112 siblings(slide).forEach(function (sibling) { 2113 sibling.classList.remove(classes.activeSlide); 2114 }); 2115 } 2116 }, 2117 2118 2119 /** 2120 * Removes HTML classes applied at building. 2121 * 2122 * @return {Void} 2123 */ 2124 removeClasses: function removeClasses() { 2125 var classes = Glide.settings.classes; 2126 2127 Components.Html.root.classList.remove(classes[Glide.settings.type]); 2128 2129 Components.Html.slides.forEach(function (sibling) { 2130 sibling.classList.remove(classes.activeSlide); 2131 }); 2132 } 2133 }; 2134 2135 /** 2136 * Clear building classes: 2137 * - on destroying to bring HTML to its initial state 2138 * - on updating to remove classes before remounting component 2139 */ 2140 Events.on(['destroy', 'update'], function () { 2141 Build.removeClasses(); 2142 }); 2143 2144 /** 2145 * Remount component: 2146 * - on resizing of the window to calculate new dimentions 2147 * - on updating settings via API 2148 */ 2149 Events.on(['resize', 'update'], function () { 2150 Build.mount(); 2151 }); 2152 2153 /** 2154 * Swap active class of current slide: 2155 * - after each move to the new index 2156 */ 2157 Events.on('move.after', function () { 2158 Build.activeClass(); 2159 }); 2160 2161 return Build; 2162} 2163 2164function Clones (Glide, Components, Events) { 2165 var Clones = { 2166 /** 2167 * Create pattern map and collect slides to be cloned. 2168 */ 2169 mount: function mount() { 2170 this.items = []; 2171 2172 if (Glide.isType('carousel')) { 2173 this.items = this.collect(); 2174 } 2175 }, 2176 2177 2178 /** 2179 * Collect clones with pattern. 2180 * 2181 * @return {Void} 2182 */ 2183 collect: function collect() { 2184 var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; 2185 var slides = Components.Html.slides; 2186 var _Glide$settings = Glide.settings, 2187 perView = _Glide$settings.perView, 2188 classes = _Glide$settings.classes; 2189 2190 2191 var peekIncrementer = +!!Glide.settings.peek; 2192 var part = perView + peekIncrementer; 2193 var start = slides.slice(0, part); 2194 var end = slides.slice(-part); 2195 2196 for (var r = 0; r < Math.max(1, Math.floor(perView / slides.length)); r++) { 2197 for (var i = 0; i < start.length; i++) { 2198 var clone = start[i].cloneNode(true); 2199 2200 clone.classList.add(classes.cloneSlide); 2201 2202 items.push(clone); 2203 } 2204 2205 for (var _i = 0; _i < end.length; _i++) { 2206 var _clone = end[_i].cloneNode(true); 2207 2208 _clone.classList.add(classes.cloneSlide); 2209 2210 items.unshift(_clone); 2211 } 2212 } 2213 2214 return items; 2215 }, 2216 2217 2218 /** 2219 * Append cloned slides with generated pattern. 2220 * 2221 * @return {Void} 2222 */ 2223 append: function append() { 2224 var items = this.items; 2225 var _Components$Html = Components.Html, 2226 wrapper = _Components$Html.wrapper, 2227 slides = _Components$Html.slides; 2228 2229 2230 var half = Math.floor(items.length / 2); 2231 var prepend = items.slice(0, half).reverse(); 2232 var append = items.slice(half, items.length); 2233 var width = Components.Sizes.slideWidth + 'px'; 2234 2235 for (var i = 0; i < append.length; i++) { 2236 wrapper.appendChild(append[i]); 2237 } 2238 2239 for (var _i2 = 0; _i2 < prepend.length; _i2++) { 2240 wrapper.insertBefore(prepend[_i2], slides[0]); 2241 } 2242 2243 for (var _i3 = 0; _i3 < items.length; _i3++) { 2244 items[_i3].style.width = width; 2245 } 2246 }, 2247 2248 2249 /** 2250 * Remove all cloned slides. 2251 * 2252 * @return {Void} 2253 */ 2254 remove: function remove() { 2255 var items = this.items; 2256 2257 2258 for (var i = 0; i < items.length; i++) { 2259 Components.Html.wrapper.removeChild(items[i]); 2260 } 2261 } 2262 }; 2263 2264 define(Clones, 'grow', { 2265 /** 2266 * Gets additional dimentions value caused by clones. 2267 * 2268 * @return {Number} 2269 */ 2270 get: function get() { 2271 return (Components.Sizes.slideWidth + Components.Gaps.value) * Clones.items.length; 2272 } 2273 }); 2274 2275 /** 2276 * Append additional slide's clones: 2277 * - while glide's type is `carousel` 2278 */ 2279 Events.on('update', function () { 2280 Clones.remove(); 2281 Clones.mount(); 2282 Clones.append(); 2283 }); 2284 2285 /** 2286 * Append additional slide's clones: 2287 * - while glide's type is `carousel` 2288 */ 2289 Events.on('build.before', function () { 2290 if (Glide.isType('carousel')) { 2291 Clones.append(); 2292 } 2293 }); 2294 2295 /** 2296 * Remove clones HTMLElements: 2297 * - on destroying, to bring HTML to its initial state 2298 */ 2299 Events.on('destroy', function () { 2300 Clones.remove(); 2301 }); 2302 2303 return Clones; 2304} 2305 2306var EventsBinder = function () { 2307 /** 2308 * Construct a EventsBinder instance. 2309 */ 2310 function EventsBinder() { 2311 var listeners = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 2312 classCallCheck(this, EventsBinder); 2313 2314 this.listeners = listeners; 2315 } 2316 2317 /** 2318 * Adds events listeners to arrows HTML elements. 2319 * 2320 * @param {String|Array} events 2321 * @param {Element|Window|Document} el 2322 * @param {Function} closure 2323 * @param {Boolean|Object} capture 2324 * @return {Void} 2325 */ 2326 2327 2328 createClass(EventsBinder, [{ 2329 key: 'on', 2330 value: function on(events, el, closure) { 2331 var capture = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; 2332 2333 if (isString(events)) { 2334 events = [events]; 2335 } 2336 2337 for (var i = 0; i < events.length; i++) { 2338 this.listeners[events[i]] = closure; 2339 2340 el.addEventListener(events[i], this.listeners[events[i]], capture); 2341 } 2342 } 2343 2344 /** 2345 * Removes event listeners from arrows HTML elements. 2346 * 2347 * @param {String|Array} events 2348 * @param {Element|Window|Document} el 2349 * @param {Boolean|Object} capture 2350 * @return {Void} 2351 */ 2352 2353 }, { 2354 key: 'off', 2355 value: function off(events, el) { 2356 var capture = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; 2357 2358 if (isString(events)) { 2359 events = [events]; 2360 } 2361 2362 for (var i = 0; i < events.length; i++) { 2363 el.removeEventListener(events[i], this.listeners[events[i]], capture); 2364 } 2365 } 2366 2367 /** 2368 * Destroy collected listeners. 2369 * 2370 * @returns {Void} 2371 */ 2372 2373 }, { 2374 key: 'destroy', 2375 value: function destroy() { 2376 delete this.listeners; 2377 } 2378 }]); 2379 return EventsBinder; 2380}(); 2381 2382function Resize (Glide, Components, Events) { 2383 /** 2384 * Instance of the binder for DOM Events. 2385 * 2386 * @type {EventsBinder} 2387 */ 2388 var Binder = new EventsBinder(); 2389 2390 var Resize = { 2391 /** 2392 * Initializes window bindings. 2393 */ 2394 mount: function mount() { 2395 this.bind(); 2396 }, 2397 2398 2399 /** 2400 * Binds `rezsize` listener to the window. 2401 * It's a costly event, so we are debouncing it. 2402 * 2403 * @return {Void} 2404 */ 2405 bind: function bind() { 2406 Binder.on('resize', window, throttle(function () { 2407 Events.emit('resize'); 2408 }, Glide.settings.throttle)); 2409 }, 2410 2411 2412 /** 2413 * Unbinds listeners from the window. 2414 * 2415 * @return {Void} 2416 */ 2417 unbind: function unbind() { 2418 Binder.off('resize', window); 2419 } 2420 }; 2421 2422 /** 2423 * Remove bindings from window: 2424 * - on destroying, to remove added EventListener 2425 */ 2426 Events.on('destroy', function () { 2427 Resize.unbind(); 2428 Binder.destroy(); 2429 }); 2430 2431 return Resize; 2432} 2433 2434var VALID_DIRECTIONS = ['ltr', 'rtl']; 2435var FLIPED_MOVEMENTS = { 2436 '>': '<', 2437 '<': '>', 2438 '=': '=' 2439}; 2440 2441function Direction (Glide, Components, Events) { 2442 var Direction = { 2443 /** 2444 * Setups gap value based on settings. 2445 * 2446 * @return {Void} 2447 */ 2448 mount: function mount() { 2449 this.value = Glide.settings.direction; 2450 }, 2451 2452 2453 /** 2454 * Resolves pattern based on direction value 2455 * 2456 * @param {String} pattern 2457 * @returns {String} 2458 */ 2459 resolve: function resolve(pattern) { 2460 var token = pattern.slice(0, 1); 2461 2462 if (this.is('rtl')) { 2463 return pattern.split(token).join(FLIPED_MOVEMENTS[token]); 2464 } 2465 2466 return pattern; 2467 }, 2468 2469 2470 /** 2471 * Checks value of direction mode. 2472 * 2473 * @param {String} direction 2474 * @returns {Boolean} 2475 */ 2476 is: function is(direction) { 2477 return this.value === direction; 2478 }, 2479 2480 2481 /** 2482 * Applies direction class to the root HTML element. 2483 * 2484 * @return {Void} 2485 */ 2486 addClass: function addClass() { 2487 Components.Html.root.classList.add(Glide.settings.classes.direction[this.value]); 2488 }, 2489 2490 2491 /** 2492 * Removes direction class from the root HTML element. 2493 * 2494 * @return {Void} 2495 */ 2496 removeClass: function removeClass() { 2497 Components.Html.root.classList.remove(Glide.settings.classes.direction[this.value]); 2498 } 2499 }; 2500 2501 define(Direction, 'value', { 2502 /** 2503 * Gets value of the direction. 2504 * 2505 * @returns {Number} 2506 */ 2507 get: function get() { 2508 return Direction._v; 2509 }, 2510 2511 2512 /** 2513 * Sets value of the direction. 2514 * 2515 * @param {String} value 2516 * @return {Void} 2517 */ 2518 set: function set(value) { 2519 if (VALID_DIRECTIONS.indexOf(value) > -1) { 2520 Direction._v = value; 2521 } else { 2522 warn('Direction value must be `ltr` or `rtl`'); 2523 } 2524 } 2525 }); 2526 2527 /** 2528 * Clear direction class: 2529 * - on destroy to bring HTML to its initial state 2530 * - on update to remove class before reappling bellow 2531 */ 2532 Events.on(['destroy', 'update'], function () { 2533 Direction.removeClass(); 2534 }); 2535 2536 /** 2537 * Remount component: 2538 * - on update to reflect changes in direction value 2539 */ 2540 Events.on('update', function () { 2541 Direction.mount(); 2542 }); 2543 2544 /** 2545 * Apply direction class: 2546 * - before building to apply class for the first time 2547 * - on updating to reapply direction class that may changed 2548 */ 2549 Events.on(['build.before', 'update'], function () { 2550 Direction.addClass(); 2551 }); 2552 2553 return Direction; 2554} 2555 2556/** 2557 * Reflects value of glide movement. 2558 * 2559 * @param {Object} Glide 2560 * @param {Object} Components 2561 * @return {Object} 2562 */ 2563function Rtl (Glide, Components) { 2564 return { 2565 /** 2566 * Negates the passed translate if glide is in RTL option. 2567 * 2568 * @param {Number} translate 2569 * @return {Number} 2570 */ 2571 modify: function modify(translate) { 2572 if (Components.Direction.is('rtl')) { 2573 return -translate; 2574 } 2575 2576 return translate; 2577 } 2578 }; 2579} 2580 2581/** 2582 * Updates glide movement with a `gap` settings. 2583 * 2584 * @param {Object} Glide 2585 * @param {Object} Components 2586 * @return {Object} 2587 */ 2588function Gap (Glide, Components) { 2589 return { 2590 /** 2591 * Modifies passed translate value with number in the `gap` settings. 2592 * 2593 * @param {Number} translate 2594 * @return {Number} 2595 */ 2596 modify: function modify(translate) { 2597 return translate + Components.Gaps.value * Glide.index; 2598 } 2599 }; 2600} 2601 2602/** 2603 * Updates glide movement with width of additional clones width. 2604 * 2605 * @param {Object} Glide 2606 * @param {Object} Components 2607 * @return {Object} 2608 */ 2609function Grow (Glide, Components) { 2610 return { 2611 /** 2612 * Adds to the passed translate width of the half of clones. 2613 * 2614 * @param {Number} translate 2615 * @return {Number} 2616 */ 2617 modify: function modify(translate) { 2618 return translate + Components.Clones.grow / 2; 2619 } 2620 }; 2621} 2622 2623/** 2624 * Updates glide movement with a `peek` settings. 2625 * 2626 * @param {Object} Glide 2627 * @param {Object} Components 2628 * @return {Object} 2629 */ 2630function Peeking (Glide, Components) { 2631 return { 2632 /** 2633 * Modifies passed translate value with a `peek` setting. 2634 * 2635 * @param {Number} translate 2636 * @return {Number} 2637 */ 2638 modify: function modify(translate) { 2639 if (Glide.settings.focusAt >= 0) { 2640 var peek = Components.Peek.value; 2641 2642 if (isObject(peek)) { 2643 return translate - peek.before; 2644 } 2645 2646 return translate - peek; 2647 } 2648 2649 return translate; 2650 } 2651 }; 2652} 2653 2654/** 2655 * Updates glide movement with a `focusAt` settings. 2656 * 2657 * @param {Object} Glide 2658 * @param {Object} Components 2659 * @return {Object} 2660 */ 2661function Focusing (Glide, Components) { 2662 return { 2663 /** 2664 * Modifies passed translate value with index in the `focusAt` setting. 2665 * 2666 * @param {Number} translate 2667 * @return {Number} 2668 */ 2669 modify: function modify(translate) { 2670 var gap = Components.Gaps.value; 2671 var width = Components.Sizes.width; 2672 var focusAt = Glide.settings.focusAt; 2673 var slideWidth = Components.Sizes.slideWidth; 2674 2675 if (focusAt === 'center') { 2676 return translate - (width / 2 - slideWidth / 2); 2677 } 2678 2679 return translate - slideWidth * focusAt - gap * focusAt; 2680 } 2681 }; 2682} 2683 2684/** 2685 * Applies diffrent transformers on translate value. 2686 * 2687 * @param {Object} Glide 2688 * @param {Object} Components 2689 * @return {Object} 2690 */ 2691function mutator (Glide, Components, Events) { 2692 /** 2693 * Merge instance transformers with collection of default transformers. 2694 * It's important that the Rtl component be last on the list, 2695 * so it reflects all previous transformations. 2696 * 2697 * @type {Array} 2698 */ 2699 var TRANSFORMERS = [Gap, Grow, Peeking, Focusing].concat(Glide._t, [Rtl]); 2700 2701 return { 2702 /** 2703 * Piplines translate value with registered transformers. 2704 * 2705 * @param {Number} translate 2706 * @return {Number} 2707 */ 2708 mutate: function mutate(translate) { 2709 for (var i = 0; i < TRANSFORMERS.length; i++) { 2710 var transformer = TRANSFORMERS[i]; 2711 2712 if (isFunction(transformer) && isFunction(transformer().modify)) { 2713 translate = transformer(Glide, Components, Events).modify(translate); 2714 } else { 2715 warn('Transformer should be a function that returns an object with `modify()` method'); 2716 } 2717 } 2718 2719 return translate; 2720 } 2721 }; 2722} 2723 2724function Translate (Glide, Components, Events) { 2725 var Translate = { 2726 /** 2727 * Sets value of translate on HTML element. 2728 * 2729 * @param {Number} value 2730 * @return {Void} 2731 */ 2732 set: function set(value) { 2733 var transform = mutator(Glide, Components).mutate(value); 2734 2735 Components.Html.wrapper.style.transform = 'translate3d(' + -1 * transform + 'px, 0px, 0px)'; 2736 }, 2737 2738 2739 /** 2740 * Removes value of translate from HTML element. 2741 * 2742 * @return {Void} 2743 */ 2744 remove: function remove() { 2745 Components.Html.wrapper.style.transform = ''; 2746 } 2747 }; 2748 2749 /** 2750 * Set new translate value: 2751 * - on move to reflect index change 2752 * - on updating via API to reflect possible changes in options 2753 */ 2754 Events.on('move', function (context) { 2755 var gap = Components.Gaps.value; 2756 var length = Components.Sizes.length; 2757 var width = Components.Sizes.slideWidth; 2758 2759 if (Glide.isType('carousel') && Components.Run.isOffset('<')) { 2760 Components.Transition.after(function () { 2761 Events.emit('translate.jump'); 2762 2763 Translate.set(width * (length - 1)); 2764 }); 2765 2766 return Translate.set(-width - gap * length); 2767 } 2768 2769 if (Glide.isType('carousel') && Components.Run.isOffset('>')) { 2770 Components.Transition.after(function () { 2771 Events.emit('translate.jump'); 2772 2773 Translate.set(0); 2774 }); 2775 2776 return Translate.set(width * length + gap * length); 2777 } 2778 2779 return Translate.set(context.movement); 2780 }); 2781 2782 /** 2783 * Remove translate: 2784 * - on destroying to bring markup to its inital state 2785 */ 2786 Events.on('destroy', function () { 2787 Translate.remove(); 2788 }); 2789 2790 return Translate; 2791} 2792 2793function Transition (Glide, Components, Events) { 2794 /** 2795 * Holds inactivity status of transition. 2796 * When true transition is not applied. 2797 * 2798 * @type {Boolean} 2799 */ 2800 var disabled = false; 2801 2802 var Transition = { 2803 /** 2804 * Composes string of the CSS transition. 2805 * 2806 * @param {String} property 2807 * @return {String} 2808 */ 2809 compose: function compose(property) { 2810 var settings = Glide.settings; 2811 2812 if (!disabled) { 2813 return property + ' ' + this.duration + 'ms ' + settings.animationTimingFunc; 2814 } 2815 2816 return property + ' 0ms ' + settings.animationTimingFunc; 2817 }, 2818 2819 2820 /** 2821 * Sets value of transition on HTML element. 2822 * 2823 * @param {String=} property 2824 * @return {Void} 2825 */ 2826 set: function set() { 2827 var property = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'transform'; 2828 2829 Components.Html.wrapper.style.transition = this.compose(property); 2830 }, 2831 2832 2833 /** 2834 * Removes value of transition from HTML element. 2835 * 2836 * @return {Void} 2837 */ 2838 remove: function remove() { 2839 Components.Html.wrapper.style.transition = ''; 2840 }, 2841 2842 2843 /** 2844 * Runs callback after animation. 2845 * 2846 * @param {Function} callback 2847 * @return {Void} 2848 */ 2849 after: function after(callback) { 2850 setTimeout(function () { 2851 callback(); 2852 }, this.duration); 2853 }, 2854 2855 2856 /** 2857 * Enable transition. 2858 * 2859 * @return {Void} 2860 */ 2861 enable: function enable() { 2862 disabled = false; 2863 2864 this.set(); 2865 }, 2866 2867 2868 /** 2869 * Disable transition. 2870 * 2871 * @return {Void} 2872 */ 2873 disable: function disable() { 2874 disabled = true; 2875 2876 this.set(); 2877 } 2878 }; 2879 2880 define(Transition, 'duration', { 2881 /** 2882 * Gets duration of the transition based 2883 * on currently running animation type. 2884 * 2885 * @return {Number} 2886 */ 2887 get: function get() { 2888 var settings = Glide.settings; 2889 2890 if (Glide.isType('slider') && Components.Run.offset) { 2891 return settings.rewindDuration; 2892 } 2893 2894 return settings.animationDuration; 2895 } 2896 }); 2897 2898 /** 2899 * Set transition `style` value: 2900 * - on each moving, because it may be cleared by offset move 2901 */ 2902 Events.on('move', function () { 2903 Transition.set(); 2904 }); 2905 2906 /** 2907 * Disable transition: 2908 * - before initial build to avoid transitioning from `0` to `startAt` index 2909 * - while resizing window and recalculating dimentions 2910 * - on jumping from offset transition at start and end edges in `carousel` type 2911 */ 2912 Events.on(['build.before', 'resize', 'translate.jump'], function () { 2913 Transition.disable(); 2914 }); 2915 2916 /** 2917 * Enable transition: 2918 * - on each running, because it may be disabled by offset move 2919 */ 2920 Events.on('run', function () { 2921 Transition.enable(); 2922 }); 2923 2924 /** 2925 * Remove transition: 2926 * - on destroying to bring markup to its inital state 2927 */ 2928 Events.on('destroy', function () { 2929 Transition.remove(); 2930 }); 2931 2932 return Transition; 2933} 2934 2935/** 2936 * Test via a getter in the options object to see 2937 * if the passive property is accessed. 2938 * 2939 * @see https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md#feature-detection 2940 */ 2941 2942var supportsPassive = false; 2943 2944try { 2945 var opts = Object.defineProperty({}, 'passive', { 2946 get: function get() { 2947 supportsPassive = true; 2948 } 2949 }); 2950 2951 window.addEventListener('testPassive', null, opts); 2952 window.removeEventListener('testPassive', null, opts); 2953} catch (e) {} 2954 2955var supportsPassive$1 = supportsPassive; 2956 2957var START_EVENTS = ['touchstart', 'mousedown']; 2958var MOVE_EVENTS = ['touchmove', 'mousemove']; 2959var END_EVENTS = ['touchend', 'touchcancel', 'mouseup', 'mouseleave']; 2960var MOUSE_EVENTS = ['mousedown', 'mousemove', 'mouseup', 'mouseleave']; 2961 2962function Swipe (Glide, Components, Events) { 2963 /** 2964 * Instance of the binder for DOM Events. 2965 * 2966 * @type {EventsBinder} 2967 */ 2968 var Binder = new EventsBinder(); 2969 2970 var swipeSin = 0; 2971 var swipeStartX = 0; 2972 var swipeStartY = 0; 2973 var disabled = false; 2974 var capture = supportsPassive$1 ? { passive: true } : false; 2975 2976 var Swipe = { 2977 /** 2978 * Initializes swipe bindings. 2979 * 2980 * @return {Void} 2981 */ 2982 mount: function mount() { 2983 this.bindSwipeStart(); 2984 }, 2985 2986 2987 /** 2988 * Handler for `swipestart` event. Calculates entry points of the user's tap. 2989 * 2990 * @param {Object} event 2991 * @return {Void} 2992 */ 2993 start: function start(event) { 2994 if (!disabled && !Glide.disabled) { 2995 this.disable(); 2996 2997 var swipe = this.touches(event); 2998 2999 swipeSin = null; 3000 swipeStartX = toInt(swipe.pageX); 3001 swipeStartY = toInt(swipe.pageY); 3002 3003 this.bindSwipeMove(); 3004 this.bindSwipeEnd(); 3005 3006 Events.emit('swipe.start'); 3007 } 3008 }, 3009 3010 3011 /** 3012 * Handler for `swipemove` event. Calculates user's tap angle and distance. 3013 * 3014 * @param {Object} event 3015 */ 3016 move: function move(event) { 3017 if (!Glide.disabled) { 3018 var _Glide$settings = Glide.settings, 3019 touchAngle = _Glide$settings.touchAngle, 3020 touchRatio = _Glide$settings.touchRatio, 3021 classes = _Glide$settings.classes; 3022 3023 3024 var swipe = this.touches(event); 3025 3026 var subExSx = toInt(swipe.pageX) - swipeStartX; 3027 var subEySy = toInt(swipe.pageY) - swipeStartY; 3028 var powEX = Math.abs(subExSx << 2); 3029 var powEY = Math.abs(subEySy << 2); 3030 var swipeHypotenuse = Math.sqrt(powEX + powEY); 3031 var swipeCathetus = Math.sqrt(powEY); 3032 3033 swipeSin = Math.asin(swipeCathetus / swipeHypotenuse); 3034 3035 if (swipeSin * 180 / Math.PI < touchAngle) { 3036 event.stopPropagation(); 3037 3038 Components.Move.make(subExSx * toFloat(touchRatio)); 3039 3040 Components.Html.root.classList.add(classes.dragging); 3041 3042 Events.emit('swipe.move'); 3043 }
3043 else { 3044 return false; 3045 } 3046 } 3047 }, 3048 3049 3050 /** 3051 * Handler for `swipeend` event. Finitializes user's tap and decides about glide move. 3052 * 3053 * @param {Object} event 3054 * @return {Void} 3055 */ 3056 end: function end(event) { 3057 if (!Glide.disabled) { 3058 var settings = Glide.settings; 3059 3060 var swipe = this.touches(event); 3061 var threshold = this.threshold(event); 3062 3063 var swipeDistance = swipe.pageX - swipeStartX; 3064 var swipeDeg = swipeSin * 180 / Math.PI; 3065 var steps = Math.round(swipeDistance / Components.Sizes.slideWidth); 3066 3067 this.enable(); 3068 3069 if (swipeDistance > threshold && swipeDeg < settings.touchAngle) { 3070 // While swipe is positive and greater than threshold move backward. 3071 if (settings.perTouch) { 3072 steps = Math.min(steps, toInt(settings.perTouch)); 3073 } 3074 3075 if (Components.Direction.is('rtl')) { 3076 steps = -steps; 3077 } 3078 3079 Components.Run.make(Components.Direction.resolve('<' + steps)); 3080 } else if (swipeDistance < -threshold && swipeDeg < settings.touchAngle) { 3081 // While swipe is negative and lower than negative threshold move forward. 3082 if (settings.perTouch) { 3083 steps = Math.max(steps, -toInt(settings.perTouch)); 3084 } 3085 3086 if (Components.Direction.is('rtl')) { 3087 steps = -steps; 3088 } 3089 3090 Components.Run.make(Components.Direction.resolve('>' + steps)); 3091 } else { 3092 // While swipe don't reach distance apply previous transform. 3093 Components.Move.make(); 3094 } 3095 3096 Components.Html.root.classList.remove(settings.classes.dragging); 3097 3098 this.unbindSwipeMove(); 3099 this.unbindSwipeEnd(); 3100 3101 Events.emit('swipe.end'); 3102 } 3103 }, 3104 3105 3106 /** 3107 * Binds swipe's starting event. 3108 * 3109 * @return {Void} 3110 */ 3111 bindSwipeStart: function bindSwipeStart() { 3112 var _this = this; 3113 3114 var settings = Glide.settings; 3115 3116 if (settings.swipeThreshold) { 3117 Binder.on(START_EVENTS[0], Components.Html.wrapper, function (event) { 3118 _this.start(event); 3119 }, capture); 3120 } 3121 3122 if (settings.dragThreshold) { 3123 Binder.on(START_EVENTS[1], Components.Html.wrapper, function (event) { 3124 _this.start(event); 3125 }, capture); 3126 } 3127 }, 3128 3129 3130 /** 3131 * Unbinds swipe's starting event. 3132 * 3133 * @return {Void} 3134 */ 3135 unbindSwipeStart: function unbindSwipeStart() { 3136 Binder.off(START_EVENTS[0], Components.Html.wrapper, capture); 3137 Binder.off(START_EVENTS[1], Components.Html.wrapper, capture); 3138 }, 3139 3140 3141 /** 3142 * Binds swipe's moving event. 3143 * 3144 * @return {Void} 3145 */ 3146 bindSwipeMove: function bindSwipeMove() { 3147 var _this2 = this; 3148 3149 Binder.on(MOVE_EVENTS, Components.Html.wrapper, throttle(function (event) { 3150 _this2.move(event); 3151 }, Glide.settings.throttle), capture); 3152 }, 3153 3154 3155 /** 3156 * Unbinds swipe's moving event. 3157 * 3158 * @return {Void} 3159 */ 3160 unbindSwipeMove: function unbindSwipeMove() { 3161 Binder.off(MOVE_EVENTS, Components.Html.wrapper, capture); 3162 }, 3163 3164 3165 /** 3166 * Binds swipe's ending event. 3167 * 3168 * @return {Void} 3169 */ 3170 bindSwipeEnd: function bindSwipeEnd() { 3171 var _this3 = this; 3172 3173 Binder.on(END_EVENTS, Components.Html.wrapper, function (event) { 3174 _this3.end(event); 3175 }); 3176 }, 3177 3178 3179 /** 3180 * Unbinds swipe's ending event. 3181 * 3182 * @return {Void} 3183 */ 3184 unbindSwipeEnd: function unbindSwipeEnd() { 3185 Binder.off(END_EVENTS, Components.Html.wrapper); 3186 }, 3187 3188 3189 /** 3190 * Normalizes event touches points accorting to different types. 3191 * 3192 * @param {Object} event 3193 */ 3194 touches: function touches(event) { 3195 if (MOUSE_EVENTS.indexOf(event.type) > -1) { 3196 return event; 3197 } 3198 3199 return event.touches[0] || event.changedTouches[0]; 3200 }, 3201 3202 3203 /** 3204 * Gets value of minimum swipe distance settings based on event type. 3205 * 3206 * @return {Number} 3207 */ 3208 threshold: function threshold(event) { 3209 var settings = Glide.settings; 3210 3211 if (MOUSE_EVENTS.indexOf(event.type) > -1) { 3212 return settings.dragThreshold; 3213 } 3214 3215 return settings.swipeThreshold; 3216 }, 3217 3218 3219 /** 3220 * Enables swipe event. 3221 * 3222 * @return {self} 3223 */ 3224 enable: function enable() { 3225 disabled = false; 3226 3227 Components.Transition.enable(); 3228 3229 return this; 3230 }, 3231 3232 3233 /** 3234 * Disables swipe event. 3235 * 3236 * @return {self} 3237 */ 3238 disable: function disable() { 3239 disabled = true; 3240 3241 Components.Transition.disable(); 3242 3243 return this; 3244 } 3245 }; 3246 3247 /** 3248 * Add component class: 3249 * - after initial building 3250 */ 3251 Events.on('build.after', function () { 3252 Components.Html.root.classList.add(Glide.settings.classes.swipeable); 3253 }); 3254 3255 /** 3256 * Remove swiping bindings: 3257 * - on destroying, to remove added EventListeners 3258 */ 3259 Events.on('destroy', function () { 3260 Swipe.unbindSwipeStart(); 3261 Swipe.unbindSwipeMove(); 3262 Swipe.unbindSwipeEnd(); 3263 Binder.destroy(); 3264 }); 3265 3266 return Swipe; 3267} 3268 3269function Images (Glide, Components, Events) { 3270 /** 3271 * Instance of the binder for DOM Events. 3272 * 3273 * @type {EventsBinder} 3274 */ 3275 var Binder = new EventsBinder(); 3276 3277 var Images = { 3278 /** 3279 * Binds listener to glide wrapper. 3280 * 3281 * @return {Void} 3282 */ 3283 mount: function mount() { 3284 this.bind(); 3285 }, 3286 3287 3288 /** 3289 * Binds `dragstart` event on wrapper to prevent dragging images. 3290 * 3291 * @return {Void} 3292 */ 3293 bind: function bind() { 3294 Binder.on('dragstart', Components.Html.wrapper, this.dragstart); 3295 }, 3296 3297 3298 /** 3299 * Unbinds `dragstart` event on wrapper. 3300 * 3301 * @return {Void} 3302 */ 3303 unbind: function unbind() { 3304 Binder.off('dragstart', Components.Html.wrapper); 3305 }, 3306 3307 3308 /** 3309 * Event handler. Prevents dragging. 3310 * 3311 * @return {Void} 3312 */ 3313 dragstart: function dragstart(event) { 3314 event.preventDefault(); 3315 } 3316 }; 3317 3318 /** 3319 * Remove bindings from images: 3320 * - on destroying, to remove added EventListeners 3321 */ 3322 Events.on('destroy', function () { 3323 Images.unbind(); 3324 Binder.destroy(); 3325 }); 3326 3327 return Images; 3328} 3329 3330function Anchors (Glide, Components, Events) { 3331 /** 3332 * Instance of the binder for DOM Events. 3333 * 3334 * @type {EventsBinder} 3335 */ 3336 var Binder = new EventsBinder(); 3337 3338 /** 3339 * Holds detaching status of anchors. 3340 * Prevents detaching of already detached anchors. 3341 * 3342 * @private 3343 * @type {Boolean} 3344 */ 3345 var detached = false; 3346 3347 /** 3348 * Holds preventing status of anchors. 3349 * If `true` redirection after click will be disabled. 3350 * 3351 * @private 3352 * @type {Boolean} 3353 */ 3354 var prevented = false; 3355 3356 var Anchors = { 3357 /** 3358 * Setups a initial state of anchors component. 3359 * 3360 * @returns {Void} 3361 */ 3362 mount: function mount() { 3363 /** 3364 * Holds collection of anchors elements. 3365 * 3366 * @private 3367 * @type {HTMLCollection} 3368 */ 3369 this._a = Components.Html.wrapper.querySelectorAll('a'); 3370 3371 this.bind(); 3372 }, 3373 3374 3375 /** 3376 * Binds events to anchors inside a track. 3377 * 3378 * @return {Void} 3379 */ 3380 bind: function bind() { 3381 Binder.on('click', Components.Html.wrapper, this.click); 3382 }, 3383 3384 3385 /** 3386 * Unbinds events attached to anchors inside a track. 3387 * 3388 * @return {Void} 3389 */ 3390 unbind: function unbind() { 3391 Binder.off('click', Components.Html.wrapper); 3392 }, 3393 3394 3395 /** 3396 * Handler for click event. Prevents clicks when glide is in `prevent` status. 3397 * 3398 * @param {Object} event 3399 * @return {Void} 3400 */ 3401 click: function click(event) { 3402 if (prevented) { 3403 event.stopPropagation(); 3404 event.preventDefault(); 3405 } 3406 }, 3407 3408 3409 /** 3410 * Detaches anchors click event inside glide. 3411 * 3412 * @return {self} 3413 */ 3414 detach: function detach() { 3415 prevented = true; 3416 3417 if (!detached) { 3418 for (var i = 0; i < this.items.length; i++) { 3419 this.items[i].draggable = false; 3420 3421 this.items[i].setAttribute('data-href', this.items[i].getAttribute('href')); 3422 3423 this.items[i].removeAttribute('href'); 3424 } 3425 3426 detached = true; 3427 } 3428 3429 return this; 3430 }, 3431 3432 3433 /** 3434 * Attaches anchors click events inside glide. 3435 * 3436 * @return {self} 3437 */ 3438 attach: function attach() { 3439 prevented = false; 3440 3441 if (detached) { 3442 for (var i = 0; i < this.items.length; i++) { 3443 this.items[i].draggable = true; 3444 3445 this.items[i].setAttribute('href', this.items[i].getAttribute('data-href')); 3446 } 3447 3448 detached = false; 3449 } 3450 3451 return this; 3452 } 3453 }; 3454 3455 define(Anchors, 'items', { 3456 /** 3457 * Gets collection of the arrows HTML elements. 3458 * 3459 * @return {HTMLElement[]} 3460 */ 3461 get: function get() { 3462 return Anchors._a; 3463 } 3464 }); 3465 3466 /** 3467 * Detach anchors inside slides: 3468 * - on swiping, so they won't redirect to its `href` attributes 3469 */ 3470 Events.on('swipe.move', function () { 3471 Anchors.detach(); 3472 }); 3473 3474 /** 3475 * Attach anchors inside slides: 3476 * - after swiping and transitions ends, so they can redirect after click again 3477 */ 3478 Events.on('swipe.end', function () { 3479 Components.Transition.after(function () { 3480 Anchors.attach(); 3481 });
vendor: 10,290 bytes, lines 3482-3939
3482 }); 3483 3484 /** 3485 * Unbind anchors inside slides: 3486 * - on destroying, to bring anchors to its initial state 3487 */ 3488 Events.on('destroy', function () { 3489 Anchors.attach(); 3490 Anchors.unbind(); 3491 Binder.destroy(); 3492 }); 3493 3494 return Anchors; 3495} 3496 3497var NAV_SELECTOR = '[data-glide-el="controls[nav]"]'; 3498var CONTROLS_SELECTOR = '[data-glide-el^="controls"]'; 3499 3500function Controls (Glide, Components, Events) { 3501 /** 3502 * Instance of the binder for DOM Events. 3503 * 3504 * @type {EventsBinder} 3505 */ 3506 var Binder = new EventsBinder(); 3507 3508 var capture = supportsPassive$1 ? { passive: true } : false; 3509 3510 var Controls = { 3511 /** 3512 * Inits arrows. Binds events listeners 3513 * to the arrows HTML elements. 3514 * 3515 * @return {Void} 3516 */ 3517 mount: function mount() { 3518 /** 3519 * Collection of navigation HTML elements. 3520 * 3521 * @private 3522 * @type {HTMLCollection} 3523 */ 3524 this._n = Components.Html.root.querySelectorAll(NAV_SELECTOR); 3525 3526 /** 3527 * Collection of controls HTML elements. 3528 * 3529 * @private 3530 * @type {HTMLCollection} 3531 */ 3532 this._c = Components.Html.root.querySelectorAll(CONTROLS_SELECTOR); 3533 3534 this.addBindings(); 3535 }, 3536 3537 3538 /** 3539 * Sets active class to current slide. 3540 * 3541 * @return {Void} 3542 */ 3543 setActive: function setActive() { 3544 for (var i = 0; i < this._n.length; i++) { 3545 this.addClass(this._n[i].children); 3546 } 3547 }, 3548 3549 3550 /** 3551 * Removes active class to current slide. 3552 * 3553 * @return {Void} 3554 */ 3555 removeActive: function removeActive() { 3556 for (var i = 0; i < this._n.length; i++) { 3557 this.removeClass(this._n[i].children); 3558 } 3559 }, 3560 3561 3562 /** 3563 * Toggles active class on items inside navigation. 3564 * 3565 * @param {HTMLElement} controls 3566 * @return {Void} 3567 */ 3568 addClass: function addClass(controls) { 3569 var settings = Glide.settings; 3570 var item = controls[Glide.index]; 3571 3572 if (item) { 3573 item.classList.add(settings.classes.activeNav); 3574 3575 siblings(item).forEach(function (sibling) { 3576 sibling.classList.remove(settings.classes.activeNav); 3577 }); 3578 } 3579 }, 3580 3581 3582 /** 3583 * Removes active class from active control. 3584 * 3585 * @param {HTMLElement} controls 3586 * @return {Void} 3587 */ 3588 removeClass: function removeClass(controls) { 3589 var item = controls[Glide.index]; 3590 3591 if (item) { 3592 item.classList.remove(Glide.settings.classes.activeNav); 3593 } 3594 }, 3595 3596 3597 /** 3598 * Adds handles to the each group of controls. 3599 * 3600 * @return {Void} 3601 */ 3602 addBindings: function addBindings() { 3603 for (var i = 0; i < this._c.length; i++) { 3604 this.bind(this._c[i].children); 3605 } 3606 }, 3607 3608 3609 /** 3610 * Removes handles from the each group of controls. 3611 * 3612 * @return {Void} 3613 */ 3614 removeBindings: function removeBindings() { 3615 for (var i = 0; i < this._c.length; i++) { 3616 this.unbind(this._c[i].children); 3617 } 3618 }, 3619 3620 3621 /** 3622 * Binds events to arrows HTML elements. 3623 * 3624 * @param {HTMLCollection} elements 3625 * @return {Void} 3626 */ 3627 bind: function bind(elements) { 3628 for (var i = 0; i < elements.length; i++) { 3629 Binder.on('click', elements[i], this.click); 3630 Binder.on('touchstart', elements[i], this.click, capture); 3631 } 3632 }, 3633 3634 3635 /** 3636 * Unbinds events binded to the arrows HTML elements. 3637 * 3638 * @param {HTMLCollection} elements 3639 * @return {Void} 3640 */ 3641 unbind: function unbind(elements) { 3642 for (var i = 0; i < elements.length; i++) { 3643 Binder.off(['click', 'touchstart'], elements[i]); 3644 } 3645 }, 3646 3647 3648 /** 3649 * Handles `click` event on the arrows HTML elements. 3650 * Moves slider in driection precised in 3651 * `data-glide-dir` attribute. 3652 * 3653 * @param {Object} event 3654 * @return {Void} 3655 */ 3656 click: function click(event) { 3657 event.preventDefault(); 3658 3659 Components.Run.make(Components.Direction.resolve(event.currentTarget.getAttribute('data-glide-dir'))); 3660 } 3661 }; 3662 3663 define(Controls, 'items', { 3664 /** 3665 * Gets collection of the controls HTML elements. 3666 * 3667 * @return {HTMLElement[]} 3668 */ 3669 get: function get() { 3670 return Controls._c; 3671 } 3672 }); 3673 3674 /** 3675 * Swap active class of current navigation item: 3676 * - after mounting to set it to initial index 3677 * - after each move to the new index 3678 */ 3679 Events.on(['mount.after', 'move.after'], function () { 3680 Controls.setActive(); 3681 }); 3682 3683 /** 3684 * Remove bindings and HTML Classes: 3685 * - on destroying, to bring markup to its initial state 3686 */ 3687 Events.on('destroy', function () { 3688 Controls.removeBindings(); 3689 Controls.removeActive(); 3690 Binder.destroy(); 3691 }); 3692 3693 return Controls; 3694} 3695 3696function Keyboard (Glide, Components, Events) { 3697 /** 3698 * Instance of the binder for DOM Events. 3699 * 3700 * @type {EventsBinder} 3701 */ 3702 var Binder = new EventsBinder(); 3703 3704 var Keyboard = { 3705 /** 3706 * Binds keyboard events on component mount. 3707 * 3708 * @return {Void} 3709 */ 3710 mount: function mount() { 3711 if (Glide.settings.keyboard) { 3712 this.bind(); 3713 } 3714 }, 3715 3716 3717 /** 3718 * Adds keyboard press events. 3719 * 3720 * @return {Void} 3721 */ 3722 bind: function bind() { 3723 Binder.on('keyup', document, this.press); 3724 }, 3725 3726 3727 /** 3728 * Removes keyboard press events. 3729 * 3730 * @return {Void} 3731 */ 3732 unbind: function unbind() { 3733 Binder.off('keyup', document); 3734 }, 3735 3736 3737 /** 3738 * Handles keyboard's arrows press and moving glide foward and backward. 3739 * 3740 * @param {Object} event 3741 * @return {Void} 3742 */ 3743 press: function press(event) { 3744 if (event.keyCode === 39) { 3745 Components.Run.make(Components.Direction.resolve('>')); 3746 } 3747 3748 if (event.keyCode === 37) { 3749 Components.Run.make(Components.Direction.resolve('<')); 3750 } 3751 } 3752 }; 3753 3754 /** 3755 * Remove bindings from keyboard: 3756 * - on destroying to remove added events 3757 * - on updating to remove events before remounting 3758 */ 3759 Events.on(['destroy', 'update'], function () { 3760 Keyboard.unbind(); 3761 }); 3762 3763 /** 3764 * Remount component 3765 * - on updating to reflect potential changes in settings 3766 */ 3767 Events.on('update', function () { 3768 Keyboard.mount(); 3769 }); 3770 3771 /** 3772 * Destroy binder: 3773 * - on destroying to remove listeners 3774 */ 3775 Events.on('destroy', function () { 3776 Binder.destroy(); 3777 }); 3778 3779 return Keyboard; 3780} 3781 3782function Autoplay (Glide, Components, Events) { 3783 /** 3784 * Instance of the binder for DOM Events. 3785 * 3786 * @type {EventsBinder} 3787 */ 3788 var Binder = new EventsBinder(); 3789 3790 var Autoplay = { 3791 /** 3792 * Initializes autoplaying and events. 3793 * 3794 * @return {Void} 3795 */ 3796 mount: function mount() { 3797 this.start(); 3798 3799 if (Glide.settings.hoverpause) { 3800 this.bind(); 3801 } 3802 }, 3803 3804 3805 /** 3806 * Starts autoplaying in configured interval. 3807 * 3808 * @param {Boolean|Number} force Run autoplaying with passed interval regardless of `autoplay` settings 3809 * @return {Void} 3810 */ 3811 start: function start() { 3812 var _this = this; 3813 3814 if (Glide.settings.autoplay) { 3815 if (isUndefined(this._i)) { 3816 this._i = setInterval(function () { 3817 _this.stop(); 3818 3819 Components.Run.make('>'); 3820 3821 _this.start(); 3822 }, this.time); 3823 } 3824 } 3825 }, 3826 3827 3828 /** 3829 * Stops autorunning of the glide. 3830 * 3831 * @return {Void} 3832 */ 3833 stop: function stop() { 3834 this._i = clearInterval(this._i); 3835 }, 3836 3837 3838 /** 3839 * Stops autoplaying while mouse is over glide's area. 3840 * 3841 * @return {Void} 3842 */ 3843 bind: function bind() { 3844 var _this2 = this; 3845 3846 Binder.on('mouseover', Components.Html.root, function () { 3847 _this2.stop(); 3848 }); 3849 3850 Binder.on('mouseout', Components.Html.root, function () { 3851 _this2.start(); 3852 }); 3853 }, 3854 3855 3856 /** 3857 * Unbind mouseover events. 3858 * 3859 * @returns {Void} 3860 */ 3861 unbind: function unbind() { 3862 Binder.off(['mouseover', 'mouseout'], Components.Html.root); 3863 } 3864 }; 3865 3866 define(Autoplay, 'time', { 3867 /** 3868 * Gets time period value for the autoplay interval. Prioritizes 3869 * times in `data-glide-autoplay` attrubutes over options. 3870 * 3871 * @return {Number} 3872 */ 3873 get: function get() { 3874 var autoplay = Components.Html.slides[Glide.index].getAttribute('data-glide-autoplay'); 3875 3876 if (autoplay) { 3877 return toInt(autoplay); 3878 } 3879 3880 return toInt(Glide.settings.autoplay); 3881 } 3882 }); 3883 3884 /** 3885 * Stop autoplaying and unbind events: 3886 * - on destroying, to clear defined interval 3887 * - on updating via API to reset interval that may changed 3888 */ 3889 Events.on(['destroy', 'update'], function () { 3890 Autoplay.unbind(); 3891 }); 3892 3893 /** 3894 * Stop autoplaying: 3895 * - before each run, to restart autoplaying 3896 * - on pausing via API 3897 * - on destroying, to clear defined interval 3898 * - while starting a swipe 3899 * - on updating via API to reset interval that may changed 3900 */ 3901 Events.on(['run.before', 'pause', 'destroy', 'swipe.start', 'update'], function () { 3902 Autoplay.stop(); 3903 }); 3904 3905 /** 3906 * Start autoplaying: 3907 * - after each run, to restart autoplaying 3908 * - on playing via API 3909 * - while ending a swipe 3910 */ 3911 Events.on(['run.after', 'play', 'swipe.end'], function () { 3912 Autoplay.start(); 3913 }); 3914 3915 /** 3916 * Remount autoplaying: 3917 * - on updating via API to reset interval that may changed 3918 */ 3919 Events.on('update', function () { 3920 Autoplay.mount(); 3921 }); 3922 3923 /** 3924 * Destroy a binder: 3925 * - on destroying glide instance to clearup listeners 3926 */ 3927 Events.on('destroy', function () { 3928 Binder.destroy(); 3929 }); 3930 3931 return Autoplay; 3932} 3933 3934/** 3935 * Sorts keys of breakpoint object so they will be ordered from lower to bigger. 3936 * 3937 * @param {Object} points 3938 * @returns {Object} 3939 */
3940function sortBreakpoints(points) { 3941 if (isObject(points)) { 3942 return sortKeys(points); 3943 } else { 3944 warn('Breakpoints option must be an object'); 3945 } 3946 3947 return {}; 3948} 3949 3950function Breakpoints (Glide, Components, Events) { 3951 /** 3952 * Instance of the binder for DOM Events. 3953 * 3954 * @type {EventsBinder} 3955 */ 3956 var Binder = new EventsBinder(); 3957 3958 /** 3959 * Holds reference to settings. 3960 * 3961 * @type {Object} 3962 */ 3963 var settings = Glide.settings; 3964 3965 /** 3966 * Holds reference to breakpoints object in settings. Sorts breakpoints 3967 * from smaller to larger. It is required in order to proper 3968 * matching currently active breakpoint settings. 3969 * 3970 * @type {Object} 3971 */ 3972 var points = sortBreakpoints(settings.breakpoints); 3973 3974 /** 3975 * Cache initial settings before overwritting. 3976 * 3977 * @type {Object} 3978 */ 3979 var defaults = _extends({}, settings); 3980 3981 var Breakpoints = { 3982 /** 3983 * Matches settings for currectly matching media breakpoint. 3984 * 3985 * @param {Object} points 3986 * @returns {Object} 3987 */ 3988 match: function match(points) { 3989 if (typeof window.matchMedia !== 'undefined') { 3990 for (var point in points) { 3991 if (points.hasOwnProperty(point)) { 3992 if (window.matchMedia('(max-width: ' + point + 'px)').matches) { 3993 return points[point]; 3994 } 3995 } 3996 } 3997 } 3998 3999 return defaults; 4000 } 4001 }; 4002 4003 /** 4004 * Overwrite instance settings with currently matching breakpoint settings. 4005 * This happens right after component initialization. 4006 */ 4007 _extends(settings, Breakpoints.match(points)); 4008 4009 /** 4010 * Update glide with settings of matched brekpoint: 4011 * - window resize to update slider 4012 */ 4013 Binder.on('resize', window, throttle(function () { 4014 Glide.settings = mergeOptions(settings, Breakpoints.match(points)); 4015 }, Glide.settings.throttle)); 4016 4017 /** 4018 * Resort and update default settings: 4019 * - on reinit via API, so breakpoint matching will be performed with options 4020 */ 4021 Events.on('update', function () { 4022 points = sortBreakpoints(points); 4023 4024 defaults = _extends({}, settings); 4025 }); 4026 4027 /** 4028 * Unbind resize listener: 4029 * - on destroying, to bring markup to its initial state 4030 */ 4031 Events.on('destroy', function () { 4032 Binder.off('resize', window); 4033 }); 4034 4035 return Breakpoints; 4036} 4037 4038var COMPONENTS = { 4039 // Required 4040 Html: Html, 4041 Translate: Translate, 4042 Transition: Transition, 4043 Direction: Direction, 4044 Peek: Peek, 4045 Sizes: Sizes, 4046 Gaps: Gaps, 4047 Move: Move, 4048 Clones: Clones, 4049 Resize: Resize, 4050 Build: Build, 4051 Run: Run, 4052 4053 // Optional 4054 Swipe: Swipe, 4055 Images: Images, 4056 Anchors: Anchors, 4057 Controls: Controls, 4058 Keyboard: Keyboard, 4059 Autoplay: Autoplay, 4060 Breakpoints: Breakpoints 4061}; 4062 4063var Glide$1 = function (_Core) { 4064 inherits(Glide$$1, _Core); 4065 4066 function Glide$$1() { 4067 classCallCheck(this, Glide$$1); 4068 return possibleConstructorReturn(this, (Glide$$1.__proto__ || Object.getPrototypeOf(Glide$$1)).apply(this, arguments)); 4069 } 4070 4071 createClass(Glide$$1, [{ 4072 key: 'mount', 4073 value: function mount() { 4074 var extensions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 4075 4076 return get(Glide$$1.prototype.__proto__ || Object.getPrototypeOf(Glide$$1.prototype), 'mount', this).call(this, _extends({}, COMPONENTS, extensions)); 4077 } 4078 }]); 4079 return Glide$$1; 4080}(Glide); 4081 4082/* harmony default export */ __webpack_exports__["default"] = (Glide$1); 4083 4084 4085/***/ }), 4086/* 2 */ 4087/***/ (function(module, exports, __webpack_require__) { 4088 4089"use strict"; 4090 4091 4092/** 4093 * Just a basic example class to show that the ES6 transpiling works 4094 * 4095 */ 4096 4097// ES6 class definition 4098 4099Object.defineProperty(exports, "__esModule", { 4100 value: true 4101}); 4102 4103var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4104 4105function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 4106 4107var EventsMap = function () { 4108 function EventsMap() { 4109 _classCallCheck(this, EventsMap); 4110 4111 this.debug = false; 4112 this.whatAmI = 'I\'m an EventsMap ES6 class initialized'; 4113 4114 this.selectors = { 4115 map: '.map-container', 4116 mapPoints: '.map-points', 4117 teaser: { 4118 class: '.ce-map__event', 4119 id: '#ce-map__event-' 4120 }, 4121 point: '.map_point__trigger', 4122 pointActive: '.map_point__trigger.active', 4123 mapLegendItem: '.map_legend__trigger' 4124 }; 4125 4126 this.lastPointHover = null; 4127 } 4128 4129 _createClass(EventsMap, [{ 4130 key: 'init',
4131 value: function init() { 4132 4133 var self = this; 4134 4135 self.initMap(); 4136 self.initMapPoints(); 4137 self.initMapLegend(); 4138 4139 self.log(self.whatAmI); 4140 } 4141 }, { 4142 key: 'initMapLegend', 4143 value: function initMapLegend() { 4144 var self = this; 4145 var legendItems = $(self.selectors.mapLegendItem); 4146 legendItems.each(function () { 4147 var item = $(this); 4148 4149 item.click(function (e) { 4150 e.stopPropagation(); 4151 self.doLegendItemClick(item); 4152 }); 4153 }); 4154 } 4155 }, { 4156 key: 'initMap', 4157 value: function initMap() { 4158 var self = this; 4159 var map = $(self.selectors.map); 4160 map.click(function (e) { 4161 e.stopPropagation(); 4162 self.resetMapInitState(); 4163 }); 4164 } 4165 }, { 4166 key: 'resetMapInitState', 4167 value: function resetMapInitState() { 4168 var self = this; 4169 var points = $(self.selectors.pointActive); 4170 4171 //self.log('resetMapInitState:'); 4172 4173 points.each(function () { 4174 var item = $(this); 4175 item.removeClass('active'); 4176 }); 4177 } 4178 }, { 4179 key: 'initMapPoints', 4180 value: function initMapPoints() { 4181 var self = this; 4182 var points = $(self.selectors.point); 4183 points.each(function () { 4184 var item = $(this); 4185 4186 item.mouseover(function (e) { 4187 e.stopPropagation(); 4188 self.doMapItemHover(item); 4189 }); 4190 4191 item.click(function (e) { 4192 e.stopPropagation(); 4193 self.doMapItemClick(item); 4194 }); 4195 }); 4196 } 4197 }, { 4198 key: 'doMapItemHover', 4199 value: function doMapItemHover(item) { 4200 var self = this; 4201 4202 if (!item.hasClass('active')) { 4203 self.resetMapInitState(); 4204 } 4205 4206 if (self.lastPointHover) { 4207 self.lastPointHover.css('z-index', 0); 4208 } 4209 4210 self.lastPointHover = item; 4211 item.css('z-index', 1000); 4212 } 4213 }, { 4214 key: 'doLegendItemClick', 4215 value: function doLegendItemClick(item) { 4216 var self = this; 4217 4218 self.resetMapInitState(); 4219 var pointsType = item.attr('data-point-type'); 4220 4221 if (item.hasClass('disabled')) { 4222 item.removeClass('disabled'); 4223 self.showPointsByType(pointsType); 4224 } else { 4225 item.addClass('disabled'); 4226 self.hidePointsByType(pointsType); 4227 } 4228 } 4229 }, { 4230 key: 'showPointsByType', 4231 value: function showPointsByType(pointsType) { 4232 var self = this; 4233 4234 var pointsByType = $(self.selectors.mapPoints + ' .' + pointsType); 4235 4236 pointsByType.show(); 4237 } 4238 }, { 4239 key: 'hidePointsByType', 4240 value: function hidePointsByType(pointsType) { 4241 var self = this; 4242 4243 var pointsByType = $(self.selectors.mapPoints + ' .' + pointsType); 4244 4245 pointsByType.hide(); 4246 } 4247 }, { 4248 key: 'doMapItemClick', 4249 value: function doMapItemClick(item) { 4250 var self = this; 4251 4252 if (!item.hasClass('active')) { 4253 var uid = item.attr('data-point-uid'); 4254 // hide title of active map point 4255 self.resetMapInitState(); 4256 item.addClass('active'); 4257 self.showEventTeaser(uid); 4258 } else { 4259 self.resetMapInitState(); 4260 } 4261 } 4262 }, { 4263 key: 'showEventTeaser', 4264 value: function showEventTeaser(uid) { 4265 var self = this; 4266 var teasers = $(self.selectors.teaser.class); 4267 teasers.removeClass('active'); 4268 4269 var itemId = self.selectors.teaser.id + uid; 4270 var teaserToShow = $(itemId).addClass('active'); 4271 } 4272 }, { 4273 key: 'log', 4274 value: function log(message, obj) { 4275 if (this.debug) { 4276 console.log(message); 4277 if (obj) { 4278 console.log(obj); 4279 } 4280 } 4281 } 4282 }]); 4283 4284 return EventsMap; 4285}(); 4286 4287exports.default = EventsMap; 4288 4289/***/ }), 4290/* 3 */ 4291/***/ (function(module, exports, __webpack_require__) { 4292 4293"use strict"; 4294 4295 4296Object.defineProperty(exports, "__esModule", { 4297 value: true 4298}); 4299 4300var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 4301 4302var _glide = __webpack_require__(1); 4303 4304var _glide2 = _interopRequireDefault(_glide); 4305 4306function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 4307 4308function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 4309 4310var GliderSlider = function () { 4311 function GliderSlider() { 4312 _classCallCheck(this, GliderSlider); 4313 4314 this.whatAmI = "I'm the GliderSlider JS", this.controlArrow = "glide__arrows", this.activeSliders = "glide__slide", this.controlBullets = "glide__bullets", this.elementSelector = [".ce-news__hero", ".ce-news__slider", ".ce-cards__slider"], this.debugMode = false; 4315 } 4316 4317 /** 4318 * Intitializes gliders of different kinds 4319 */ 4320 4321 4322 _createClass(GliderSlider, [{ 4323 key: "init",
4324 value: function init() { 4325 var self = this; 4326 4327 self.logToConsole(self.whatAmI); 4328 4329 self.elementSelector.forEach(function (element) { 4330 if (document.querySelector(element)) { 4331 switch (element) { 4332 // settings and actions for the selectors 4333 case ".ce-news__hero": 4334 case ".ce-news__slider": 4335 // init glide, if there is more than a element 4336 if (self.activeControls(element)) { 4337 new _glide2.default(element, { 4338 type: "carousel", 4339 autoplay: 6000, 4340 gap: 0, 4341 animationDuration: 800 4342 }).mount(); 4343 } 4344 break; 4345 // settings and actions for the selectors 4346 case ".ce-cards__slider": 4347 // init glide, if there is more than a element 4348 if (self.activeControls(element)) { 4349 var slider_cards = new _glide2.default(element, { 4350 type: "carousel", 4351 autoplay: false, 4352 gap: 30, 4353 perView: 5, 4354 touchRatio: false, 4355 animationDuration: 800, 4356 breakpoints: { 4357 800: { 4358 perView: 2 4359 }, 4360 480: { 4361 perView: 1 4362 } 4363 } 4364 }).mount(); 4365 4366 } 4367 break; 4368 4369 default: 4370 break; 4371 } 4372 } 4373 }); 4374 } 4375 4376 /** 4377 * Method to active or disable Glides controls 4378 * @param 4379 */ 4380 4381 }, { 4382 key: "activeControls", 4383 value: function activeControls(selectorClass) { 4384 var self = this, 4385 myBulltes = "", 4386 mainSelectorGlide = document.querySelectorAll(selectorClass)[0], 4387 myArrows = mainSelectorGlide.getElementsByClassName(self.activeSliders).length; 4388 4389 // disable controls 4390 if (myArrows < 2) { 4391 mainSelectorGlide.getElementsByClassName(self.controlArrow)[0].remove(); 4392 mainSelectorGlide.getElementsByClassName(self.controlBullets)[0].remove(); 4393 return false; 4394 } 4395 // active controls arrows and bullets 4396 else { 4397 for (var i = 0; i < myArrows; i++) { 4398 myBulltes += '<button aria-label="glide bullet name" class="glide__bullet" data-glide-dir="=' + i + '"></button>'; 4399 } 4400 mainSelectorGlide.getElementsByClassName(self.controlBullets)[0].innerHTML = myBulltes; 4401 return true; 4402 } 4403 } 4404 4405 /** 4406 * Method to log objects, strings, etc. to console; only acts if debugMode is on 4407 * @param consoleOutput 4408 */ 4409 4410 }, { 4411 key: "logToConsole", 4412 value: function logToConsole(consoleOutput) { 4413 var self = this; 4414 4415 if (self.debugMode) { 4416 console.log(consoleOutput); 4417 } 4418 } 4419 }]); 4420 4421 return GliderSlider; 4422}(); 4423
vendor: 4,971 bytes, lines 4424-4432
4424exports.default = GliderSlider; 4425 4426/***/ }), 4427/* 4 */ 4428/***/ (function(module, exports, __webpack_require__) { 4429 4430/* WEBPACK VAR INJECTION */(function(global) {var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! smooth-scroll v16.1.3 | (c) 2020 Chris Ferdinandi | MIT License | http://github.com/cferdinandi/smooth-scroll */ 4431window.Element&&!Element.prototype.closest&&(Element.prototype.closest=function(e){var t,n=(this.document||this.ownerDocument).querySelectorAll(e),o=this;do{for(t=n.length;0<=--t&&n.item(t)!==o;);}while(t<0&&(o=o.parentElement));return o}),(function(){if("function"==typeof window.CustomEvent)return;function e(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n}e.prototype=window.Event.prototype,window.CustomEvent=e})(),(function(){for(var r=0,e=["ms","moz","webkit","o"],t=0;t<e.length&&!window.requestAnimationFrame;++t)window.requestAnimationFrame=window[e[t]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[e[t]+"CancelAnimationFrame"]||window[e[t]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(e,t){var n=(new Date).getTime(),o=Math.max(0,16-(n-r)),a=window.setTimeout((function(){e(n+o)}),o);return r=n+o,a}),window.cancelAnimationFrame||(window.cancelAnimationFrame=function(e){clearTimeout(e)})})(),(function(e,t){ true?!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function(){return t(e)}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), 4432 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)):"object"==typeof exports?module.exports=t(e):e.SmoothScroll=t(e)})("undefined"!=typeof global?global:"undefined"!=typeof window?window:this,(function(M){"use strict";var q={ignore:"[data-scroll-ignore]",header:null,topOnEmptyHash:!0,speed:500,speedAsDuration:!1,durationMax:null,durationMin:null,clip:!0,offset:0,easing:"easeInOutCubic",customEasing:null,updateURL:!0,popstate:!0,emitEvents:!0},I=function(){var n={};return Array.prototype.forEach.call(arguments,(function(e){for(var t in e){if(!e.hasOwnProperty(t))return;n[t]=e[t]}})),n},r=function(e){"#"===e.charAt(0)&&(e=e.substr(1));for(var t,n=String(e),o=n.length,a=-1,r="",i=n.charCodeAt(0);++a<o;){if(0===(t=n.charCodeAt(a)))throw new InvalidCharacterError("Invalid character: the input contains U+0000.");1<=t&&t<=31||127==t||0===a&&48<=t&&t<=57||1===a&&48<=t&&t<=57&&45===i?r+="\\"+t.toString(16)+" ":r+=128<=t||45===t||95===t||48<=t&&t<=57||65<=t&&t<=90||97<=t&&t<=122?n.charAt(a):"\\"+n.charAt(a)}return"#"+r},F=function(){return Math.max(document.body.scrollHeight,document.documentElement.scrollHeight,document.body.offsetHeight,document.documentElement.offsetHeight,document.body.clientHeight,document.documentElement.clientHeight)},L=function(e){return e?(t=e,parseInt(M.getComputedStyle(t).height,10)+e.offsetTop):0;var t},x=function(e,t,n){0===e&&document.body.focus(),n||(e.focus(),document.activeElement!==e&&(e.setAttribute("tabindex","-1"),e.focus(),e.style.outline="none"),M.scrollTo(0,t))},H=function(e,t,n,o){if(t.emitEvents&&"function"==typeof M.CustomEvent){var a=new CustomEvent(e,{bubbles:!0,detail:{anchor:n,toggle:o}});document.dispatchEvent(a)}};return function(o,e){var b,a,A,O,C={};C.cancelScroll=function(e){cancelAnimationFrame(O),O=null,e||H("scrollCancel",b)},C.animateScroll=function(a,r,e){C.cancelScroll();var i=I(b||q,e||{}),c="[object Number]"===Object.prototype.toString.call(a),t=c||!a.tagName?null:a;if(c||t){var s=M.pageYOffset;i.header&&!A&&(A=document.querySelector(i.header));var n,o,u,l,m,d,f,h,p=L(A),g=c?a:(function(e,t,n,o){var a=0;if(e.offsetParent)for(;a+=e.offsetTop,e=e.offsetParent;);return a=Math.max(a-t-n,0),o&&(a=Math.min(a,F()-M.innerHeight)),a})(t,p,parseInt("function"==typeof i.offset?i.offset(a,r):i.offset,10),i.clip),y=g-s,v=F(),w=0,S=(n=y,u=(o=i).speedAsDuration?o.speed:Math.abs(n/1e3*o.speed),o.durationMax&&u>o.durationMax?o.durationMax:o.durationMin&&u<o.durationMin?o.durationMin:parseInt(u,10)),E=function(e){var t,n,o;l||(l=e),w+=e-l,d=s+y*(n=m=1<(m=0===S?0:w/S)?1:m,"easeInQuad"===(t=i).easing&&(o=n*n),"easeOutQuad"===t.easing&&(o=n*(2-n)),"easeInOutQuad"===t.easing&&(o=n<.5?2*n*n:(4-2*n)*n-1),"easeInCubic"===t.easing&&(o=n*n*n),"easeOutCubic"===t.easing&&(o=--n*n*n+1),"easeInOutCubic"===t.easing&&(o=n<.5?4*n*n*n:(n-1)*(2*n-2)*(2*n-2)+1),"easeInQuart"===t.easing&&(o=n*n*n*n),"easeOutQuart"===t.easing&&(o=1- --n*n*n*n),"easeInOutQuart"===t.easing&&(o=n<.5?8*n*n*n*n:1-8*--n*n*n*n),"easeInQuint"===t.easing&&(o=n*n*n*n*n),"easeOutQuint"===t.easing&&(o=1+--n*n*n*n*n),"easeInOutQuint"===t.easing&&(o=n<.5?16*n*n*n*n*n:1+16*--n*n*n*n*n),t.customEasing&&(o=t.customEasing(n)),o||n),M.scrollTo(0,Math.floor(d)),(function(e,t){var n=M.pageYOffset;if(e==t||n==t||(s<t&&M.innerHeight+n)>=v)return C.cancelScroll(!0),x(a,t,c),H("scrollStop",i,a,r),!(O=l=null)}
4432)(d,g)||(O=M.requestAnimationFrame(E),l=e)};0===M.pageYOffset&&M.scrollTo(0,0),f=a,h=i,c||history.pushState&&h.updateURL&&history.pushState({smoothScroll:JSON.stringify(h),anchor:f.id},document.title,f===document.documentElement?"#top":"#"+f.id),"matchMedia"in M&&M.matchMedia("(prefers-reduced-motion)").matches?x(a,Math.floor(g),!1):(H("scrollStart",i,a,r),C.cancelScroll(!0),M.requestAnimationFrame(E))}};var t=function(e){if(!e.defaultPrevented&&!(0!==e.button||e.metaKey||e.ctrlKey||e.shiftKey)&&"closest"in e.target&&(a=e.target.closest(o))&&"a"===a.tagName.toLowerCase()&&!e.target.closest(b.ignore)&&a.hostname===M.location.hostname&&a.pathname===M.location.pathname&&/#/.test(a.href)){var t,n;try{t=r(decodeURIComponent(a.hash))}catch(e){t=r(a.hash)}if("#"===t){if(!b.topOnEmptyHash)return;n=document.documentElement}else n=document.querySelector(t);(n=n||"#top"!==t?n:document.documentElement)&&(e.preventDefault(),(function(e){if(history.replaceState&&e.updateURL&&!history.state){var t=M.location.hash;t=t||"",history.replaceState({smoothScroll:JSON.stringify(e),anchor:t||M.pageYOffset},document.title,t||M.location.href)}})(b),C.animateScroll(n,a))}},n=function(e){if(null!==history.state&&history.state.smoothScroll&&history.state.smoothScroll===JSON.stringify(b)){var t=history.state.anchor;"string"==typeof t&&t&&!(t=document.querySelector(r(history.state.anchor)))||C.animateScroll(t,null,{updateURL:!1})}};C.destroy=function(){b&&(document.removeEventListener("click",t,!1),M.removeEventListener("popstate",n,!1),C.cancelScroll(),O=A=a=b=null)};return (function(){if(!("querySelector"in document&&"addEventListener"in M&&"requestAnimationFrame"in M&&"closest"in M.Element.prototype))throw"Smooth Scroll: This browser does not support the required JavaScript methods and browser APIs.";C.destroy(),b=I(q,e||{}),A=b.header?document.querySelector(b.header):null,document.addEventListener("click",t,!1),b.updateURL&&b.popstate&&M.addEventListener("popstate",n,!1)})(),C}})); 4433/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(7))) 4434 4435/***/ }), 4436/* 5 */ 4437/***/ (function(module, exports, __webpack_require__) { 4438 4439var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;function _extends(){return(_extends=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])}return t}).apply(this,arguments)}function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}!function(t,e){"object"===( false?"undefined":_typeof(exports))&&"undefined"!=typeof module?module.exports=e(): true?!(__WEBPACK_AMD_DEFINE_FACTORY__ = (e), 4440 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? 4441 (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : 4442 __WEBPACK_AMD_DEFINE_FACTORY__), 4443 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)):(t=t||self).LazyLoad=e()}(this,function(){"use strict";var t="undefined"!=typeof window,e=t&&!("onscroll"in window)||"undefined"!=typeof navigator&&/(gle|ing|ro)bot|crawl|spider/i.test(navigator.userAgent),n=t&&"IntersectionObserver"in window,o=t&&"classList"in document.createElement("p"),r={elements_selector:"img",container:e||t?document:null,threshold:300,thresholds:null,data_src:"src",data_srcset:"srcset",data_sizes:"sizes",data_bg:"bg",data_poster:"poster",class_loading:"loading",class_loaded:"loaded",class_error:"error",load_delay:0,auto_unobserve:!0,callback_enter:null,callback_exit:null,callback_reveal:null,callback_loaded:null,callback_error:null,callback_finish:null,use_native:!1},a=function(t,e){var n,o=new t(e);try{n=new CustomEvent("LazyLoad::Initialized",{detail:{instance:o}})}catch(t){(n=document.createEvent("CustomEvent")).initCustomEvent("LazyLoad::Initialized",!1,!1,{instance:o})}window.dispatchEvent(n)};var s=function(t,e){return t.getAttribute("data-"+e)},i=function(t,e,n){var o="data-"+e;null!==n?t.setAttribute(o,n):t.removeAttribute(o)},c=function(t){return"true"===s(t,"was-processed")},l=function(t,e){return i(t,"ll-timeout",e)},u=function(t){return s(t,"ll-timeout")},d=function(t,e,n,o){t&&(void 0===o?void 0===n?t(e):t(e,n):t(e,n,o))},f=function(t,e){t.loadingCount+=e,0===t._elements.length&&0===t.loadingCount&&d(t._settings.callback_finish,t)},_=function(t){for(var e,n=[],o=0;e=t.children[o];o+=1)"SOURCE"===e.tagName&&n.push(e);return n},v=function(t,e,n){n&&t.setAttribute(e,n)},g=function(t,e){v(t,"sizes",s(t,e.data_sizes)),v(t,"srcset",s(t,e.data_srcset)),v(t,"src",s(t,e.data_src))},m={IMG:function(t,e){var n=t.parentNode;
4443n&&"PICTURE"===n.tagName&&_(n).forEach(function(t){g(t,e)});g(t,e)},IFRAME:function(t,e){v(t,"src",s(t,e.data_src))},VIDEO:function(t,e){_(t).forEach(function(t){v(t,"src",s(t,e.data_src))}),v(t,"poster",s(t,e.data_poster)),v(t,"src",s(t,e.data_src)),t.load()}},h=function(t,e){var n,o,r=e._settings,a=t.tagName,i=m[a];if(i)return i(t,r),f(e,1),void(e._elements=(n=e._elements,o=t,n.filter(function(t){return t!==o})));!function(t,e){var n=s(t,e.data_src),o=s(t,e.data_bg);n&&(t.style.backgroundImage='url("'.concat(n,'")')),o&&(t.style.backgroundImage=o)}(t,r)},p=function(t,e){o?t.classList.add(e):t.className+=(t.className?" ":"")+e},b=function(t,e){o?t.classList.remove(e):t.className=t.className.replace(new RegExp("(^|\\s+)"+e+"(\\s+|$)")," ").replace(/^\s+/,"").replace(/\s+$/,"")},y=function(t,e,n){t.addEventListener(e,n)},E=function(t,e,n){t.removeEventListener(e,n)},w=function(t,e,n){E(t,"load",e),E(t,"loadeddata",e),E(t,"error",n)},I=function(t,e,n){var o=n._settings,r=e?o.class_loaded:o.class_error,a=e?o.callback_loaded:o.callback_error,s=t.target;b(s,o.class_loading),p(s,r),d(a,s,n),f(n,-1)},k=function(t,e){var n=function n(r){I(r,!0,e),w(t,n,o)},o=function o(r){I(r,!1,e),w(t,n,o)};!function(t,e,n){y(t,"load",e),y(t,"loadeddata",e),y(t,"error",n)}(t,n,o)},A=["IMG","IFRAME","VIDEO"],L=function(t,e){var n=e._observer;O(t,e),n&&e._settings.auto_unobserve&&n.unobserve(t)},x=function(t){var e=u(t);e&&(clearTimeout(e),l(t,null))},z=function(t,e){var n=e._settings.load_delay,o=u(t);o||(o=setTimeout(function(){L(t,e),x(t)},n),l(t,o))},O=function(t,e,n){var o=e._settings;!n&&c(t)||(A.indexOf(t.tagName)>-1&&(k(t,e),p(t,o.class_loading)),h(t,e),function(t){i(t,"was-processed","true")}(t),d(o.callback_reveal,t,e),d(o.callback_set,t,e))},N=function(t){return!!n&&(t._observer=new IntersectionObserver(function(e){e.forEach(function(e){return function(t){return t.isIntersecting||t.intersectionRatio>0}(e)?function(t,e,n){var o=n._settings;d(o.callback_enter,t,e,n),o.load_delay?z(t,n):L(t,n)}(e.target,e,t):function(t,e,n){var o=n._settings;d(o.callback_exit,t,e,n),o.load_delay&&x(t)}(e.target,e,t)})},{root:(e=t._settings).container===document?null:e.container,rootMargin:e.thresholds||e.threshold+"px"}),!0);var e},C=["IMG","IFRAME"],M=function(t,e){return function(t){return t.filter(function(t){return!c(t)})}((n=t||function(t){return t.container.querySelectorAll(t.elements_selector)}(e),Array.prototype.slice.call(n)));var n},S=function(t){var e=t._settings;e.container.querySelectorAll("."+e.class_error).forEach(function(t){b(t,e.class_error),function(t){i(t,"was-processed",null)}(t)}),t.update()},R=function(e,n){var o;this._settings=function(t){return _extends({},r,t)}(e),this.loadingCount=0,N(this),this.update(n),o=this,t&&window.addEventListener("online",function(t){S(o)})};return R.prototype={update:function(t){var n,o=this,r=this._settings;(this._elements=M(t,r),!e&&this._observer)?(function(t){return t.use_native&&"loading"in HTMLImageElement.prototype}(r)&&((n=this)._elements.forEach(function(t){-1!==C.indexOf(t.tagName)&&(t.setAttribute("loading","lazy"),O(t,n))}),this._elements=M(t,r)),this._elements.forEach(function(t){o._observer.observe(t)})):this.loadAll()},destroy:function(){var t=this;this._observer&&(this._elements.forEach(function(e){t._observer.unobserve(e)}),this._observer=null),this._elements=null,this._settings=null},load:function(t,e){O(t,this,e)},loadAll:function(){var t=this;this._elements.forEach(function(e){L(e,t)})}},t&&function(t,e){if(e)if(e.length)for(var n,o=0;n=e[o];o+=1)a(t,n);else a(t,e)}(R,window.lazyLoadOptions),R}); 4444//# sourceMappingURL=lazyload.min.js.map 4445 4446 4447/***/ }), 4448/* 6 */ 4449/***/ (function(module, exports, __webpack_require__) { 4450 4451var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! 4452 * viewport-units-buggyfill v0.6.2 4453 * @web: https://github.com/rodneyrehm/viewport-units-buggyfill/ 4454 * @author: Rodney Rehm - http://rodneyrehm.de/en/ 4455 */ 4456 4457(function() { 4458 (function(root, factory) { 4459 'use strict'; 4460 if (true) { 4461 // AMD. Register as an anonymous module. 4462 !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), 4463 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? 4464 (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), 4465 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 4466 } else if (typeof exports === 'object') { 4467 // Node. Does not work with strict CommonJS, but 4468 // only CommonJS-like enviroments that support module.exports, 4469 // like Node. 4470 module.exports = factory(); 4471 } else { 4472 // Browser globals (root is window)
4473 root.viewportUnitsBuggyfill = factory(); 4474 } 4475 }(this, function() { 4476 'use strict'; 4477 /* global document, window, navigator, location, XMLHttpRequest, XDomainRequest, CustomEvent */ 4478 4479 var initialized = false; 4480 var options; 4481 var userAgent = window.navigator.userAgent; 4482 var viewportUnitExpression = /([+-]?[0-9.]+)(vh|vw|vmin|vmax)/g; 4483 var urlExpression = /(https?:)?\/\// 4484 var forEach = [].forEach; 4485 var dimensions; 4486 var declarations; 4487 var styleNode; 4488 var isBuggyIE = /MSIE [0-9]\./i.test(userAgent); 4489 var isOldIE = /MSIE [0-8]\./i.test(userAgent); 4490 var isOperaMini = userAgent.indexOf('Opera Mini') > -1; 4491 4492 var isMobileSafari = /(iPhone|iPod|iPad).+AppleWebKit/i.test(userAgent) && (function() { 4493 // Regexp for iOS-version tested against the following userAgent strings: 4494 // Example WebView UserAgents: 4495 // * iOS Chrome on iOS8: "Mozilla/5.0 (iPad; CPU OS 8_1 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) CriOS/39.0.2171.50 Mobile/12B410 Safari/600.1.4" 4496 // * iOS Facebook on iOS7: "Mozilla/5.0 (iPhone; CPU iPhone OS 7_1_1 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Mobile/11D201 [FBAN/FBIOS;FBAV/12.1.0.24.20; FBBV/3214247; FBDV/iPhone6,1;FBMD/iPhone; FBSN/iPhone OS;FBSV/7.1.1; FBSS/2; FBCR/AT&T;FBID/phone;FBLC/en_US;FBOP/5]" 4497 // Example Safari UserAgents: 4498 // * Safari iOS8: "Mozilla/5.0 (iPhone; CPU iPhone OS 8_0 like Mac OS X) AppleWebKit/600.1.3 (KHTML, like Gecko) Version/8.0 Mobile/12A4345d Safari/600.1.4" 4499 // * Safari iOS7: "Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Version/7.0 Mobile/11A4449d Safari/9537.53" 4500 var iOSversion = userAgent.match(/OS (\d)/); 4501 // viewport units work fine in mobile Safari and webView on iOS 8+ 4502 return iOSversion && iOSversion.length > 1 && parseInt(iOSversion[1]) < 10; 4503 })(); 4504 4505 var isBadStockAndroid = (function() { 4506 // Android stock browser test derived from 4507 // http://stackoverflow.com/questions/24926221/distinguish-android-chrome-from-stock-browser-stock-browsers-user-agent-contai 4508 var isAndroid = userAgent.indexOf(' Android ') > -1; 4509 if (!isAndroid) { 4510 return false; 4511 } 4512 4513 var isStockAndroid = userAgent.indexOf('Version/') > -1; 4514 if (!isStockAndroid) { 4515 return false; 4516 } 4517 4518 var versionNumber = parseFloat((userAgent.match('Android ([0-9.]+)') || [])[1]); 4519 // anything below 4.4 uses WebKit without *any* viewport support, 4520 // 4.4 has issues with viewport units within calc() 4521 return versionNumber <= 4.4; 4522 })(); 4523 4524 // added check for IE10, IE11 and Edge < 20, since it *still* doesn't understand vmax 4525 // http://caniuse.com/#feat=viewport-units 4526 if (!isBuggyIE) { 4527 isBuggyIE = !!navigator.userAgent.match(/MSIE 10\.|Trident.*rv[ :]*1[01]\.| Edge\/1\d\./); 4528 } 4529 4530 // Polyfill for creating CustomEvents on IE9/10/11 4531 // from https://github.com/krambuhl/custom-event-polyfill 4532 try { 4533 // eslint-disable-next-line no-new, no-use-before-define 4534 new CustomEvent('test'); 4535 } catch (e) { 4536 var CustomEvent = function(event, params) { 4537 var evt; 4538 params = params || { 4539 bubbles: false, 4540 cancelable: false, 4541 detail: undefined, 4542 }; 4543 4544 evt = document.createEvent('CustomEvent'); 4545 evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail); 4546 return evt; 4547 }; 4548 CustomEvent.prototype = window.Event.prototype; 4549 window.CustomEvent = CustomEvent; // expose definition to window 4550 } 4551 4552 function debounce(func, wait) { 4553 var timeout; 4554 return function() { 4555 var context = this; 4556 var args = arguments; 4557 var callback = function() { 4558 func.apply(context, args); 4559 }; 4560 4561 clearTimeout(timeout); 4562 timeout = setTimeout(callback, wait); 4563 }; 4564 } 4565 4566 // from http://stackoverflow.com/questions/326069/how-to-identify-if-a-webpage-is-being-loaded-inside-an-iframe-or-directly-into-t 4567 function inIframe() {
4568 try { 4569 return window.self !== window.top; 4570 } catch (e) { 4571 return true; 4572 } 4573 } 4574 4575 function initialize(initOptions) { 4576 if (initialized) { 4577 return; 4578 } 4579 4580 if (initOptions === true) { 4581 initOptions = { 4582 force: true, 4583 }; 4584 } 4585 4586 options = initOptions || {}; 4587 options.isMobileSafari = isMobileSafari; 4588 options.isBadStockAndroid = isBadStockAndroid; 4589 4590 if (options.ignoreVmax && !options.force && !isOldIE) { 4591 // modern IE (10 and up) do not support vmin/vmax, 4592 // but chances are this unit is not even used, so 4593 // allow overwriting the "hacktivation" 4594 // https://github.com/rodneyrehm/viewport-units-buggyfill/issues/56 4595 isBuggyIE = false; 4596 } 4597 4598 if (isOldIE || (!options.force && !isMobileSafari && !isBuggyIE && !isBadStockAndroid && !isOperaMini && (!options.hacks || !options.hacks.required(options)))) { 4599 // this buggyfill only applies to mobile safari, IE9-10 and the Stock Android Browser. 4600 if (window.console && isOldIE) { 4601 console.info('viewport-units-buggyfill requires a proper CSSOM and basic viewport unit support, which are not available in IE8 and below'); 4602 } 4603 4604 return { 4605 init: function() {}, 4606 }; 4607 } 4608 4609 // fire a custom event that buggyfill was initialize 4610 window.dispatchEvent(new CustomEvent('viewport-units-buggyfill-init')); 4611 4612 options.hacks && options.hacks.initialize(options); 4613 4614 initialized = true; 4615 styleNode = document.createElement('style'); 4616 styleNode.id = 'patched-viewport'; 4617 document[options.appendToBody ? 'body' : 'head'].appendChild(styleNode); 4618 4619 // Issue #6: Cross Origin Stylesheets are not accessible through CSSOM, 4620 // therefore download and inject them as <style> to circumvent SOP. 4621 importCrossOriginLinks(function() { 4622 var _refresh = debounce(refresh, options.refreshDebounceWait || 100); 4623 // doing a full refresh rather than updateStyles because an orientationchange 4624 // could activate different stylesheets 4625 window.addEventListener('orientationchange', _refresh, true); 4626 // orientationchange might have happened while in a different window 4627 window.addEventListener('pageshow', _refresh, true); 4628 4629 if (options.force || isBuggyIE || inIframe()) { 4630 window.addEventListener('resize', _refresh, true); 4631 options._listeningToResize = true; 4632 } 4633 4634 options.hacks && options.hacks.initializeEvents(options, refresh, _refresh); 4635 4636 refresh(); 4637 }); 4638 } 4639 4640 function updateStyles() { 4641 styleNode.textContent = getReplacedViewportUnits(); 4642 // move to the end in case inline <style>s were added dynamically 4643 styleNode.parentNode.appendChild(styleNode); 4644 // fire a custom event that styles were updated 4645 window.dispatchEvent(new CustomEvent('viewport-units-buggyfill-style')); 4646 } 4647 4648 function refresh() { 4649 if (!initialized) { 4650 return; 4651 } 4652 4653 findProperties(); 4654 4655 // iOS Safari will report window.innerWidth and .innerHeight as 0 unless a timeout is used here.
4656 // TODO: figure out WHY innerWidth === 0 4657 setTimeout(function() { 4658 updateStyles(); 4659 }, 1); 4660 } 4661 4662 // http://stackoverflow.com/a/23613052 4663 function processStylesheet(ss) { 4664 // cssRules respects same-origin policy, as per 4665 // https://code.google.com/p/chromium/issues/detail?id=49001#c10. 4666 try { 4667 if (!ss.cssRules) { return; } 4668 } catch (e) { 4669 if (e.name !== 'SecurityError') { throw e; } 4670 return; 4671 } 4672 // ss.cssRules is available, so proceed with desired operations. 4673 var rules = []; 4674 for (var i = 0; i < ss.cssRules.length; i++) { 4675 var rule = ss.cssRules[i]; 4676 rules.push(rule); 4677 } 4678 return rules; 4679 } 4680 4681 function findProperties() { 4682 declarations = []; 4683 forEach.call(document.styleSheets, function(sheet) { 4684 var cssRules = processStylesheet(sheet); 4685 4686 if (!cssRules || sheet.ownerNode.id === 'patched-viewport' || sheet.ownerNode.getAttribute('data-viewport-units-buggyfill') === 'ignore') { 4687 // skip entire sheet because no rules are present, it's supposed to be ignored or it's the target-element of the buggyfill 4688 return; 4689 } 4690 4691 if (sheet.media && sheet.media.mediaText && window.matchMedia && !window.matchMedia(sheet.media.mediaText).matches) { 4692 // skip entire sheet because media attribute doesn't match 4693 return; 4694 } 4695 4696 forEach.call(cssRules, findDeclarations); 4697 }); 4698 4699 return declarations; 4700 } 4701 4702 function findDeclarations(rule) { 4703 if (rule.type === 7) { 4704 var value; 4705 4706 // there may be a case where accessing cssText throws an error. 4707 // I could not reproduce this issue, but the worst that can happen 4708 // this way is an animation not running properly. 4709 // not awesome, but probably better than a script error 4710 // see https://github.com/rodneyrehm/viewport-units-buggyfill/issues/21 4711 try { 4712 value = rule.cssText; 4713 } catch (e) { 4714 return; 4715 } 4716 4717 viewportUnitExpression.lastIndex = 0; 4718 if (viewportUnitExpression.test(value) && !urlExpression.test(value)) { 4719 // KeyframesRule does not have a CSS-PropertyName 4720 declarations.push([rule, null, value]); 4721 options.hacks && options.hacks.findDeclarations(declarations, rule, null, value); 4722 } 4723 4724 return; 4725 } 4726 4727 if (!rule.style) { 4728 if (!rule.cssRules) { 4729 return; 4730 } 4731 4732 forEach.call(rule.cssRules, function(_rule) { 4733 findDeclarations(_rule); 4734 }); 4735 4736 return; 4737 } 4738 4739 forEach.call(rule.style, function(name) { 4740 var value = rule.style.getPropertyValue(name); 4741 // preserve those !important rules 4742 if (rule.style.getPropertyPriority(name)) { 4743 value += ' !important'; 4744 } 4745 4746 viewportUnitExpression.lastIndex = 0; 4747 if (viewportUnitExpression.test(value)) { 4748 declarations.push([rule, name, value]); 4749 options.hacks && options.hacks.findDeclarations(declarations, rule, name, value); 4750 } 4751 }); 4752 } 4753 4754 function getReplacedViewportUnits() { 4755 dimensions = getViewport(); 4756 4757 var css = []; 4758 var buffer = []; 4759 var open; 4760 var close; 4761 4762 declarations.forEach(function(item) { 4763 var _item = overwriteDeclaration.apply(null, item); 4764 var _open = _item.selector.length ? (_item.selector.join(' {\n') + ' {\n') : ''; 4765 var _close = new Array(_item.selector.length + 1).join('\n}'); 4766 4767 if (!_open || _open !== open) { 4768 if (buffer.length) { 4769 css.push(open + buffer.join('\n') + close); 4770 buffer.length = 0; 4771 } 4772 4773 if (_open) { 4774 open = _open; 4775 close = _close; 4776 buffer.push(_item.content); 4777 } else { 4778 css.push(_item.content); 4779 open = null; 4780 close = null; 4781 } 4782 4783 return; 4784 } 4785 4786 if (_open && !open) { 4787 open = _open; 4788 close = _close; 4789 } 4790 4791 buffer.push(_item.content); 4792 }); 4793 4794 if (buffer.length) { 4795 css.push(open + buffer.join('\n') + close); 4796 } 4797 4798 // Opera Mini messes up on the content hack (it replaces the DOM node's innerHTML with the value). 4799 // This fixes it. We test for Opera Mini only since it is the most expensive CSS selector 4800 // see https://developer.mozilla.org/en-US/docs/Web/CSS/Universal_selectors 4801 if (isOperaMini) { 4802 css.push('* { content: normal !important; }'); 4803 } 4804 4805 return css.join('\n\n'); 4806 } 4807 4808 function overwriteDeclaration(rule, name, value) { 4809 var _value; 4810 var _selectors = []; 4811 4812 _value = value.replace(viewportUnitExpression, replaceValues); 4813 4814 if (options.hacks) { 4815 _value = options.hacks.overwriteDeclaration(rule, name, _value); 4816 } 4817 4818 if (name) { 4819 // skipping KeyframesRule 4820 _selectors.push(rule.selectorText); 4821 _value = name + ': ' + _value + ';'; 4822 } 4823 4824 var _rule = rule.parentRule; 4825 while (_rule) { 4826 if (_rule.media) { 4827 _selectors.unshift('@media ' + _rule.media.mediaText); 4828 } else if (_rule.conditionText) { 4829 _selectors.unshift('@supports ' + _rule.conditionText); 4830 } 4831 4832 _rule = _rule.parentRule; 4833 } 4834 4835 return { 4836 selector: _selectors, 4837 content: _value, 4838 }; 4839 } 4840 4841 function replaceValues(match, number, unit) { 4842 var _base = dimensions[unit]; 4843 var _number = parseFloat(number) / 100; 4844 return (_number * _base) + 'px'; 4845 } 4846 4847 function getViewport() { 4848 var vh = window.innerHeight; 4849 var vw = window.innerWidth; 4850 4851 return { 4852 vh: vh, 4853 vw: vw, 4854 vmax: Math.max(vw, vh), 4855 vmin: Math.min(vw, vh), 4856 }; 4857 } 4858 4859 function importCrossOriginLinks(next) { 4860 var _waiting = 0; 4861 var decrease = function() { 4862 _waiting--; 4863 if (!_waiting) { 4864 next(); 4865 } 4866 }; 4867
4868 forEach.call(document.styleSheets, function(sheet) { 4869 if (!sheet.href || origin(sheet.href) === origin(location.href) || sheet.ownerNode.getAttribute('data-viewport-units-buggyfill') === 'ignore') { 4870 // skip <style> and <link> from same origin or explicitly declared to ignore 4871 return; 4872 } 4873 4874 _waiting++; 4875 convertLinkToStyle(sheet.ownerNode, decrease); 4876 }); 4877 4878 if (!_waiting) { 4879 next(); 4880 } 4881 } 4882 4883 function origin(url) { 4884 return url.slice(0, url.indexOf('/', url.indexOf('://') + 3)); 4885 } 4886 4887 function convertLinkToStyle(link, next) { 4888 getCors(link.href, function() { 4889 var style = document.createElement('style'); 4890 style.media = link.media; 4891 style.setAttribute('data-href', link.href); 4892 style.textContent = this.responseText; 4893 link.parentNode.replaceChild(style, link); 4894 next(); 4895 }, next); 4896 } 4897 4898 function getCors(url, success, error) { 4899 var xhr = new XMLHttpRequest(); 4900 if ('withCredentials' in xhr) { 4901 // XHR for Chrome/Firefox/Opera/Safari. 4902 xhr.open('GET', url, true); 4903 } else if (typeof XDomainRequest !== 'undefined') { 4904 // XDomainRequest for IE. 4905 xhr = new XDomainRequest(); 4906 xhr.open('GET', url); 4907 } else { 4908 throw new Error('cross-domain XHR not supported'); 4909 } 4910 4911 xhr.onload = success; 4912 xhr.onerror = error; 4913 xhr.send(); 4914 return xhr; 4915 } 4916 4917 return { 4918 version: '0.6.1', 4919 findProperties: findProperties, 4920 getCss: getReplacedViewportUnits, 4921 init: initialize, 4922 refresh: refresh, 4923 }; 4924 })); 4925})(); 4926 4927 4928/***/ }), 4929/* 7 */ 4930/***/ (function(module, exports) { 4931 4932var g; 4933 4934// This works in non-strict mode 4935g = (function() { 4936 return this; 4937})(); 4938 4939try { 4940 // This works if eval is allowed (see CSP) 4941 g = g || Function("return this")() || (1,eval)("this"); 4942} catch(e) { 4943 // This works if the window reference is available 4944 if(typeof window === "object") 4945 g = window; 4946} 4947 4948// g can still be undefined, but nothing to do about it... 4949// We return undefined, instead of nothing here, so it's 4950// easier to handle this case. if(!global) { ...} 4951 4952module.exports = g; 4953 4954 4955/***/ }), 4956/* 8 */ 4957/***/ (function(module, exports, __webpack_require__) { 4958 4959module.exports = __webpack_require__(0); 4960 4961 4962/***/ }) 4963/******/ ]);
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.