1/*! 2 * Bootstrap v4.0.0-beta (https://getbootstrap.com) 3 * Copyright 2011-2017 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) 4 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 5 */ 6 7if (typeof jQuery === 'undefined') { 8 throw new Error('Bootstrap\'s JavaScript requires jQuery. jQuery must be included before Bootstrap\'s JavaScript.') 9} 10 11(function ($) { 12 var version = $.fn.jquery.split(' ')[0].split('.') 13 if ((version[0] < 2 && version[1] < 9) || (version[0] == 1 && version[1] == 9 && version[2] < 1) || (version[0] >= 4)) { 14 throw new Error('Bootstrap\'s JavaScript requires at least jQuery v1.9.1 but less than v4.0.0') 15 } 16})(jQuery); 17 18(function () { 19 var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; 20 21 var _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; }; }(); 22 23 function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } 24 25 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } 26 27 function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 28 29 /** 30 * -------------------------------------------------------------------------- 31 * Bootstrap (v4.0.0-beta): util.js 32 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 33 * -------------------------------------------------------------------------- 34 */ 35 36 var Util = function ($) { 37 38 /** 39 * ------------------------------------------------------------------------ 40 * Private TransitionEnd Helpers 41 * ------------------------------------------------------------------------ 42 */ 43 44 var transition = false; 45 46 var MAX_UID = 1000000; 47 48 var TransitionEndEvent = { 49 WebkitTransition: 'webkitTransitionEnd', 50 MozTransition: 'transitionend', 51 OTransition: 'oTransitionEnd otransitionend', 52 transition: 'transitionend' 53 54 // shoutout AngusCroll (https://goo.gl/pxwQGp) 55 }; function toType(obj) { 56 return {}.toString.call(obj).match(/\s([a-zA-Z]+)/)[1].toLowerCase(); 57 } 58 59 function isElement(obj) { 60 return (obj[0] || obj).nodeType; 61 } 62 63 function getSpecialTransitionEndEvent() { 64 return { 65 bindType: transition.end, 66 delegateType: transition.end, 67 handle: function handle(event) { 68 if ($(event.target).is(this)) { 69 return event.handleObj.handler.apply(this, arguments); // eslint-disable-line prefer-rest-params 70 } 71 return undefined; 72 } 73 }; 74 } 75 76 function transitionEndTest() { 77 if (window.QUnit) { 78 return false;
79 } 80 81 var el = document.createElement('bootstrap'); 82 83 for (var name in TransitionEndEvent) { 84 if (el.style[name] !== undefined) { 85 return { 86 end: TransitionEndEvent[name] 87 }; 88 } 89 } 90 91 return false; 92 } 93 94 function transitionEndEmulator(duration) { 95 var _this = this; 96 97 var called = false; 98 99 $(this).one(Util.TRANSITION_END, function () { 100 called = true; 101 }); 102 103 setTimeout(function () { 104 if (!called) { 105 Util.triggerTransitionEnd(_this); 106 } 107 }, duration); 108 109 return this; 110 } 111 112 function setTransitionEndSupport() { 113 transition = transitionEndTest(); 114 115 $.fn.emulateTransitionEnd = transitionEndEmulator; 116 117 if (Util.supportsTransitionEnd()) { 118 $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent(); 119 } 120 } 121 122 /** 123 * -------------------------------------------------------------------------- 124 * Public Util Api 125 * -------------------------------------------------------------------------- 126 */ 127 128 var Util = { 129 130 TRANSITION_END: 'bsTransitionEnd', 131 132 getUID: function getUID(prefix) { 133 do { 134 // eslint-disable-next-line no-bitwise 135 prefix += ~~(Math.random() * MAX_UID); // "~~" acts like a faster Math.floor() here 136 } while (document.getElementById(prefix)); 137 return prefix; 138 }, 139 getSelectorFromElement: function getSelectorFromElement(element) { 140 var selector = element.getAttribute('data-target'); 141 if (!selector || selector === '#') { 142 selector = element.getAttribute('href') || ''; 143 } 144 145 try { 146 var $selector = $(selector); 147 return $selector.length > 0 ? selector : null; 148 } catch (error) { 149 return null; 150 } 151 }, 152 reflow: function reflow(element) { 153 return element.offsetHeight; 154 }, 155 triggerTransitionEnd: function triggerTransitionEnd(element) { 156 $(element).trigger(transition.end); 157 }, 158 supportsTransitionEnd: function supportsTransitionEnd() { 159 return Boolean(transition); 160 }, 161 typeCheckConfig: function typeCheckConfig(componentName, config, configTypes) { 162 for (var property in configTypes) { 163 if (configTypes.hasOwnProperty(property)) { 164 var expectedTypes = configTypes[property]; 165 var value = config[property]; 166 var valueType = value && isElement(value) ? 'element' : toType(value); 167 168 if (!new RegExp(expectedTypes).test(valueType)) { 169 throw new Error(componentName.toUpperCase() + ': ' + ('Option "' + property + '" provided type "' + valueType + '" ') + ('but expected type "' + expectedTypes + '".')); 170 } 171 } 172 } 173 } 174 }; 175 176 setTransitionEndSupport(); 177 178 return Util; 179 }(jQuery); 180 181 /** 182 * -------------------------------------------------------------------------- 183 * Bootstrap (v4.0.0-beta): alert.js 184 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 185 * -------------------------------------------------------------------------- 186 */ 187 188 var Alert = function ($) { 189 190 /** 191 * ------------------------------------------------------------------------ 192 * Constants 193 * ------------------------------------------------------------------------ 194 */ 195 196 var NAME = 'alert'; 197 var VERSION = '4.0.0-beta'; 198 var DATA_KEY = 'bs.alert'; 199 var EVENT_KEY = '.' + DATA_KEY; 200 var DATA_API_KEY = '.data-api'; 201 var JQUERY_NO_CONFLICT = $.fn[NAME]; 202 var TRANSITION_DURATION = 150; 203 204 var Selector = { 205 DISMISS: '[data-dismiss="alert"]' 206 }; 207 208 var Event = { 209 CLOSE: 'close' + EVENT_KEY, 210 CLOSED: 'closed' + EVENT_KEY, 211 CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY 212 }; 213 214 var ClassName = { 215 ALERT: 'alert', 216 FADE: 'fade', 217 SHOW: 'show' 218 219 /** 220 * ------------------------------------------------------------------------ 221 * Class Definition 222 * ------------------------------------------------------------------------ 223 */ 224 225 }; 226 var Alert = function () { 227 function Alert(element) { 228 _classCallCheck(this, Alert); 229 230 this._element = element; 231 } 232 233 // getters 234 235 // public 236 237 Alert.prototype.close = function close(element) { 238 element = element || this._element; 239 240 var rootElement = this._getRootElement(element); 241 var customEvent = this._triggerCloseEvent(rootElement); 242 243 if (customEvent.isDefaultPrevented()) { 244 return; 245 } 246 247 this._removeElement(rootElement); 248 }; 249 250 Alert.prototype.dispose = function dispose() { 251 $.removeData(this._element, DATA_KEY); 252 this._element = null; 253 }; 254 255 // private 256 257 Alert.prototype._getRootElement = function _getRootElement(element) { 258 var selector = Util.getSelectorFromElement(element); 259 var parent = false;
260 261 if (selector) { 262 parent = $(selector)[0]; 263 } 264 265 if (!parent) { 266 parent = $(element).closest('.' + ClassName.ALERT)[0]; 267 } 268 269 return parent; 270 }; 271 272 Alert.prototype._triggerCloseEvent = function _triggerCloseEvent(element) { 273 var closeEvent = $.Event(Event.CLOSE); 274 275 $(element).trigger(closeEvent); 276 return closeEvent; 277 }; 278 279 Alert.prototype._removeElement = function _removeElement(element) { 280 var _this2 = this; 281 282 $(element).removeClass(ClassName.SHOW); 283 284 if (!Util.supportsTransitionEnd() || !$(element).hasClass(ClassName.FADE)) { 285 this._destroyElement(element); 286 return; 287 } 288 289 $(element).one(Util.TRANSITION_END, function (event) { 290 return _this2._destroyElement(element, event); 291 }).emulateTransitionEnd(TRANSITION_DURATION); 292 }; 293 294 Alert.prototype._destroyElement = function _destroyElement(element) { 295 $(element).detach().trigger(Event.CLOSED).remove(); 296 }; 297 298 // static 299 300 Alert._jQueryInterface = function _jQueryInterface(config) { 301 return this.each(function () { 302 var $element = $(this); 303 var data = $element.data(DATA_KEY); 304 305 if (!data) { 306 data = new Alert(this); 307 $element.data(DATA_KEY, data); 308 } 309 310 if (config === 'close') { 311 data[config](this); 312 } 313 }); 314 }; 315 316 Alert._handleDismiss = function _handleDismiss(alertInstance) { 317 return function (event) { 318 if (event) { 319 event.preventDefault(); 320 } 321 322 alertInstance.close(this); 323 }; 324 }; 325 326 _createClass(Alert, null, [{ 327 key: 'VERSION', 328 get: function get() { 329 return VERSION; 330 } 331 }]); 332 333 return Alert; 334 }(); 335 336 /** 337 * ------------------------------------------------------------------------ 338 * Data Api implementation 339 * ------------------------------------------------------------------------ 340 */ 341 342 $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert())); 343 344 /** 345 * ------------------------------------------------------------------------ 346 * jQuery 347 * ------------------------------------------------------------------------ 348 */ 349 350 $.fn[NAME] = Alert._jQueryInterface; 351 $.fn[NAME].Constructor = Alert; 352 $.fn[NAME].noConflict = function () { 353 $.fn[NAME] = JQUERY_NO_CONFLICT; 354 return Alert._jQueryInterface; 355 }; 356 357 return Alert; 358 }(jQuery); 359 360 /** 361 * -------------------------------------------------------------------------- 362 * Bootstrap (v4.0.0-beta): button.js 363 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 364 * -------------------------------------------------------------------------- 365 */ 366 367 var Button = function ($) { 368 369 /** 370 * ------------------------------------------------------------------------ 371 * Constants 372 * ------------------------------------------------------------------------ 373 */ 374 375 var NAME = 'button'; 376 var VERSION = '4.0.0-beta'; 377 var DATA_KEY = 'bs.button'; 378 var EVENT_KEY = '.' + DATA_KEY; 379 var DATA_API_KEY = '.data-api'; 380 var JQUERY_NO_CONFLICT = $.fn[NAME]; 381 382 var ClassName = { 383 ACTIVE: 'active', 384 BUTTON: 'btn', 385 FOCUS: 'focus' 386 }; 387 388 var Selector = { 389 DATA_TOGGLE_CARROT: '[data-toggle^="button"]', 390 DATA_TOGGLE: '[data-toggle="buttons"]', 391 INPUT: 'input', 392 ACTIVE: '.active', 393 BUTTON: '.btn' 394 }; 395 396 var Event = { 397 CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY, 398 FOCUS_BLUR_DATA_API: 'focus' + EVENT_KEY + DATA_API_KEY + ' ' + ('blur' + EVENT_KEY + DATA_API_KEY) 399 400 /** 401 * ------------------------------------------------------------------------ 402 * Class Definition 403 * ------------------------------------------------------------------------ 404 */ 405 406 }; 407 var Button = function () { 408 function Button(element) { 409 _classCallCheck(this, Button); 410 411 this._element = element; 412 } 413 414 // getters 415 416 // public 417
vendor: 6,738 bytes, lines 418-606
418 Button.prototype.toggle = function toggle() { 419 var triggerChangeEvent = true; 420 var addAriaPressed = true; 421 var rootElement = $(this._element).closest(Selector.DATA_TOGGLE)[0]; 422 423 if (rootElement) { 424 var input = $(this._element).find(Selector.INPUT)[0]; 425 426 if (input) { 427 if (input.type === 'radio') { 428 if (input.checked && $(this._element).hasClass(ClassName.ACTIVE)) { 429 triggerChangeEvent = false; 430 } else { 431 var activeElement = $(rootElement).find(Selector.ACTIVE)[0]; 432 433 if (activeElement) { 434 $(activeElement).removeClass(ClassName.ACTIVE); 435 } 436 } 437 } 438 439 if (triggerChangeEvent) { 440 if (input.hasAttribute('disabled') || rootElement.hasAttribute('disabled') || input.classList.contains('disabled') || rootElement.classList.contains('disabled')) { 441 return; 442 } 443 input.checked = !$(this._element).hasClass(ClassName.ACTIVE); 444 $(input).trigger('change'); 445 } 446 447 input.focus(); 448 addAriaPressed = false; 449 } 450 } 451 452 if (addAriaPressed) { 453 this._element.setAttribute('aria-pressed', !$(this._element).hasClass(ClassName.ACTIVE)); 454 } 455 456 if (triggerChangeEvent) { 457 $(this._element).toggleClass(ClassName.ACTIVE); 458 } 459 }; 460 461 Button.prototype.dispose = function dispose() { 462 $.removeData(this._element, DATA_KEY); 463 this._element = null; 464 }; 465 466 // static 467 468 Button._jQueryInterface = function _jQueryInterface(config) { 469 return this.each(function () { 470 var data = $(this).data(DATA_KEY); 471 472 if (!data) { 473 data = new Button(this); 474 $(this).data(DATA_KEY, data); 475 } 476 477 if (config === 'toggle') { 478 data[config](); 479 } 480 }); 481 }; 482 483 _createClass(Button, null, [{ 484 key: 'VERSION', 485 get: function get() { 486 return VERSION; 487 } 488 }]); 489 490 return Button; 491 }(); 492 493 /** 494 * ------------------------------------------------------------------------ 495 * Data Api implementation 496 * ------------------------------------------------------------------------ 497 */ 498 499 $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) { 500 event.preventDefault(); 501 502 var button = event.target; 503 504 if (!$(button).hasClass(ClassName.BUTTON)) { 505 button = $(button).closest(Selector.BUTTON); 506 } 507 508 Button._jQueryInterface.call($(button), 'toggle'); 509 }).on(Event.FOCUS_BLUR_DATA_API, Selector.DATA_TOGGLE_CARROT, function (event) { 510 var button = $(event.target).closest(Selector.BUTTON)[0]; 511 $(button).toggleClass(ClassName.FOCUS, /^focus(in)?$/.test(event.type)); 512 }); 513 514 /** 515 * ------------------------------------------------------------------------ 516 * jQuery 517 * ------------------------------------------------------------------------ 518 */ 519 520 $.fn[NAME] = Button._jQueryInterface; 521 $.fn[NAME].Constructor = Button; 522 $.fn[NAME].noConflict = function () { 523 $.fn[NAME] = JQUERY_NO_CONFLICT; 524 return Button._jQueryInterface; 525 }; 526 527 return Button; 528 }(jQuery); 529 530 /** 531 * -------------------------------------------------------------------------- 532 * Bootstrap (v4.0.0-beta): carousel.js 533 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 534 * -------------------------------------------------------------------------- 535 */ 536 537 var Carousel = function ($) { 538 539 /** 540 * ------------------------------------------------------------------------ 541 * Constants 542 * ------------------------------------------------------------------------ 543 */ 544 545 var NAME = 'carousel'; 546 var VERSION = '4.0.0-beta'; 547 var DATA_KEY = 'bs.carousel'; 548 var EVENT_KEY = '.' + DATA_KEY; 549 var DATA_API_KEY = '.data-api'; 550 var JQUERY_NO_CONFLICT = $.fn[NAME]; 551 var TRANSITION_DURATION = 600; 552 var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key 553 var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key 554 var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch 555 556 var Default = { 557 interval: 5000, 558 keyboard: true, 559 slide: false, 560 pause: 'hover', 561 wrap: true 562 }; 563 564 var DefaultType = { 565 interval: '(number|boolean)', 566 keyboard: 'boolean', 567 slide: '(boolean|string)', 568 pause: '(string|boolean)', 569 wrap: 'boolean' 570 }; 571 572 var Direction = { 573 NEXT: 'next', 574 PREV: 'prev', 575 LEFT: 'left', 576 RIGHT: 'right' 577 }; 578 579 var Event = { 580 SLIDE: 'slide' + EVENT_KEY, 581 SLID: 'slid' + EVENT_KEY, 582 KEYDOWN: 'keydown' + EVENT_KEY, 583 MOUSEENTER: 'mouseenter' + EVENT_KEY, 584 MOUSELEAVE: 'mouseleave' + EVENT_KEY, 585 TOUCHEND: 'touchend' + EVENT_KEY, 586 LOAD_DATA_API: 'load' + EVENT_KEY + DATA_API_KEY, 587 CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY 588 }; 589 590 var ClassName = { 591 CAROUSEL: 'carousel', 592 ACTIVE: 'active', 593 SLIDE: 'slide', 594 RIGHT: 'carousel-item-right', 595 LEFT: 'carousel-item-left', 596 NEXT: 'carousel-item-next', 597 PREV: 'carousel-item-prev', 598 ITEM: 'carousel-item' 599 }; 600 601 var Selector = { 602 ACTIVE: '.active', 603 ACTIVE_ITEM: '.active.carousel-item', 604 ITEM: '.carousel-item', 605 NEXT_PREV: '.carousel-item-next, .carousel-item-prev', 606 INDICATORS: '.carousel-indicators',
607 DATA_SLIDE: '[data-slide], [data-slide-to]', 608 DATA_RIDE: '[data-ride="carousel"]' 609 610 /** 611 * ------------------------------------------------------------------------ 612 * Class Definition 613 * ------------------------------------------------------------------------ 614 */ 615 616 }; 617 var Carousel = function () { 618 function Carousel(element, config) { 619 _classCallCheck(this, Carousel); 620 621 this._items = null; 622 this._interval = null; 623 this._activeElement = null; 624 625 this._isPaused = false; 626 this._isSliding = false; 627 628 this.touchTimeout = null; 629 630 this._config = this._getConfig(config); 631 this._element = $(element)[0]; 632 this._indicatorsElement = $(this._element).find(Selector.INDICATORS)[0]; 633 634 this._addEventListeners(); 635 } 636 637 // getters 638 639 // public 640 641 Carousel.prototype.next = function next() { 642 if (!this._isSliding) { 643 this._slide(Direction.NEXT); 644 } 645 }; 646 647 Carousel.prototype.nextWhenVisible = function nextWhenVisible() { 648 // Don't call next when the page isn't visible 649 // or the carousel or its parent isn't visible 650 if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') { 651 this.next(); 652 } 653 }; 654 655 Carousel.prototype.prev = function prev() { 656 if (!this._isSliding) { 657 this._slide(Direction.PREV); 658 } 659 }; 660 661 Carousel.prototype.pause = function pause(event) { 662 if (!event) { 663 this._isPaused = true; 664 } 665 666 if ($(this._element).find(Selector.NEXT_PREV)[0] && Util.supportsTransitionEnd()) { 667 Util.triggerTransitionEnd(this._element); 668 this.cycle(true); 669 } 670 671 clearInterval(this._interval); 672 this._interval = null; 673 }; 674 675 Carousel.prototype.cycle = function cycle(event) { 676 if (!event) { 677 this._isPaused = false; 678 } 679 680 if (this._interval) { 681 clearInterval(this._interval); 682 this._interval = null; 683 } 684 685 if (this._config.interval && !this._isPaused) { 686 this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval); 687 } 688 }; 689 690 Carousel.prototype.to = function to(index) { 691 var _this3 = this; 692 693 this._activeElement = $(this._element).find(Selector.ACTIVE_ITEM)[0]; 694 695 var activeIndex = this._getItemIndex(this._activeElement); 696 697 if (index > this._items.length - 1 || index < 0) { 698 return; 699 } 700 701 if (this._isSliding) { 702 $(this._element).one(Event.SLID, function () { 703 return _this3.to(index); 704 }); 705 return; 706 } 707 708 if (activeIndex === index) { 709 this.pause(); 710 this.cycle(); 711 return; 712 } 713 714 var direction = index > activeIndex ? Direction.NEXT : Direction.PREV; 715 716 this._slide(direction, this._items[index]); 717 }; 718 719 Carousel.prototype.dispose = function dispose() { 720 $(this._element).off(EVENT_KEY); 721 $.removeData(this._element, DATA_KEY); 722 723 this._items = null; 724 this._config = null; 725 this._element = null; 726 this._interval = null; 727 this._isPaused = null; 728 this._isSliding = null; 729 this._activeElement = null; 730 this._indicatorsElement = null; 731 }; 732 733 // private 734 735 Carousel.prototype._getConfig = function _getConfig(config) { 736 config = $.extend({}, Default, config); 737 Util.typeCheckConfig(NAME, config, DefaultType); 738 return config; 739 }; 740 741 Carousel.prototype._addEventListeners = function _addEventListeners() { 742 var _this4 = this; 743 744 if (this._config.keyboard) { 745 $(this._element).on(Event.KEYDOWN, function (event) { 746 return _this4._keydown(event); 747 }); 748 } 749 750 if (this._config.pause === 'hover') { 751 $(this._element).on(Event.MOUSEENTER, function (event) { 752 return _this4.pause(event); 753 }).on(Event.MOUSELEAVE, function (event) { 754 return _this4.cycle(event); 755 }); 756 if ('ontouchstart' in document.documentElement) {
757 // if it's a touch-enabled device, mouseenter/leave are fired as 758 // part of the mouse compatibility events on first tap - the carousel 759 // would stop cycling until user tapped out of it; 760 // here, we listen for touchend, explicitly pause the carousel 761 // (as if it's the second time we tap on it, mouseenter compat event 762 // is NOT fired) and after a timeout (to allow for mouse compatibility 763 // events to fire) we explicitly restart cycling 764 $(this._element).on(Event.TOUCHEND, function () { 765 _this4.pause(); 766 if (_this4.touchTimeout) { 767 clearTimeout(_this4.touchTimeout); 768 } 769 _this4.touchTimeout = setTimeout(function (event) { 770 return _this4.cycle(event); 771 }, TOUCHEVENT_COMPAT_WAIT + _this4._config.interval); 772 }); 773 } 774 } 775 }; 776 777 Carousel.prototype._keydown = function _keydown(event) { 778 if (/input|textarea/i.test(event.target.tagName)) { 779 return; 780 } 781 782 switch (event.which) { 783 case ARROW_LEFT_KEYCODE: 784 event.preventDefault(); 785 this.prev(); 786 break; 787 case ARROW_RIGHT_KEYCODE: 788 event.preventDefault(); 789 this.next(); 790 break; 791 default: 792 return; 793 } 794 }; 795 796 Carousel.prototype._getItemIndex = function _getItemIndex(element) { 797 this._items = $.makeArray($(element).parent().find(Selector.ITEM)); 798 return this._items.indexOf(element); 799 }; 800 801 Carousel.prototype._getItemByDirection = function _getItemByDirection(direction, activeElement) { 802 var isNextDirection = direction === Direction.NEXT; 803 var isPrevDirection = direction === Direction.PREV; 804 var activeIndex = this._getItemIndex(activeElement); 805 var lastItemIndex = this._items.length - 1; 806 var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex; 807 808 if (isGoingToWrap && !this._config.wrap) { 809 return activeElement; 810 } 811 812 var delta = direction === Direction.PREV ? -1 : 1; 813 var itemIndex = (activeIndex + delta) % this._items.length; 814 815 return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex]; 816 }; 817 818 Carousel.prototype._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) { 819 var targetIndex = this._getItemIndex(relatedTarget); 820 var fromIndex = this._getItemIndex($(this._element).find(Selector.ACTIVE_ITEM)[0]); 821 var slideEvent = $.Event(Event.SLIDE, { 822 relatedTarget: relatedTarget, 823 direction: eventDirectionName, 824 from: fromIndex, 825 to: targetIndex 826 }); 827 828 $(this._element).trigger(slideEvent); 829 830 return slideEvent; 831 }; 832 833 Carousel.prototype._setActiveIndicatorElement = function _setActiveIndicatorElement(element) { 834 if (this._indicatorsElement) { 835 $(this._indicatorsElement).find(Selector.ACTIVE).removeClass(ClassName.ACTIVE); 836 837 var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)]; 838 839 if (nextIndicator) { 840 $(nextIndicator).addClass(ClassName.ACTIVE); 841 } 842 } 843 }; 844 845 Carousel.prototype._slide = function _slide(direction, element) { 846 var _this5 = this; 847 848 var activeElement = $(this._element).find(Selector.ACTIVE_ITEM)[0]; 849 var activeElementIndex = this._getItemIndex(activeElement); 850 var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement); 851 var nextElementIndex = this._getItemIndex(nextElement); 852 var isCycling = Boolean(this._interval); 853 854 var directionalClassName = void 0; 855 var orderClassName = void 0; 856 var eventDirectionName = void 0; 857 858 if (direction === Direction.NEXT) { 859 directionalClassName = ClassName.LEFT; 860 orderClassName = ClassName.NEXT; 861 eventDirectionName = Direction.LEFT; 862 } else { 863 directionalClassName = ClassName.RIGHT; 864 orderClassName = ClassName.PREV; 865 eventDirectionName = Direction.RIGHT; 866 } 867 868 if (nextElement && $(nextElement).hasClass(ClassName.ACTIVE)) { 869 this._isSliding = false;
870 return; 871 } 872 873 var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName); 874 if (slideEvent.isDefaultPrevented()) { 875 return; 876 } 877 878 if (!activeElement || !nextElement) { 879 // some weirdness is happening, so we bail 880 return; 881 } 882 883 this._isSliding = true; 884 885 if (isCycling) { 886 this.pause(); 887 } 888 889 this._setActiveIndicatorElement(nextElement); 890 891 var slidEvent = $.Event(Event.SLID, { 892 relatedTarget: nextElement, 893 direction: eventDirectionName, 894 from: activeElementIndex, 895 to: nextElementIndex 896 }); 897 898 if (Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.SLIDE)) { 899 900 $(nextElement).addClass(orderClassName); 901 902 Util.reflow(nextElement); 903 904 $(activeElement).addClass(directionalClassName); 905 $(nextElement).addClass(directionalClassName); 906 907 $(activeElement).one(Util.TRANSITION_END, function () { 908 $(nextElement).removeClass(directionalClassName + ' ' + orderClassName).addClass(ClassName.ACTIVE); 909 910 $(activeElement).removeClass(ClassName.ACTIVE + ' ' + orderClassName + ' ' + directionalClassName); 911 912 _this5._isSliding = false; 913 914 setTimeout(function () { 915 return $(_this5._element).trigger(slidEvent); 916 }, 0); 917 }).emulateTransitionEnd(TRANSITION_DURATION); 918 } else { 919 $(activeElement).removeClass(ClassName.ACTIVE); 920 $(nextElement).addClass(ClassName.ACTIVE); 921 922 this._isSliding = false; 923 $(this._element).trigger(slidEvent); 924 } 925 926 if (isCycling) { 927 this.cycle(); 928 } 929 }; 930 931 // static 932 933 Carousel._jQueryInterface = function _jQueryInterface(config) { 934 return this.each(function () { 935 var data = $(this).data(DATA_KEY); 936 var _config = $.extend({}, Default, $(this).data()); 937 938 if ((typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object') { 939 $.extend(_config, config); 940 } 941 942 var action = typeof config === 'string' ? config : _config.slide; 943 944 if (!data) { 945 data = new Carousel(this, _config); 946 $(this).data(DATA_KEY, data); 947 } 948 949 if (typeof config === 'number') { 950 data.to(config); 951 } else if (typeof action === 'string') { 952 if (data[action] === undefined) { 953 throw new Error('No method named "' + action + '"'); 954 } 955 data[action](); 956 } else if (_config.interval) { 957 data.pause(); 958 data.cycle(); 959 } 960 }); 961 }; 962 963 Carousel._dataApiClickHandler = function _dataApiClickHandler(event) { 964 var selector = Util.getSelectorFromElement(this); 965 966 if (!selector) { 967 return; 968 } 969 970 var target = $(selector)[0]; 971 972 if (!target || !$(target).hasClass(ClassName.CAROUSEL)) { 973 return; 974 } 975 976 var config = $.extend({}, $(target).data(), $(this).data()); 977 var slideIndex = this.getAttribute('data-slide-to'); 978 979 if (slideIndex) { 980 config.interval = false; 981 } 982 983 Carousel._jQueryInterface.call($(target), config); 984 985 if (slideIndex) { 986 $(target).data(DATA_KEY).to(slideIndex); 987 } 988 989 event.preventDefault(); 990 }; 991 992 _createClass(Carousel, null, [{ 993 key: 'VERSION', 994 get: function get() { 995 return VERSION; 996 } 997 }, { 998 key: 'Default', 999 get: function get() { 1000 return Default; 1001 } 1002 }]); 1003 1004 return Carousel; 1005 }(); 1006 1007 /** 1008 * ------------------------------------------------------------------------ 1009 * Data Api implementation 1010 * ------------------------------------------------------------------------ 1011 */ 1012 1013 $(document).on(Event.CLICK_DATA_API, Selector.DATA_SLIDE, Carousel._dataApiClickHandler); 1014 1015 $(window).on(Event.LOAD_DATA_API, function () { 1016 $(Selector.DATA_RIDE).each(function () { 1017 var $carousel = $(this);
1018 Carousel._jQueryInterface.call($carousel, $carousel.data()); 1019 }); 1020 }); 1021 1022 /** 1023 * ------------------------------------------------------------------------ 1024 * jQuery 1025 * ------------------------------------------------------------------------ 1026 */ 1027 1028 $.fn[NAME] = Carousel._jQueryInterface; 1029 $.fn[NAME].Constructor = Carousel; 1030 $.fn[NAME].noConflict = function () { 1031 $.fn[NAME] = JQUERY_NO_CONFLICT; 1032 return Carousel._jQueryInterface; 1033 }; 1034 1035 return Carousel; 1036 }(jQuery); 1037 1038 /** 1039 * -------------------------------------------------------------------------- 1040 * Bootstrap (v4.0.0-beta): collapse.js 1041 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 1042 * -------------------------------------------------------------------------- 1043 */ 1044 1045 var Collapse = function ($) { 1046 1047 /** 1048 * ------------------------------------------------------------------------ 1049 * Constants 1050 * ------------------------------------------------------------------------ 1051 */ 1052 1053 var NAME = 'collapse'; 1054 var VERSION = '4.0.0-beta'; 1055 var DATA_KEY = 'bs.collapse'; 1056 var EVENT_KEY = '.' + DATA_KEY; 1057 var DATA_API_KEY = '.data-api'; 1058 var JQUERY_NO_CONFLICT = $.fn[NAME]; 1059 var TRANSITION_DURATION = 600; 1060 1061 var Default = { 1062 toggle: true, 1063 parent: '' 1064 }; 1065 1066 var DefaultType = { 1067 toggle: 'boolean', 1068 parent: 'string' 1069 }; 1070 1071 var Event = { 1072 SHOW: 'show' + EVENT_KEY, 1073 SHOWN: 'shown' + EVENT_KEY, 1074 HIDE: 'hide' + EVENT_KEY, 1075 HIDDEN: 'hidden' + EVENT_KEY, 1076 CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY 1077 }; 1078 1079 var ClassName = { 1080 SHOW: 'show', 1081 COLLAPSE: 'collapse', 1082 COLLAPSING: 'collapsing', 1083 COLLAPSED: 'collapsed' 1084 }; 1085 1086 var Dimension = { 1087 WIDTH: 'width', 1088 HEIGHT: 'height' 1089 }; 1090 1091 var Selector = { 1092 ACTIVES: '.show, .collapsing', 1093 DATA_TOGGLE: '[data-toggle="collapse"]' 1094 1095 /** 1096 * ------------------------------------------------------------------------ 1097 * Class Definition 1098 * ------------------------------------------------------------------------ 1099 */ 1100 1101 }; 1102 var Collapse = function () { 1103 function Collapse(element, config) { 1104 _classCallCheck(this, Collapse); 1105 1106 this._isTransitioning = false; 1107 this._element = element; 1108 this._config = this._getConfig(config); 1109 this._triggerArray = $.makeArray($('[data-toggle="collapse"][href="#' + element.id + '"],' + ('[data-toggle="collapse"][data-target="#' + element.id + '"]'))); 1110 var tabToggles = $(Selector.DATA_TOGGLE); 1111 for (var i = 0; i < tabToggles.length; i++) { 1112 var elem = tabToggles[i]; 1113 var selector = Util.getSelectorFromElement(elem); 1114 if (selector !== null && $(selector).filter(element).length > 0) { 1115 this._triggerArray.push(elem); 1116 } 1117 } 1118 1119 this._parent = this._config.parent ? this._getParent() : null; 1120 1121 if (!this._config.parent) { 1122 this._addAriaAndCollapsedClass(this._element, this._triggerArray); 1123 } 1124 1125 if (this._config.toggle) { 1126 this.toggle(); 1127 } 1128 } 1129 1130 // getters 1131 1132 // public 1133 1134 Collapse.prototype.toggle = function toggle() { 1135 if ($(this._element).hasClass(ClassName.SHOW)) { 1136 this.hide(); 1137 } else { 1138 this.show(); 1139 } 1140 }; 1141 1142 Collapse.prototype.show = function show() { 1143 var _this6 = this; 1144 1145 if (this._isTransitioning || $(this._element).hasClass(ClassName.SHOW)) { 1146 return; 1147 } 1148 1149 var actives = void 0; 1150 var activesData = void 0; 1151 1152 if (this._parent) { 1153 actives = $.makeArray($(this._parent).children().children(Selector.ACTIVES)); 1154 if (!actives.length) { 1155 actives = null; 1156 } 1157 } 1158 1159 if (actives) { 1160 activesData = $(actives).data(DATA_KEY); 1161 if (activesData && activesData._isTransitioning) { 1162 return; 1163 } 1164 } 1165 1166 var startEvent = $.Event(Event.SHOW); 1167 $(this._element).trigger(startEvent); 1168 if (startEvent.isDefaultPrevented()) { 1169 return; 1170 } 1171 1172 if (actives) { 1173 Collapse._jQueryInterface.call($(actives), 'hide'); 1174 if (!activesData) { 1175 $(actives).data(DATA_KEY, null); 1176 } 1177 } 1178 1179 var dimension = this._getDimension(); 1180 1181 $(this._element).removeClass(ClassName.COLLAPSE).addClass(ClassName.COLLAPSING); 1182 1183 this._element.style[dimension] = 0; 1184 1185 if (this._triggerArray.length) { 1186 $(this._triggerArray).removeClass(ClassName.COLLAPSED).attr('aria-expanded', true); 1187 } 1188 1189 this.setTransitioning(true); 1190 1191 var complete = function complete() { 1192 $(_this6._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).addClass(ClassName.SHOW); 1193 1194 _this6._element.style[dimension] = ''; 1195 1196 _this6.setTransitioning(false); 1197 1198 $(_this6._element).trigger(Event.SHOWN); 1199 }; 1200 1201 if (!Util.supportsTransitionEnd()) { 1202 complete(); 1203 return; 1204 } 1205 1206 var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1); 1207 var scrollSize = 'scroll' + capitalizedDimension; 1208 1209 $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION); 1210 1211 this._element.style[dimension] = this._element[scrollSize] + 'px'; 1212 }; 1213 1214 Collapse.prototype.hide = function hide() { 1215 var _this7 = this; 1216 1217 if (this._isTransitioning || !$(this._element).hasClass(ClassName.SHOW)) { 1218 return; 1219 } 1220 1221 var startEvent = $.Event(Event.HIDE); 1222 $(this._element).trigger(startEvent); 1223 if (startEvent.isDefaultPrevented()) { 1224 return; 1225 } 1226 1227 var dimension = this._getDimension(); 1228 1229 this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + 'px'; 1230 1231 Util.reflow(this._element); 1232 1233 $(this._element).addClass(ClassName.COLLAPSING).removeClass(ClassName.COLLAPSE).removeClass(ClassName.SHOW); 1234 1235 if (this._triggerArray.length) { 1236 for (var i = 0; i < this._triggerArray.length; i++) { 1237 var trigger = this._triggerArray[i]; 1238 var selector = Util.getSelectorFromElement(trigger); 1239 if (selector !== null) { 1240 var $elem = $(selector); 1241 if (!$elem.hasClass(ClassName.SHOW)) { 1242 $(trigger).addClass(ClassName.COLLAPSED).attr('aria-expanded', false); 1243 } 1244 } 1245 } 1246 } 1247 1248 this.setTransitioning(true); 1249 1250 var complete = function complete() { 1251 _this7.setTransitioning(false); 1252 $(_this7._element).removeClass(ClassName.COLLAPSING).addClass(ClassName.COLLAPSE).trigger(Event.HIDDEN); 1253 }; 1254 1255 this._element.style[dimension] = ''; 1256 1257 if (!Util.supportsTransitionEnd()) { 1258 complete(); 1259 return; 1260 } 1261 1262 $(this._element).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION); 1263 }; 1264 1265 Collapse.prototype.setTransitioning = function setTransitioning(isTransitioning) { 1266 this._isTransitioning = isTransitioning; 1267 }; 1268 1269 Collapse.prototype.dispose = function dispose() { 1270 $.removeData(this._element, DATA_KEY); 1271 1272 this._config = null; 1273 this._parent = null; 1274 this._element = null; 1275 this._triggerArray = null; 1276 this._isTransitioning = null; 1277 }; 1278 1279 // private 1280 1281 Collapse.prototype._getConfig = function _getConfig(config) { 1282 config = $.extend({}, Default, config); 1283 config.toggle = Boolean(config.toggle); // coerce string values 1284 Util.typeCheckConfig(NAME, config, DefaultType); 1285 return config; 1286 }; 1287 1288 Collapse.prototype._getDimension = function _getDimension() { 1289 var hasWidth = $(this._element).hasClass(Dimension.WIDTH); 1290 return hasWidth ? Dimension.WIDTH : Dimension.HEIGHT; 1291 }; 1292 1293 Collapse.prototype._getParent = function _getParent() { 1294 var _this8 = this; 1295 1296 var parent = $(this._config.parent)[0]; 1297 var selector = '[data-toggle="collapse"][data-parent="' + this._config.parent + '"]'; 1298 1299 $(parent).find(selector).each(function (i, element) { 1300 _this8._addAriaAndCollapsedClass(Collapse._getTargetFromElement(element), [element]); 1301 }); 1302 1303 return parent; 1304 }; 1305 1306 Collapse.prototype._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) { 1307 if (element) { 1308 var isOpen = $(element).hasClass(ClassName.SHOW); 1309 1310 if (triggerArray.length) { 1311 $(triggerArray).toggleClass(ClassName.COLLAPSED, !isOpen).attr('aria-expanded', isOpen); 1312 } 1313 } 1314 }; 1315 1316 // static 1317 1318 Collapse._getTargetFromElement = function _getTargetFromElement(element) { 1319 var selector = Util.getSelectorFromElement(element); 1320 return selector ? $(selector)[0] : null; 1321 }; 1322 1323 Collapse._jQueryInterface = function _jQueryInterface(config) { 1324 return this.each(function () { 1325 var $this = $(this); 1326 var data = $this.data(DATA_KEY); 1327 var _config = $.extend({}, Default, $this.data(), (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' && config); 1328 1329 if (!data && _config.toggle && /show|hide/.test(config)) { 1330 _config.toggle = false;
vendor: 20,232 bytes, lines 1331-1879
1331 } 1332 1333 if (!data) { 1334 data = new Collapse(this, _config); 1335 $this.data(DATA_KEY, data); 1336 } 1337 1338 if (typeof config === 'string') { 1339 if (data[config] === undefined) { 1340 throw new Error('No method named "' + config + '"'); 1341 } 1342 data[config](); 1343 } 1344 }); 1345 }; 1346 1347 _createClass(Collapse, null, [{ 1348 key: 'VERSION', 1349 get: function get() { 1350 return VERSION; 1351 } 1352 }, { 1353 key: 'Default', 1354 get: function get() { 1355 return Default; 1356 } 1357 }]); 1358 1359 return Collapse; 1360 }(); 1361 1362 /** 1363 * ------------------------------------------------------------------------ 1364 * Data Api implementation 1365 * ------------------------------------------------------------------------ 1366 */ 1367 1368 $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) { 1369 if (!/input|textarea/i.test(event.target.tagName)) { 1370 event.preventDefault(); 1371 } 1372 1373 var $trigger = $(this); 1374 var selector = Util.getSelectorFromElement(this); 1375 $(selector).each(function () { 1376 var $target = $(this); 1377 var data = $target.data(DATA_KEY); 1378 var config = data ? 'toggle' : $trigger.data(); 1379 Collapse._jQueryInterface.call($target, config); 1380 }); 1381 }); 1382 1383 /** 1384 * ------------------------------------------------------------------------ 1385 * jQuery 1386 * ------------------------------------------------------------------------ 1387 */ 1388 1389 $.fn[NAME] = Collapse._jQueryInterface; 1390 $.fn[NAME].Constructor = Collapse; 1391 $.fn[NAME].noConflict = function () { 1392 $.fn[NAME] = JQUERY_NO_CONFLICT; 1393 return Collapse._jQueryInterface; 1394 }; 1395 1396 return Collapse; 1397 }(jQuery); 1398 1399 /* global Popper */ 1400 1401 /** 1402 * -------------------------------------------------------------------------- 1403 * Bootstrap (v4.0.0-beta): dropdown.js 1404 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 1405 * -------------------------------------------------------------------------- 1406 */ 1407 1408 var Dropdown = function ($) { 1409 1410 /** 1411 * Check for Popper dependency 1412 * Popper - https://popper.js.org 1413 */ 1414 if (typeof Popper === 'undefined') { 1415 throw new Error('Bootstrap dropdown require Popper.js (https://popper.js.org)'); 1416 } 1417 1418 /** 1419 * ------------------------------------------------------------------------ 1420 * Constants 1421 * ------------------------------------------------------------------------ 1422 */ 1423 1424 var NAME = 'dropdown'; 1425 var VERSION = '4.0.0-beta'; 1426 var DATA_KEY = 'bs.dropdown'; 1427 var EVENT_KEY = '.' + DATA_KEY; 1428 var DATA_API_KEY = '.data-api'; 1429 var JQUERY_NO_CONFLICT = $.fn[NAME]; 1430 var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key 1431 var SPACE_KEYCODE = 32; // KeyboardEvent.which value for space key 1432 var TAB_KEYCODE = 9; // KeyboardEvent.which value for tab key 1433 var ARROW_UP_KEYCODE = 38; // KeyboardEvent.which value for up arrow key 1434 var ARROW_DOWN_KEYCODE = 40; // KeyboardEvent.which value for down arrow key 1435 var RIGHT_MOUSE_BUTTON_WHICH = 3; // MouseEvent.which value for the right button (assuming a right-handed mouse) 1436 var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEYCODE + '|' + ARROW_DOWN_KEYCODE + '|' + ESCAPE_KEYCODE); 1437 1438 var Event = { 1439 HIDE: 'hide' + EVENT_KEY, 1440 HIDDEN: 'hidden' + EVENT_KEY, 1441 SHOW: 'show' + EVENT_KEY, 1442 SHOWN: 'shown' + EVENT_KEY, 1443 CLICK: 'click' + EVENT_KEY, 1444 CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY, 1445 KEYDOWN_DATA_API: 'keydown' + EVENT_KEY + DATA_API_KEY, 1446 KEYUP_DATA_API: 'keyup' + EVENT_KEY + DATA_API_KEY 1447 }; 1448 1449 var ClassName = { 1450 DISABLED: 'disabled', 1451 SHOW: 'show', 1452 DROPUP: 'dropup', 1453 MENURIGHT: 'dropdown-menu-right', 1454 MENULEFT: 'dropdown-menu-left' 1455 }; 1456 1457 var Selector = { 1458 DATA_TOGGLE: '[data-toggle="dropdown"]', 1459 FORM_CHILD: '.dropdown form', 1460 MENU: '.dropdown-menu', 1461 NAVBAR_NAV: '.navbar-nav', 1462 VISIBLE_ITEMS: '.dropdown-menu .dropdown-item:not(.disabled)' 1463 }; 1464 1465 var AttachmentMap = { 1466 TOP: 'top-start', 1467 TOPEND: 'top-end', 1468 BOTTOM: 'bottom-start', 1469 BOTTOMEND: 'bottom-end' 1470 }; 1471 1472 var Default = { 1473 placement: AttachmentMap.BOTTOM, 1474 offset: 0, 1475 flip: true 1476 }; 1477 1478 var DefaultType = { 1479 placement: 'string', 1480 offset: '(number|string)', 1481 flip: 'boolean' 1482 1483 /** 1484 * ------------------------------------------------------------------------ 1485 * Class Definition 1486 * ------------------------------------------------------------------------ 1487 */ 1488 1489 }; 1490 var Dropdown = function () { 1491 function Dropdown(element, config) { 1492 _classCallCheck(this, Dropdown); 1493 1494 this._element = element; 1495 this._popper = null; 1496 this._config = this._getConfig(config); 1497 this._menu = this._getMenuElement(); 1498 this._inNavbar = this._detectNavbar(); 1499 1500 this._addEventListeners(); 1501 } 1502 1503 // getters 1504 1505 // public 1506 1507 Dropdown.prototype.toggle = function toggle() { 1508 if (this._element.disabled || $(this._element).hasClass(ClassName.DISABLED)) { 1509 return; 1510 } 1511 1512 var parent = Dropdown._getParentFromElement(this._element); 1513 var isActive = $(this._menu).hasClass(ClassName.SHOW); 1514 1515 Dropdown._clearMenus(); 1516 1517 if (isActive) { 1518 return; 1519 } 1520 1521 var relatedTarget = { 1522 relatedTarget: this._element 1523 }; 1524 var showEvent = $.Event(Event.SHOW, relatedTarget); 1525 1526 $(parent).trigger(showEvent); 1527 1528 if (showEvent.isDefaultPrevented()) { 1529 return; 1530 } 1531 1532 var element = this._element; 1533 // for dropup with alignment we use the parent as popper container 1534 if ($(parent).hasClass(ClassName.DROPUP)) { 1535 if ($(this._menu).hasClass(ClassName.MENULEFT) || $(this._menu).hasClass(ClassName.MENURIGHT)) { 1536 element = parent; 1537 } 1538 } 1539 this._popper = new Popper(element, this._menu, this._getPopperConfig()); 1540 1541 // if this is a touch-enabled device we add extra 1542 // empty mouseover listeners to the body's immediate children; 1543 // only needed because of broken event delegation on iOS 1544 // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html 1545 if ('ontouchstart' in document.documentElement && !$(parent).closest(Selector.NAVBAR_NAV).length) { 1546 $('body').children().on('mouseover', null, $.noop); 1547 } 1548 1549 this._element.focus(); 1550 this._element.setAttribute('aria-expanded', true); 1551 1552 $(this._menu).toggleClass(ClassName.SHOW); 1553 $(parent).toggleClass(ClassName.SHOW).trigger($.Event(Event.SHOWN, relatedTarget)); 1554 }; 1555 1556 Dropdown.prototype.dispose = function dispose() { 1557 $.removeData(this._element, DATA_KEY); 1558 $(this._element).off(EVENT_KEY); 1559 this._element = null; 1560 this._menu = null; 1561 if (this._popper !== null) { 1562 this._popper.destroy(); 1563 } 1564 this._popper = null; 1565 }; 1566 1567 Dropdown.prototype.update = function update() { 1568 this._inNavbar = this._detectNavbar(); 1569 if (this._popper !== null) { 1570 this._popper.scheduleUpdate(); 1571 } 1572 }; 1573 1574 // private 1575 1576 Dropdown.prototype._addEventListeners = function _addEventListeners() { 1577 var _this9 = this; 1578 1579 $(this._element).on(Event.CLICK, function (event) { 1580 event.preventDefault(); 1581 event.stopPropagation(); 1582 _this9.toggle(); 1583 }); 1584 }; 1585 1586 Dropdown.prototype._getConfig = function _getConfig(config) { 1587 var elementData = $(this._element).data(); 1588 if (elementData.placement !== undefined) { 1589 elementData.placement = AttachmentMap[elementData.placement.toUpperCase()]; 1590 } 1591 1592 config = $.extend({}, this.constructor.Default, $(this._element).data(), config); 1593 1594 Util.typeCheckConfig(NAME, config, this.constructor.DefaultType); 1595 1596 return config; 1597 }; 1598 1599 Dropdown.prototype._getMenuElement = function _getMenuElement() { 1600 if (!this._menu) { 1601 var parent = Dropdown._getParentFromElement(this._element); 1602 this._menu = $(parent).find(Selector.MENU)[0]; 1603 } 1604 return this._menu; 1605 }; 1606 1607 Dropdown.prototype._getPlacement = function _getPlacement() { 1608 var $parentDropdown = $(this._element).parent(); 1609 var placement = this._config.placement; 1610 1611 // Handle dropup 1612 if ($parentDropdown.hasClass(ClassName.DROPUP) || this._config.placement === AttachmentMap.TOP) { 1613 placement = AttachmentMap.TOP; 1614 if ($(this._menu).hasClass(ClassName.MENURIGHT)) { 1615 placement = AttachmentMap.TOPEND; 1616 } 1617 } else if ($(this._menu).hasClass(ClassName.MENURIGHT)) { 1618 placement = AttachmentMap.BOTTOMEND; 1619 } 1620 return placement; 1621 }; 1622 1623 Dropdown.prototype._detectNavbar = function _detectNavbar() { 1624 return $(this._element).closest('.navbar').length > 0; 1625 }; 1626 1627 Dropdown.prototype._getPopperConfig = function _getPopperConfig() { 1628 var popperConfig = { 1629 placement: this._getPlacement(), 1630 modifiers: { 1631 offset: { 1632 offset: this._config.offset 1633 }, 1634 flip: { 1635 enabled: this._config.flip 1636 } 1637 } 1638 1639 // Disable Popper.js for Dropdown in Navbar 1640 }; if (this._inNavbar) { 1641 popperConfig.modifiers.applyStyle = { 1642 enabled: !this._inNavbar 1643 }; 1644 } 1645 return popperConfig; 1646 }; 1647 1648 // static 1649 1650 Dropdown._jQueryInterface = function _jQueryInterface(config) { 1651 return this.each(function () { 1652 var data = $(this).data(DATA_KEY); 1653 var _config = (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' ? config : null; 1654 1655 if (!data) { 1656 data = new Dropdown(this, _config); 1657 $(this).data(DATA_KEY, data); 1658 } 1659 1660 if (typeof config === 'string') { 1661 if (data[config] === undefined) { 1662 throw new Error('No method named "' + config + '"'); 1663 } 1664 data[config](); 1665 } 1666 }); 1667 }; 1668 1669 Dropdown._clearMenus = function _clearMenus(event) { 1670 if (event && (event.which === RIGHT_MOUSE_BUTTON_WHICH || event.type === 'keyup' && event.which !== TAB_KEYCODE)) { 1671 return; 1672 } 1673 1674 var toggles = $.makeArray($(Selector.DATA_TOGGLE)); 1675 for (var i = 0; i < toggles.length; i++) { 1676 var parent = Dropdown._getParentFromElement(toggles[i]); 1677 var context = $(toggles[i]).data(DATA_KEY); 1678 var relatedTarget = { 1679 relatedTarget: toggles[i] 1680 }; 1681 1682 if (!context) { 1683 continue; 1684 } 1685 1686 var dropdownMenu = context._menu; 1687 if (!$(parent).hasClass(ClassName.SHOW)) { 1688 continue; 1689 } 1690 1691 if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.which === TAB_KEYCODE) && $.contains(parent, event.target)) { 1692 continue; 1693 } 1694 1695 var hideEvent = $.Event(Event.HIDE, relatedTarget); 1696 $(parent).trigger(hideEvent); 1697 if (hideEvent.isDefaultPrevented()) { 1698 continue; 1699 } 1700 1701 // if this is a touch-enabled device we remove the extra 1702 // empty mouseover listeners we added for iOS support 1703 if ('ontouchstart' in document.documentElement) { 1704 $('body').children().off('mouseover', null, $.noop); 1705 } 1706 1707 toggles[i].setAttribute('aria-expanded', 'false'); 1708 1709 $(dropdownMenu).removeClass(ClassName.SHOW); 1710 $(parent).removeClass(ClassName.SHOW).trigger($.Event(Event.HIDDEN, relatedTarget)); 1711 } 1712 }; 1713 1714 Dropdown._getParentFromElement = function _getParentFromElement(element) { 1715 var parent = void 0; 1716 var selector = Util.getSelectorFromElement(element); 1717 1718 if (selector) { 1719 parent = $(selector)[0]; 1720 } 1721 1722 return parent || element.parentNode; 1723 }; 1724 1725 Dropdown._dataApiKeydownHandler = function _dataApiKeydownHandler(event) { 1726 if (!REGEXP_KEYDOWN.test(event.which) || /button/i.test(event.target.tagName) && event.which === SPACE_KEYCODE || /input|textarea/i.test(event.target.tagName)) { 1727 return; 1728 } 1729 1730 event.preventDefault(); 1731 event.stopPropagation(); 1732 1733 if (this.disabled || $(this).hasClass(ClassName.DISABLED)) { 1734 return; 1735 } 1736 1737 var parent = Dropdown._getParentFromElement(this); 1738 var isActive = $(parent).hasClass(ClassName.SHOW); 1739 1740 if (!isActive && (event.which !== ESCAPE_KEYCODE || event.which !== SPACE_KEYCODE) || isActive && (event.which === ESCAPE_KEYCODE || event.which === SPACE_KEYCODE)) { 1741 1742 if (event.which === ESCAPE_KEYCODE) { 1743 var toggle = $(parent).find(Selector.DATA_TOGGLE)[0]; 1744 $(toggle).trigger('focus'); 1745 } 1746 1747 $(this).trigger('click'); 1748 return; 1749 } 1750 1751 var items = $(parent).find(Selector.VISIBLE_ITEMS).get(); 1752 1753 if (!items.length) { 1754 return; 1755 } 1756 1757 var index = items.indexOf(event.target); 1758 1759 if (event.which === ARROW_UP_KEYCODE && index > 0) { 1760 // up 1761 index--; 1762 } 1763 1764 if (event.which === ARROW_DOWN_KEYCODE && index < items.length - 1) { 1765 // down 1766 index++; 1767 } 1768 1769 if (index < 0) { 1770 index = 0; 1771 } 1772 1773 items[index].focus(); 1774 }; 1775 1776 _createClass(Dropdown, null, [{ 1777 key: 'VERSION', 1778 get: function get() { 1779 return VERSION; 1780 } 1781 }, { 1782 key: 'Default', 1783 get: function get() { 1784 return Default; 1785 } 1786 }, { 1787 key: 'DefaultType', 1788 get: function get() { 1789 return DefaultType; 1790 } 1791 }]); 1792 1793 return Dropdown; 1794 }(); 1795 1796 /** 1797 * ------------------------------------------------------------------------ 1798 * Data Api implementation 1799 * ------------------------------------------------------------------------ 1800 */ 1801 1802 $(document).on(Event.KEYDOWN_DATA_API, Selector.DATA_TOGGLE, Dropdown._dataApiKeydownHandler).on(Event.KEYDOWN_DATA_API, Selector.MENU, Dropdown._dataApiKeydownHandler).on(Event.CLICK_DATA_API + ' ' + Event.KEYUP_DATA_API, Dropdown._clearMenus).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) { 1803 event.preventDefault(); 1804 event.stopPropagation(); 1805 Dropdown._jQueryInterface.call($(this), 'toggle'); 1806 }).on(Event.CLICK_DATA_API, Selector.FORM_CHILD, function (e) { 1807 e.stopPropagation(); 1808 }); 1809 1810 /** 1811 * ------------------------------------------------------------------------ 1812 * jQuery 1813 * ------------------------------------------------------------------------ 1814 */ 1815 1816 $.fn[NAME] = Dropdown._jQueryInterface; 1817 $.fn[NAME].Constructor = Dropdown; 1818 $.fn[NAME].noConflict = function () { 1819 $.fn[NAME] = JQUERY_NO_CONFLICT; 1820 return Dropdown._jQueryInterface; 1821 }; 1822 1823 return Dropdown; 1824 }(jQuery); 1825 1826 /** 1827 * -------------------------------------------------------------------------- 1828 * Bootstrap (v4.0.0-beta): modal.js 1829 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 1830 * -------------------------------------------------------------------------- 1831 */ 1832 1833 var Modal = function ($) { 1834 1835 /** 1836 * ------------------------------------------------------------------------ 1837 * Constants 1838 * ------------------------------------------------------------------------ 1839 */ 1840 1841 var NAME = 'modal'; 1842 var VERSION = '4.0.0-beta'; 1843 var DATA_KEY = 'bs.modal'; 1844 var EVENT_KEY = '.' + DATA_KEY; 1845 var DATA_API_KEY = '.data-api'; 1846 var JQUERY_NO_CONFLICT = $.fn[NAME]; 1847 var TRANSITION_DURATION = 300; 1848 var BACKDROP_TRANSITION_DURATION = 150; 1849 var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key 1850 1851 var Default = { 1852 backdrop: true, 1853 keyboard: true, 1854 focus: true, 1855 show: true 1856 }; 1857 1858 var DefaultType = { 1859 backdrop: '(boolean|string)', 1860 keyboard: 'boolean', 1861 focus: 'boolean', 1862 show: 'boolean' 1863 }; 1864 1865 var Event = { 1866 HIDE: 'hide' + EVENT_KEY, 1867 HIDDEN: 'hidden' + EVENT_KEY, 1868 SHOW: 'show' + EVENT_KEY, 1869 SHOWN: 'shown' + EVENT_KEY, 1870 FOCUSIN: 'focusin' + EVENT_KEY, 1871 RESIZE: 'resize' + EVENT_KEY, 1872 CLICK_DISMISS: 'click.dismiss' + EVENT_KEY, 1873 KEYDOWN_DISMISS: 'keydown.dismiss' + EVENT_KEY, 1874 MOUSEUP_DISMISS: 'mouseup.dismiss' + EVENT_KEY, 1875 MOUSEDOWN_DISMISS: 'mousedown.dismiss' + EVENT_KEY, 1876 CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY 1877 }; 1878 1879 var ClassName = {
1880 SCROLLBAR_MEASURER: 'modal-scrollbar-measure', 1881 BACKDROP: 'modal-backdrop', 1882 OPEN: 'modal-open', 1883 FADE: 'fade', 1884 SHOW: 'show' 1885 }; 1886 1887 var Selector = { 1888 DIALOG: '.modal-dialog', 1889 DATA_TOGGLE: '[data-toggle="modal"]', 1890 DATA_DISMISS: '[data-dismiss="modal"]', 1891 FIXED_CONTENT: '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top', 1892 NAVBAR_TOGGLER: '.navbar-toggler' 1893 1894 /** 1895 * ------------------------------------------------------------------------ 1896 * Class Definition 1897 * ------------------------------------------------------------------------ 1898 */ 1899 1900 }; 1901 var Modal = function () { 1902 function Modal(element, config) { 1903 _classCallCheck(this, Modal); 1904 1905 this._config = this._getConfig(config); 1906 this._element = element; 1907 this._dialog = $(element).find(Selector.DIALOG)[0]; 1908 this._backdrop = null; 1909 this._isShown = false; 1910 this._isBodyOverflowing = false; 1911 this._ignoreBackdropClick = false; 1912 this._originalBodyPadding = 0; 1913 this._scrollbarWidth = 0; 1914 } 1915 1916 // getters 1917 1918 // public 1919 1920 Modal.prototype.toggle = function toggle(relatedTarget) { 1921 return this._isShown ? this.hide() : this.show(relatedTarget); 1922 }; 1923 1924 Modal.prototype.show = function show(relatedTarget) { 1925 var _this10 = this; 1926 1927 if (this._isTransitioning) { 1928 return; 1929 } 1930 1931 if (Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE)) { 1932 this._isTransitioning = true; 1933 } 1934 1935 var showEvent = $.Event(Event.SHOW, { 1936 relatedTarget: relatedTarget 1937 }); 1938 1939 $(this._element).trigger(showEvent); 1940 1941 if (this._isShown || showEvent.isDefaultPrevented()) { 1942 return; 1943 } 1944 1945 this._isShown = true; 1946 1947 this._checkScrollbar(); 1948 this._setScrollbar(); 1949 1950 $(document.body).addClass(ClassName.OPEN); 1951 1952 this._setEscapeEvent(); 1953 this._setResizeEvent(); 1954 1955 $(this._element).on(Event.CLICK_DISMISS, Selector.DATA_DISMISS, function (event) { 1956 return _this10.hide(event); 1957 }); 1958 1959 $(this._dialog).on(Event.MOUSEDOWN_DISMISS, function () { 1960 $(_this10._element).one(Event.MOUSEUP_DISMISS, function (event) { 1961 if ($(event.target).is(_this10._element)) { 1962 _this10._ignoreBackdropClick = true; 1963 } 1964 }); 1965 }); 1966 1967 this._showBackdrop(function () { 1968 return _this10._showElement(relatedTarget); 1969 }); 1970 }; 1971 1972 Modal.prototype.hide = function hide(event) { 1973 var _this11 = this; 1974 1975 if (event) { 1976 event.preventDefault(); 1977 } 1978 1979 if (this._isTransitioning || !this._isShown) { 1980 return; 1981 } 1982 1983 var transition = Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE); 1984 1985 if (transition) { 1986 this._isTransitioning = true; 1987 } 1988 1989 var hideEvent = $.Event(Event.HIDE); 1990 1991 $(this._element).trigger(hideEvent); 1992 1993 if (!this._isShown || hideEvent.isDefaultPrevented()) { 1994 return; 1995 } 1996 1997 this._isShown = false; 1998 1999 this._setEscapeEvent(); 2000 this._setResizeEvent(); 2001 2002 $(document).off(Event.FOCUSIN); 2003 2004 $(this._element).removeClass(ClassName.SHOW); 2005 2006 $(this._element).off(Event.CLICK_DISMISS); 2007 $(this._dialog).off(Event.MOUSEDOWN_DISMISS); 2008 2009 if (transition) { 2010 2011 $(this._element).one(Util.TRANSITION_END, function (event) { 2012 return _this11._hideModal(event); 2013 }).emulateTransitionEnd(TRANSITION_DURATION); 2014 } else { 2015 this._hideModal(); 2016 } 2017 }; 2018 2019 Modal.prototype.dispose = function dispose() { 2020 $.removeData(this._element, DATA_KEY); 2021 2022 $(window, document, this._element, this._backdrop).off(EVENT_KEY); 2023 2024 this._config = null; 2025 this._element = null; 2026 this._dialog = null; 2027 this._backdrop = null; 2028 this._isShown = null; 2029 this._isBodyOverflowing = null; 2030 this._ignoreBackdropClick = null; 2031 this._scrollbarWidth = null; 2032 }; 2033 2034 Modal.prototype.handleUpdate = function handleUpdate() { 2035 this._adjustDialog(); 2036 }; 2037 2038 // private 2039 2040 Modal.prototype._getConfig = function _getConfig(config) { 2041 config = $.extend({}, Default, config); 2042 Util.typeCheckConfig(NAME, config, DefaultType); 2043 return config; 2044 }; 2045 2046 Modal.prototype._showElement = function _showElement(relatedTarget) { 2047 var _this12 = this; 2048 2049 var transition = Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE); 2050 2051 if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) { 2052 // don't move modals dom position 2053 document.body.appendChild(this._element); 2054 } 2055 2056 this._element.style.display = 'block'; 2057 this._element.removeAttribute('aria-hidden'); 2058 this._element.scrollTop = 0; 2059 2060 if (transition) { 2061 Util.reflow(this._element); 2062 } 2063 2064 $(this._element).addClass(ClassName.SHOW); 2065 2066 if (this._config.focus) { 2067 this._enforceFocus(); 2068 } 2069 2070 var shownEvent = $.Event(Event.SHOWN, { 2071 relatedTarget: relatedTarget 2072 }); 2073 2074 var transitionComplete = function transitionComplete() { 2075 if (_this12._config.focus) { 2076 _this12._element.focus(); 2077 } 2078 _this12._isTransitioning = false;
2079 $(_this12._element).trigger(shownEvent); 2080 }; 2081 2082 if (transition) { 2083 $(this._dialog).one(Util.TRANSITION_END, transitionComplete).emulateTransitionEnd(TRANSITION_DURATION); 2084 } else { 2085 transitionComplete(); 2086 } 2087 }; 2088 2089 Modal.prototype._enforceFocus = function _enforceFocus() { 2090 var _this13 = this; 2091 2092 $(document).off(Event.FOCUSIN) // guard against infinite focus loop 2093 .on(Event.FOCUSIN, function (event) { 2094 if (document !== event.target && _this13._element !== event.target && !$(_this13._element).has(event.target).length) { 2095 _this13._element.focus(); 2096 } 2097 }); 2098 }; 2099 2100 Modal.prototype._setEscapeEvent = function _setEscapeEvent() { 2101 var _this14 = this; 2102 2103 if (this._isShown && this._config.keyboard) { 2104 $(this._element).on(Event.KEYDOWN_DISMISS, function (event) { 2105 if (event.which === ESCAPE_KEYCODE) { 2106 event.preventDefault(); 2107 _this14.hide(); 2108 } 2109 }); 2110 } else if (!this._isShown) { 2111 $(this._element).off(Event.KEYDOWN_DISMISS); 2112 } 2113 }; 2114 2115 Modal.prototype._setResizeEvent = function _setResizeEvent() { 2116 var _this15 = this; 2117 2118 if (this._isShown) { 2119 $(window).on(Event.RESIZE, function (event) { 2120 return _this15.handleUpdate(event); 2121 }); 2122 } else { 2123 $(window).off(Event.RESIZE); 2124 } 2125 }; 2126 2127 Modal.prototype._hideModal = function _hideModal() { 2128 var _this16 = this; 2129 2130 this._element.style.display = 'none'; 2131 this._element.setAttribute('aria-hidden', true); 2132 this._isTransitioning = false; 2133 this._showBackdrop(function () { 2134 $(document.body).removeClass(ClassName.OPEN); 2135 _this16._resetAdjustments(); 2136 _this16._resetScrollbar(); 2137 $(_this16._element).trigger(Event.HIDDEN); 2138 }); 2139 }; 2140 2141 Modal.prototype._removeBackdrop = function _removeBackdrop() { 2142 if (this._backdrop) { 2143 $(this._backdrop).remove(); 2144 this._backdrop = null; 2145 } 2146 }; 2147 2148 Modal.prototype._showBackdrop = function _showBackdrop(callback) { 2149 var _this17 = this; 2150 2151 var animate = $(this._element).hasClass(ClassName.FADE) ? ClassName.FADE : ''; 2152 2153 if (this._isShown && this._config.backdrop) { 2154 var doAnimate = Util.supportsTransitionEnd() && animate; 2155 2156 this._backdrop = document.createElement('div'); 2157 this._backdrop.className = ClassName.BACKDROP; 2158 2159 if (animate) { 2160 $(this._backdrop).addClass(animate); 2161 } 2162 2163 $(this._backdrop).appendTo(document.body); 2164 2165 $(this._element).on(Event.CLICK_DISMISS, function (event) { 2166 if (_this17._ignoreBackdropClick) { 2167 _this17._ignoreBackdropClick = false; 2168 return; 2169 } 2170 if (event.target !== event.currentTarget) { 2171 return; 2172 } 2173 if (_this17._config.backdrop === 'static') { 2174 _this17._element.focus(); 2175 } else { 2176 _this17.hide(); 2177 } 2178 }); 2179 2180 if (doAnimate) { 2181 Util.reflow(this._backdrop); 2182 } 2183 2184 $(this._backdrop).addClass(ClassName.SHOW); 2185 2186 if (!callback) { 2187 return; 2188 } 2189 2190 if (!doAnimate) { 2191 callback(); 2192 return; 2193 } 2194 2195 $(this._backdrop).one(Util.TRANSITION_END, callback).emulateTransitionEnd(BACKDROP_TRANSITION_DURATION); 2196 } else if (!this._isShown && this._backdrop) { 2197 $(this._backdrop).removeClass(ClassName.SHOW); 2198 2199 var callbackRemove = function callbackRemove() { 2200 _this17._removeBackdrop(); 2201 if (callback) { 2202 callback(); 2203 } 2204 }; 2205 2206 if (Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE)) { 2207 $(this._backdrop).one(Util.TRANSITION_END, callbackRemove).emulateTransitionEnd(BACKDROP_TRANSITION_DURATION); 2208 } else { 2209 callbackRemove(); 2210 } 2211 } else if (callback) { 2212 callback(); 2213 } 2214 }; 2215 2216 // ---------------------------------------------------------------------- 2217 // the following methods are used to handle overflowing modals 2218 // todo (fat): these should probably be refactored out of modal.js 2219 // ---------------------------------------------------------------------- 2220 2221 Modal.prototype._adjustDialog = function _adjustDialog() { 2222 var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; 2223 2224 if (!this._isBodyOverflowing && isModalOverflowing) { 2225 this._element.style.paddingLeft = this._scrollbarWidth + 'px'; 2226 } 2227 2228 if (this._isBodyOverflowing && !isModalOverflowing) { 2229 this._element.style.paddingRight = this._scrollbarWidth + 'px'; 2230 } 2231 }; 2232 2233 Modal.prototype._resetAdjustments = function _resetAdjustments() { 2234 this._element.style.paddingLeft = ''; 2235 this._element.style.paddingRight = ''; 2236 }; 2237 2238 Modal.prototype._checkScrollbar = function _checkScrollbar() { 2239 this._isBodyOverflowing = document.body.clientWidth < window.innerWidth; 2240 this._scrollbarWidth = this._getScrollbarWidth(); 2241 }; 2242 2243 Modal.prototype._setScrollbar = function _setScrollbar() { 2244 var _this18 = this; 2245 2246 if (this._isBodyOverflowing) { 2247 // Note: DOMNode.style.paddingRight returns the actual value or '' if not set 2248 // while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set 2249 2250 // Adjust fixed content padding 2251 $(Selector.FIXED_CONTENT).each(function (index, element) { 2252 var actualPadding = $(element)[0].style.paddingRight; 2253 var calculatedPadding = $(element).css('padding-right'); 2254 $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this18._scrollbarWidth + 'px'); 2255 }); 2256 2257 // Adjust navbar-toggler margin 2258 $(Selector.NAVBAR_TOGGLER).each(function (index, element) { 2259 var actualMargin = $(element)[0].style.marginRight; 2260 var calculatedMargin = $(element).css('margin-right'); 2261 $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) + _this18._scrollbarWidth + 'px'); 2262 }); 2263 2264 // Adjust body padding 2265 var actualPadding = document.body.style.paddingRight; 2266 var calculatedPadding = $('body').css('padding-right'); 2267 $('body').data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + 'px'); 2268 } 2269 }; 2270 2271 Modal.prototype._resetScrollbar = function _resetScrollbar() { 2272 // Restore fixed content padding 2273 $(Selector.FIXED_CONTENT).each(function (index, element) { 2274 var padding = $(element).data('padding-right'); 2275 if (typeof padding !== 'undefined') { 2276 $(element).css('padding-right', padding).removeData('padding-right'); 2277 } 2278 }); 2279 2280 // Restore navbar-toggler margin 2281 $(Selector.NAVBAR_TOGGLER).each(function (index, element) { 2282 var margin = $(element).data('margin-right'); 2283 if (typeof margin !== 'undefined') { 2284 $(element).css('margin-right', margin).removeData('margin-right'); 2285 } 2286 }); 2287 2288 // Restore body padding 2289 var padding = $('body').data('padding-right'); 2290 if (typeof padding !== 'undefined') { 2291 $('body').css('padding-right', padding).removeData('padding-right'); 2292 } 2293 }; 2294 2295 Modal.prototype._getScrollbarWidth = function _getScrollbarWidth() { 2296 // thx d.walsh 2297 var scrollDiv = document.createElement('div'); 2298 scrollDiv.className = ClassName.SCROLLBAR_MEASURER; 2299 document.body.appendChild(scrollDiv); 2300 var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth; 2301 document.body.removeChild(scrollDiv); 2302 return scrollbarWidth; 2303 }; 2304 2305 // static 2306 2307 Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) { 2308 return this.each(function () { 2309 var data = $(this).data(DATA_KEY); 2310 var _config = $.extend({}, Modal.Default, $(this).data(), (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' && config); 2311 2312 if (!data) { 2313 data = new Modal(this, _config); 2314 $(this).data(DATA_KEY, data); 2315 } 2316 2317 if (typeof config === 'string') { 2318 if (data[config] === undefined) {
2319 throw new Error('No method named "' + config + '"'); 2320 } 2321 data[config](relatedTarget); 2322 } else if (_config.show) { 2323 data.show(relatedTarget); 2324 } 2325 }); 2326 }; 2327 2328 _createClass(Modal, null, [{ 2329 key: 'VERSION', 2330 get: function get() { 2331 return VERSION; 2332 } 2333 }, { 2334 key: 'Default', 2335 get: function get() { 2336 return Default; 2337 } 2338 }]); 2339 2340 return Modal; 2341 }(); 2342 2343 /** 2344 * ------------------------------------------------------------------------ 2345 * Data Api implementation 2346 * ------------------------------------------------------------------------ 2347 */ 2348 2349 $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) { 2350 var _this19 = this; 2351 2352 var target = void 0; 2353 var selector = Util.getSelectorFromElement(this); 2354 2355 if (selector) { 2356 target = $(selector)[0]; 2357 } 2358 2359 var config = $(target).data(DATA_KEY) ? 'toggle' : $.extend({}, $(target).data(), $(this).data()); 2360 2361 if (this.tagName === 'A' || this.tagName === 'AREA') { 2362 event.preventDefault(); 2363 } 2364 2365 var $target = $(target).one(Event.SHOW, function (showEvent) { 2366 if (showEvent.isDefaultPrevented()) { 2367 // only register focus restorer if modal will actually get shown 2368 return; 2369 } 2370 2371 $target.one(Event.HIDDEN, function () { 2372 if ($(_this19).is(':visible')) { 2373 _this19.focus(); 2374 } 2375 }); 2376 }); 2377 2378 Modal._jQueryInterface.call($(target), config, this); 2379 }); 2380 2381 /** 2382 * ------------------------------------------------------------------------ 2383 * jQuery 2384 * ------------------------------------------------------------------------ 2385 */ 2386 2387 $.fn[NAME] = Modal._jQueryInterface; 2388 $.fn[NAME].Constructor = Modal; 2389 $.fn[NAME].noConflict = function () { 2390 $.fn[NAME] = JQUERY_NO_CONFLICT; 2391 return Modal._jQueryInterface; 2392 }; 2393 2394 return Modal; 2395 }(jQuery); 2396 2397 /** 2398 * -------------------------------------------------------------------------- 2399 * Bootstrap (v4.0.0-beta): scrollspy.js 2400 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 2401 * -------------------------------------------------------------------------- 2402 */ 2403 2404 var ScrollSpy = function ($) { 2405 2406 /** 2407 * ------------------------------------------------------------------------ 2408 * Constants 2409 * ------------------------------------------------------------------------ 2410 */ 2411 2412 var NAME = 'scrollspy'; 2413 var VERSION = '4.0.0-beta'; 2414 var DATA_KEY = 'bs.scrollspy'; 2415 var EVENT_KEY = '.' + DATA_KEY; 2416 var DATA_API_KEY = '.data-api'; 2417 var JQUERY_NO_CONFLICT = $.fn[NAME]; 2418 2419 var Default = { 2420 offset: 10, 2421 method: 'auto', 2422 target: '' 2423 }; 2424 2425 var DefaultType = { 2426 offset: 'number', 2427 method: 'string', 2428 target: '(string|element)' 2429 }; 2430 2431 var Event = { 2432 ACTIVATE: 'activate' + EVENT_KEY, 2433 SCROLL: 'scroll' + EVENT_KEY, 2434 LOAD_DATA_API: 'load' + EVENT_KEY + DATA_API_KEY 2435 }; 2436 2437 var ClassName = { 2438 DROPDOWN_ITEM: 'dropdown-item', 2439 DROPDOWN_MENU: 'dropdown-menu', 2440 ACTIVE: 'active' 2441 }; 2442 2443 var Selector = { 2444 DATA_SPY: '[data-spy="scroll"]', 2445 ACTIVE: '.active', 2446 NAV_LIST_GROUP: '.nav, .list-group', 2447 NAV_LINKS: '.nav-link', 2448 LIST_ITEMS: '.list-group-item', 2449 DROPDOWN: '.dropdown',
2450 DROPDOWN_ITEMS: '.dropdown-item', 2451 DROPDOWN_TOGGLE: '.dropdown-toggle' 2452 }; 2453 2454 var OffsetMethod = { 2455 OFFSET: 'offset', 2456 POSITION: 'position' 2457 2458 /** 2459 * ------------------------------------------------------------------------ 2460 * Class Definition 2461 * ------------------------------------------------------------------------ 2462 */ 2463 2464 }; 2465 var ScrollSpy = function () { 2466 function ScrollSpy(element, config) { 2467 var _this20 = this; 2468 2469 _classCallCheck(this, ScrollSpy); 2470 2471 this._element = element; 2472 this._scrollElement = element.tagName === 'BODY' ? window : element; 2473 this._config = this._getConfig(config); 2474 this._selector = this._config.target + ' ' + Selector.NAV_LINKS + ',' + (this._config.target + ' ' + Selector.LIST_ITEMS + ',') + (this._config.target + ' ' + Selector.DROPDOWN_ITEMS); 2475 this._offsets = []; 2476 this._targets = []; 2477 this._activeTarget = null; 2478 this._scrollHeight = 0; 2479 2480 $(this._scrollElement).on(Event.SCROLL, function (event) { 2481 return _this20._process(event); 2482 }); 2483 2484 this.refresh(); 2485 this._process(); 2486 } 2487 2488 // getters 2489 2490 // public 2491 2492 ScrollSpy.prototype.refresh = function refresh() { 2493 var _this21 = this; 2494 2495 var autoMethod = this._scrollElement !== this._scrollElement.window ? OffsetMethod.POSITION : OffsetMethod.OFFSET; 2496 2497 var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method; 2498 2499 var offsetBase = offsetMethod === OffsetMethod.POSITION ? this._getScrollTop() : 0; 2500 2501 this._offsets = []; 2502 this._targets = []; 2503 2504 this._scrollHeight = this._getScrollHeight(); 2505 2506 var targets = $.makeArray($(this._selector)); 2507 2508 targets.map(function (element) { 2509 var target = void 0; 2510 var targetSelector = Util.getSelectorFromElement(element); 2511 2512 if (targetSelector) { 2513 target = $(targetSelector)[0]; 2514 } 2515 2516 if (target) { 2517 var targetBCR = target.getBoundingClientRect(); 2518 if (targetBCR.width || targetBCR.height) { 2519 // todo (fat): remove sketch reliance on jQuery position/offset 2520 return [$(target)[offsetMethod]().top + offsetBase, targetSelector]; 2521 } 2522 } 2523 return null; 2524 }).filter(function (item) { 2525 return item; 2526 }).sort(function (a, b) { 2527 return a[0] - b[0]; 2528 }
2528).forEach(function (item) { 2529 _this21._offsets.push(item[0]); 2530 _this21._targets.push(item[1]); 2531 }); 2532 }; 2533 2534 ScrollSpy.prototype.dispose = function dispose() { 2535 $.removeData(this._element, DATA_KEY); 2536 $(this._scrollElement).off(EVENT_KEY); 2537 2538 this._element = null; 2539 this._scrollElement = null; 2540 this._config = null; 2541 this._selector = null; 2542 this._offsets = null; 2543 this._targets = null; 2544 this._activeTarget = null; 2545 this._scrollHeight = null; 2546 }; 2547 2548 // private 2549 2550 ScrollSpy.prototype._getConfig = function _getConfig(config) { 2551 config = $.extend({}, Default, config); 2552 2553 if (typeof config.target !== 'string') { 2554 var id = $(config.target).attr('id'); 2555 if (!id) { 2556 id = Util.getUID(NAME); 2557 $(config.target).attr('id', id); 2558 } 2559 config.target = '#' + id; 2560 } 2561 2562 Util.typeCheckConfig(NAME, config, DefaultType); 2563 2564 return config; 2565 }; 2566 2567 ScrollSpy.prototype._getScrollTop = function _getScrollTop() { 2568 return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop; 2569 }; 2570 2571 ScrollSpy.prototype._getScrollHeight = function _getScrollHeight() { 2572 return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight); 2573 }; 2574 2575 ScrollSpy.prototype._getOffsetHeight = function _getOffsetHeight() { 2576 return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height; 2577 }; 2578 2579 ScrollSpy.prototype._process = function _process() { 2580 var scrollTop = this._getScrollTop() + this._config.offset; 2581 var scrollHeight = this._getScrollHeight(); 2582 var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight(); 2583 2584 if (this._scrollHeight !== scrollHeight) { 2585 this.refresh(); 2586 } 2587 2588 if (scrollTop >= maxScroll) { 2589 var target = this._targets[this._targets.length - 1]; 2590 2591 if (this._activeTarget !== target) { 2592 this._activate(target); 2593 } 2594 return; 2595 } 2596 2597 if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) { 2598 this._activeTarget = null; 2599 this._clear(); 2600 return; 2601 } 2602 2603 for (var i = this._offsets.length; i--;) { 2604 var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (this._offsets[i + 1] === undefined || scrollTop < this._offsets[i + 1]); 2605 2606 if (isActiveTarget) { 2607 this._activate(this._targets[i]); 2608 } 2609 } 2610 }; 2611 2612 ScrollSpy.prototype._activate = function _activate(target) { 2613 this._activeTarget = target; 2614 2615 this._clear(); 2616 2617 var queries = this._selector.split(','); 2618 queries = queries.map(function (selector) { 2619 return selector + '[data-target="' + target + '"],' + (selector + '[href="' + target + '"]'); 2620 }); 2621 2622 var $link = $(queries.join(',')); 2623 2624 if ($link.hasClass(ClassName.DROPDOWN_ITEM)) { 2625 $link.closest(Selector.DROPDOWN).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE); 2626 $link.addClass(ClassName.ACTIVE); 2627 } else { 2628 // Set triggered link as active 2629 $link.addClass(ClassName.ACTIVE); 2630 // Set triggered links parents as active
2631 // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor 2632 $link.parents(Selector.NAV_LIST_GROUP).prev(Selector.NAV_LINKS + ', ' + Selector.LIST_ITEMS).addClass(ClassName.ACTIVE); 2633 } 2634 2635 $(this._scrollElement).trigger(Event.ACTIVATE, { 2636 relatedTarget: target 2637 }); 2638 }; 2639 2640 ScrollSpy.prototype._clear = function _clear() { 2641 $(this._selector).filter(Selector.ACTIVE).removeClass(ClassName.ACTIVE); 2642 }; 2643 2644 // static 2645 2646 ScrollSpy._jQueryInterface = function _jQueryInterface(config) { 2647 return this.each(function () { 2648 var data = $(this).data(DATA_KEY); 2649 var _config = (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' && config; 2650 2651 if (!data) { 2652 data = new ScrollSpy(this, _config); 2653 $(this).data(DATA_KEY, data); 2654 } 2655 2656 if (typeof config === 'string') { 2657 if (data[config] === undefined) { 2658 throw new Error('No method named "' + config + '"'); 2659 } 2660 data[config](); 2661 } 2662 }); 2663 }; 2664 2665 _createClass(ScrollSpy, null, [{ 2666 key: 'VERSION', 2667 get: function get() { 2668 return VERSION; 2669 } 2670 }, { 2671 key: 'Default', 2672 get: function get() { 2673 return Default; 2674 } 2675 }]); 2676 2677 return ScrollSpy; 2678 }(); 2679 2680 /** 2681 * ------------------------------------------------------------------------ 2682 * Data Api implementation 2683 * ------------------------------------------------------------------------ 2684 */ 2685 2686 $(window).on(Event.LOAD_DATA_API, function () { 2687 var scrollSpys = $.makeArray($(Selector.DATA_SPY)); 2688 2689 for (var i = scrollSpys.length; i--;) { 2690 var $spy = $(scrollSpys[i]); 2691 ScrollSpy._jQueryInterface.call($spy, $spy.data()); 2692 } 2693 }); 2694 2695 /** 2696 * ------------------------------------------------------------------------ 2697 * jQuery 2698 * ------------------------------------------------------------------------ 2699 */ 2700 2701 $.fn[NAME] = ScrollSpy._jQueryInterface; 2702 $.fn[NAME].Constructor = ScrollSpy; 2703 $.fn[NAME].noConflict = function () { 2704 $.fn[NAME] = JQUERY_NO_CONFLICT; 2705 return ScrollSpy._jQueryInterface; 2706 }; 2707 2708 return ScrollSpy; 2709 }(jQuery); 2710 2711 /** 2712 * -------------------------------------------------------------------------- 2713 * Bootstrap (v4.0.0-beta): tab.js 2714 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 2715 * -------------------------------------------------------------------------- 2716 */ 2717 2718 var Tab = function ($) { 2719 2720 /** 2721 * ------------------------------------------------------------------------ 2722 * Constants 2723 * ------------------------------------------------------------------------ 2724 */ 2725 2726 var NAME = 'tab'; 2727 var VERSION = '4.0.0-beta'; 2728 var DATA_KEY = 'bs.tab'; 2729 var EVENT_KEY = '.' + DATA_KEY; 2730 var DATA_API_KEY = '.data-api'; 2731 var JQUERY_NO_CONFLICT = $.fn[NAME]; 2732 var TRANSITION_DURATION = 150; 2733 2734 var Event = { 2735 HIDE: 'hide' + EVENT_KEY, 2736 HIDDEN: 'hidden' + EVENT_KEY, 2737 SHOW: 'show' + EVENT_KEY, 2738 SHOWN: 'shown' + EVENT_KEY, 2739 CLICK_DATA_API: 'click' + EVENT_KEY + DATA_API_KEY 2740 }; 2741 2742 var ClassName = { 2743 DROPDOWN_MENU: 'dropdown-menu', 2744 ACTIVE: 'active', 2745 DISABLED: 'disabled', 2746 FADE: 'fade', 2747 SHOW: 'show' 2748 }; 2749 2750 var Selector = { 2751 DROPDOWN: '.dropdown', 2752 NAV_LIST_GROUP: '.nav, .list-group', 2753 ACTIVE: '.active', 2754 ACTIVE_UL: '> li > .active', 2755 DATA_TOGGLE: '[data-toggle="tab"], [data-toggle="pill"], [data-toggle="list"]', 2756 DROPDOWN_TOGGLE: '.dropdown-toggle', 2757 DROPDOWN_ACTIVE_CHILD: '> .dropdown-menu .active' 2758 2759 /** 2760 * ------------------------------------------------------------------------ 2761 * Class Definition 2762 * ------------------------------------------------------------------------ 2763 */ 2764 2765 }; 2766 var Tab = function () { 2767 function Tab(element) { 2768 _classCallCheck(this, Tab); 2769 2770 this._element = element; 2771 } 2772 2773 // getters 2774 2775 // public 2776 2777 Tab.prototype.show = function show() { 2778 var _this22 = this; 2779 2780 if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName.ACTIVE) || $(this._element).hasClass(ClassName.DISABLED)) { 2781 return; 2782 } 2783 2784 var target = void 0; 2785 var previous = void 0; 2786 var listElement = $(this._element).closest(Selector.NAV_LIST_GROUP)[0]; 2787 var selector = Util.getSelectorFromElement(this._element); 2788 2789 if (listElement) { 2790 var itemSelector = listElement.nodeName === 'UL' ? Selector.ACTIVE_UL : Selector.ACTIVE; 2791 previous = $.makeArray($(listElement).find(itemSelector)); 2792 previous = previous[previous.length - 1]; 2793 } 2794 2795 var hideEvent = $.Event(Event.HIDE, { 2796 relatedTarget: this._element 2797 }); 2798 2799 var showEvent = $.Event(Event.SHOW, { 2800 relatedTarget: previous 2801 }); 2802 2803 if (previous) { 2804 $(previous).trigger(hideEvent); 2805 } 2806 2807 $(this._element).trigger(showEvent); 2808 2809 if (showEvent.isDefaultPrevented() || hideEvent.isDefaultPrevented()) { 2810 return; 2811 } 2812 2813 if (selector) { 2814 target = $(selector)[0]; 2815 } 2816 2817 this._activate(this._element, listElement); 2818 2819 var complete = function complete() { 2820 var hiddenEvent = $.Event(Event.HIDDEN, { 2821 relatedTarget: _this22._element 2822 }); 2823 2824 var shownEvent = $.Event(Event.SHOWN, { 2825 relatedTarget: previous 2826 }); 2827 2828 $(previous).trigger(hiddenEvent); 2829 $(_this22._element).trigger(shownEvent); 2830 }; 2831 2832 if (target) { 2833 this._activate(target, target.parentNode, complete); 2834 } else { 2835 complete(); 2836 } 2837 }; 2838 2839 Tab.prototype.dispose = function dispose() { 2840 $.removeData(this._element, DATA_KEY); 2841 this._element = null; 2842 }; 2843 2844 // private 2845 2846 Tab.prototype._activate = function _activate(element, container, callback) { 2847 var _this23 = this; 2848 2849 var activeElements = void 0; 2850 if (container.nodeName === 'UL') { 2851 activeElements = $(container).find(Selector.ACTIVE_UL); 2852 } else { 2853 activeElements = $(container).children(Selector.ACTIVE); 2854 } 2855 2856 var active = activeElements[0]; 2857 var isTransitioning = callback && Util.supportsTransitionEnd() && active && $(active).hasClass(ClassName.FADE); 2858 2859 var complete = function complete() { 2860 return _this23._transitionComplete(element, active, isTransitioning, callback); 2861 }; 2862 2863 if (active && isTransitioning) { 2864 $(active).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION); 2865 } else { 2866 complete(); 2867 } 2868 2869 if (active) { 2870 $(active).removeClass(ClassName.SHOW); 2871 } 2872 }; 2873 2874 Tab.prototype._transitionComplete = function _transitionComplete(element, active, isTransitioning, callback) { 2875 if (active) { 2876 $(active).removeClass(ClassName.ACTIVE); 2877
vendor: 5,598 bytes, lines 2878-3049
2878 var dropdownChild = $(active.parentNode).find(Selector.DROPDOWN_ACTIVE_CHILD)[0]; 2879 2880 if (dropdownChild) { 2881 $(dropdownChild).removeClass(ClassName.ACTIVE); 2882 } 2883 2884 active.setAttribute('aria-expanded', false); 2885 } 2886 2887 $(element).addClass(ClassName.ACTIVE); 2888 element.setAttribute('aria-expanded', true); 2889 2890 if (isTransitioning) { 2891 Util.reflow(element); 2892 $(element).addClass(ClassName.SHOW); 2893 } else { 2894 $(element).removeClass(ClassName.FADE); 2895 } 2896 2897 if (element.parentNode && $(element.parentNode).hasClass(ClassName.DROPDOWN_MENU)) { 2898 2899 var dropdownElement = $(element).closest(Selector.DROPDOWN)[0]; 2900 if (dropdownElement) { 2901 $(dropdownElement).find(Selector.DROPDOWN_TOGGLE).addClass(ClassName.ACTIVE); 2902 } 2903 2904 element.setAttribute('aria-expanded', true); 2905 } 2906 2907 if (callback) { 2908 callback(); 2909 } 2910 }; 2911 2912 // static 2913 2914 Tab._jQueryInterface = function _jQueryInterface(config) { 2915 return this.each(function () { 2916 var $this = $(this); 2917 var data = $this.data(DATA_KEY); 2918 2919 if (!data) { 2920 data = new Tab(this); 2921 $this.data(DATA_KEY, data); 2922 } 2923 2924 if (typeof config === 'string') { 2925 if (data[config] === undefined) { 2926 throw new Error('No method named "' + config + '"'); 2927 } 2928 data[config](); 2929 } 2930 }); 2931 }; 2932 2933 _createClass(Tab, null, [{ 2934 key: 'VERSION', 2935 get: function get() { 2936 return VERSION; 2937 } 2938 }]); 2939 2940 return Tab; 2941 }(); 2942 2943 /** 2944 * ------------------------------------------------------------------------ 2945 * Data Api implementation 2946 * ------------------------------------------------------------------------ 2947 */ 2948 2949 $(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) { 2950 event.preventDefault(); 2951 Tab._jQueryInterface.call($(this), 'show'); 2952 }); 2953 2954 /** 2955 * ------------------------------------------------------------------------ 2956 * jQuery 2957 * ------------------------------------------------------------------------ 2958 */ 2959 2960 $.fn[NAME] = Tab._jQueryInterface; 2961 $.fn[NAME].Constructor = Tab; 2962 $.fn[NAME].noConflict = function () { 2963 $.fn[NAME] = JQUERY_NO_CONFLICT; 2964 return Tab._jQueryInterface; 2965 }; 2966 2967 return Tab; 2968 }(jQuery); 2969 2970 /* global Popper */ 2971 2972 /** 2973 * -------------------------------------------------------------------------- 2974 * Bootstrap (v4.0.0-beta): tooltip.js 2975 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 2976 * -------------------------------------------------------------------------- 2977 */ 2978 2979 var Tooltip = function ($) { 2980 2981 /** 2982 * Check for Popper dependency 2983 * Popper - https://popper.js.org 2984 */ 2985 if (typeof Popper === 'undefined') { 2986 throw new Error('Bootstrap tooltips require Popper.js (https://popper.js.org)'); 2987 } 2988 2989 /** 2990 * ------------------------------------------------------------------------ 2991 * Constants 2992 * ------------------------------------------------------------------------ 2993 */ 2994 2995 var NAME = 'tooltip'; 2996 var VERSION = '4.0.0-beta'; 2997 var DATA_KEY = 'bs.tooltip'; 2998 var EVENT_KEY = '.' + DATA_KEY; 2999 var JQUERY_NO_CONFLICT = $.fn[NAME]; 3000 var TRANSITION_DURATION = 150; 3001 var CLASS_PREFIX = 'bs-tooltip'; 3002 var BSCLS_PREFIX_REGEX = new RegExp('(^|\\s)' + CLASS_PREFIX + '\\S+', 'g'); 3003 3004 var DefaultType = { 3005 animation: 'boolean', 3006 template: 'string', 3007 title: '(string|element|function)', 3008 trigger: 'string', 3009 delay: '(number|object)', 3010 html: 'boolean', 3011 selector: '(string|boolean)', 3012 placement: '(string|function)', 3013 offset: '(number|string)', 3014 container: '(string|element|boolean)', 3015 fallbackPlacement: '(string|array)' 3016 }; 3017 3018 var AttachmentMap = { 3019 AUTO: 'auto', 3020 TOP: 'top', 3021 RIGHT: 'right', 3022 BOTTOM: 'bottom', 3023 LEFT: 'left' 3024 }; 3025 3026 var Default = { 3027 animation: true, 3028 template: '<div class="tooltip" role="tooltip">' + '<div class="arrow"></div>' + '<div class="tooltip-inner"></div></div>', 3029 trigger: 'hover focus', 3030 title: '', 3031 delay: 0, 3032 html: false, 3033 selector: false, 3034 placement: 'top', 3035 offset: 0, 3036 container: false, 3037 fallbackPlacement: 'flip' 3038 }; 3039 3040 var HoverState = { 3041 SHOW: 'show', 3042 OUT: 'out' 3043 }; 3044 3045 var Event = { 3046 HIDE: 'hide' + EVENT_KEY, 3047 HIDDEN: 'hidden' + EVENT_KEY, 3048 SHOW: 'show' + EVENT_KEY, 3049 SHOWN: 'shown' + EVENT_KEY,
3050 INSERTED: 'inserted' + EVENT_KEY, 3051 CLICK: 'click' + EVENT_KEY, 3052 FOCUSIN: 'focusin' + EVENT_KEY, 3053 FOCUSOUT: 'focusout' + EVENT_KEY, 3054 MOUSEENTER: 'mouseenter' + EVENT_KEY, 3055 MOUSELEAVE: 'mouseleave' + EVENT_KEY 3056 }; 3057 3058 var ClassName = { 3059 FADE: 'fade', 3060 SHOW: 'show' 3061 }; 3062 3063 var Selector = { 3064 TOOLTIP: '.tooltip', 3065 TOOLTIP_INNER: '.tooltip-inner', 3066 ARROW: '.arrow' 3067 }; 3068 3069 var Trigger = { 3070 HOVER: 'hover', 3071 FOCUS: 'focus', 3072 CLICK: 'click', 3073 MANUAL: 'manual' 3074 3075 /** 3076 * ------------------------------------------------------------------------ 3077 * Class Definition 3078 * ------------------------------------------------------------------------ 3079 */ 3080 3081 }; 3082 var Tooltip = function () { 3083 function Tooltip(element, config) { 3084 _classCallCheck(this, Tooltip); 3085 3086 // private 3087 this._isEnabled = true; 3088 this._timeout = 0; 3089 this._hoverState = ''; 3090 this._activeTrigger = {}; 3091 this._popper = null; 3092 3093 // protected 3094 this.element = element; 3095 this.config = this._getConfig(config); 3096 this.tip = null; 3097 3098 this._setListeners(); 3099 } 3100 3101 // getters 3102 3103 // public 3104 3105 Tooltip.prototype.enable = function enable() { 3106 this._isEnabled = true; 3107 }; 3108 3109 Tooltip.prototype.disable = function disable() { 3110 this._isEnabled = false; 3111 }; 3112 3113 Tooltip.prototype.toggleEnabled = function toggleEnabled() { 3114 this._isEnabled = !this._isEnabled; 3115 }; 3116 3117 Tooltip.prototype.toggle = function toggle(event) { 3118 if (event) { 3119 var dataKey = this.constructor.DATA_KEY; 3120 var context = $(event.currentTarget).data(dataKey); 3121 3122 if (!context) { 3123 context = new this.constructor(event.currentTarget, this._getDelegateConfig()); 3124 $(event.currentTarget).data(dataKey, context); 3125 } 3126 3127 context._activeTrigger.click = !context._activeTrigger.click; 3128 3129 if (context._isWithActiveTrigger()) { 3130 context._enter(null, context); 3131 } else { 3132 context._leave(null, context); 3133 } 3134 } else { 3135 3136 if ($(this.getTipElement()).hasClass(ClassName.SHOW)) { 3137 this._leave(null, this); 3138 return; 3139 } 3140 3141 this._enter(null, this); 3142 } 3143 }; 3144 3145 Tooltip.prototype.dispose = function dispose() { 3146 clearTimeout(this._timeout); 3147 3148 $.removeData(this.element, this.constructor.DATA_KEY); 3149 3150 $(this.element).off(this.constructor.EVENT_KEY); 3151 $(this.element).closest('.modal').off('hide.bs.modal'); 3152 3153 if (this.tip) { 3154 $(this.tip).remove(); 3155 } 3156 3157 this._isEnabled = null; 3158 this._timeout = null; 3159 this._hoverState = null; 3160 this._activeTrigger = null; 3161 if (this._popper !== null) { 3162 this._popper.destroy(); 3163 } 3164 this._popper = null; 3165 3166 this.element = null; 3167 this.config = null; 3168 this.tip = null; 3169 }; 3170 3171 Tooltip.prototype.show = function show() { 3172 var _this24 = this; 3173 3174 if ($(this.element).css('display') === 'none') { 3175 throw new Error('Please use show on visible elements'); 3176 } 3177 3178 var showEvent = $.Event(this.constructor.Event.SHOW); 3179 if (this.isWithContent() && this._isEnabled) { 3180 $(this.element).trigger(showEvent); 3181 3182 var isInTheDom = $.contains(this.element.ownerDocument.documentElement, this.element); 3183 3184 if (showEvent.isDefaultPrevented() || !isInTheDom) { 3185 return; 3186 } 3187 3188 var tip = this.getTipElement(); 3189 var tipId = Util.getUID(this.constructor.NAME); 3190
3191 tip.setAttribute('id', tipId); 3192 this.element.setAttribute('aria-describedby', tipId); 3193 3194 this.setContent(); 3195 3196 if (this.config.animation) { 3197 $(tip).addClass(ClassName.FADE); 3198 } 3199 3200 var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this.element) : this.config.placement; 3201 3202 var attachment = this._getAttachment(placement); 3203 this.addAttachmentClass(attachment); 3204 3205 var container = this.config.container === false ? document.body : $(this.config.container); 3206 3207 $(tip).data(this.constructor.DATA_KEY, this); 3208 3209 if (!$.contains(this.element.ownerDocument.documentElement, this.tip)) { 3210 $(tip).appendTo(container); 3211 } 3212 3213 $(this.element).trigger(this.constructor.Event.INSERTED); 3214 3215 this._popper = new Popper(this.element, tip, { 3216 placement: attachment, 3217 modifiers: { 3218 offset: { 3219 offset: this.config.offset 3220 }, 3221 flip: { 3222 behavior: this.config.fallbackPlacement 3223 }, 3224 arrow: { 3225 element: Selector.ARROW 3226 } 3227 }, 3228 onCreate: function onCreate(data) { 3229 if (data.originalPlacement !== data.placement) { 3230 _this24._handlePopperPlacementChange(data); 3231 } 3232 }, 3233 onUpdate: function onUpdate(data) { 3234 _this24._handlePopperPlacementChange(data); 3235 } 3236 }); 3237 3238 $(tip).addClass(ClassName.SHOW); 3239 3240 // if this is a touch-enabled device we add extra 3241 // empty mouseover listeners to the body's immediate children; 3242 // only needed because of broken event delegation on iOS 3243 // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html 3244 if ('ontouchstart' in document.documentElement) { 3245 $('body').children().on('mouseover', null, $.noop); 3246 } 3247 3248 var complete = function complete() { 3249 if (_this24.config.animation) { 3250 _this24._fixTransition(); 3251 } 3252 var prevHoverState = _this24._hoverState; 3253 _this24._hoverState = null; 3254 3255 $(_this24.element).trigger(_this24.constructor.Event.SHOWN); 3256 3257 if (prevHoverState === HoverState.OUT) { 3258 _this24._leave(null, _this24); 3259 } 3260 }; 3261 3262 if (Util.supportsTransitionEnd() && $(this.tip).hasClass(ClassName.FADE)) { 3263 $(this.tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(Tooltip._TRANSITION_DURATION); 3264 } else { 3265 complete(); 3266 } 3267 } 3268 }; 3269 3270 Tooltip.prototype.hide = function hide(callback) { 3271 var _this25 = this; 3272 3273 var tip = this.getTipElement(); 3274 var hideEvent = $.Event(this.constructor.Event.HIDE); 3275 var complete = function complete() { 3276 if (_this25._hoverState !== HoverState.SHOW && tip.parentNode) { 3277 tip.parentNode.removeChild(tip); 3278 } 3279 3280 _this25._cleanTipClass(); 3281 _this25.element.removeAttribute('aria-describedby'); 3282 $(_this25.element).trigger(_this25.constructor.Event.HIDDEN); 3283 if (_this25._popper !== null) { 3284 _this25._popper.destroy(); 3285 } 3286 3287 if (callback) { 3288 callback(); 3289 } 3290 }; 3291 3292 $(this.element).trigger(hideEvent); 3293 3294 if (hideEvent.isDefaultPrevented()) { 3295 return; 3296 } 3297 3298 $(tip).removeClass(ClassName.SHOW); 3299 3300 // if this is a touch-enabled device we remove the extra 3301 // empty mouseover listeners we added for iOS support 3302 if ('ontouchstart' in document.documentElement) { 3303 $('body').children().off('mouseover', null, $.noop); 3304 } 3305 3306 this._activeTrigger[Trigger.CLICK] = false;
3307 this._activeTrigger[Trigger.FOCUS] = false; 3308 this._activeTrigger[Trigger.HOVER] = false; 3309 3310 if (Util.supportsTransitionEnd() && $(this.tip).hasClass(ClassName.FADE)) { 3311 3312 $(tip).one(Util.TRANSITION_END, complete).emulateTransitionEnd(TRANSITION_DURATION); 3313 } else { 3314 complete(); 3315 } 3316 3317 this._hoverState = ''; 3318 }; 3319 3320 Tooltip.prototype.update = function update() { 3321 if (this._popper !== null) { 3322 this._popper.scheduleUpdate(); 3323 } 3324 }; 3325 3326 // protected 3327 3328 Tooltip.prototype.isWithContent = function isWithContent() { 3329 return Boolean(this.getTitle()); 3330 }; 3331 3332 Tooltip.prototype.addAttachmentClass = function addAttachmentClass(attachment) { 3333 $(this.getTipElement()).addClass(CLASS_PREFIX + '-' + attachment); 3334 }; 3335 3336 Tooltip.prototype.getTipElement = function getTipElement() { 3337 return this.tip = this.tip || $(this.config.template)[0]; 3338 }; 3339 3340 Tooltip.prototype.setContent = function setContent() { 3341 var $tip = $(this.getTipElement()); 3342 this.setElementContent($tip.find(Selector.TOOLTIP_INNER), this.getTitle()); 3343 $tip.removeClass(ClassName.FADE + ' ' + ClassName.SHOW); 3344 }; 3345 3346 Tooltip.prototype.setElementContent = function setElementContent($element, content) { 3347 var html = this.config.html; 3348 if ((typeof content === 'undefined' ? 'undefined' : _typeof(content)) === 'object' && (content.nodeType || content.jquery)) { 3349 // content is a DOM node or a jQuery 3350 if (html) { 3351 if (!$(content).parent().is($element)) { 3352 $element.empty().append(content); 3353 } 3354 } else { 3355 $element.text($(content).text()); 3356 } 3357 } else { 3358 $element[html ? 'html' : 'text'](content); 3359 } 3360 }; 3361 3362 Tooltip.prototype.getTitle = function getTitle() { 3363 var title = this.element.getAttribute('data-original-title'); 3364 3365 if (!title) { 3366 title = typeof this.config.title === 'function' ? this.config.title.call(this.element) : this.config.title; 3367 } 3368 3369 return title; 3370 }; 3371 3372 // private 3373 3374 Tooltip.prototype._getAttachment = function _getAttachment(placement) { 3375 return AttachmentMap[placement.toUpperCase()]; 3376 }; 3377 3378 Tooltip.prototype._setListeners = function _setListeners() { 3379 var _this26 = this; 3380 3381 var triggers = this.config.trigger.split(' '); 3382 3383 triggers.forEach(function (trigger) { 3384 if (trigger === 'click') { 3385 $(_this26.element).on(_this26.constructor.Event.CLICK, _this26.config.selector, function (event) { 3386 return _this26.toggle(event); 3387 }); 3388 } else if (trigger !== Trigger.MANUAL) { 3389 var eventIn = trigger === Trigger.HOVER ? _this26.constructor.Event.MOUSEENTER : _this26.constructor.Event.FOCUSIN; 3390 var eventOut = trigger === Trigger.HOVER ? _this26.constructor.Event.MOUSELEAVE : _this26.constructor.Event.FOCUSOUT; 3391 3392 $(_this26.element).on(eventIn, _this26.config.selector, function (event) { 3393 return _this26._enter(event); 3394 }).on(eventOut, _this26.config.selector, function (event) { 3395 return _this26._leave(event); 3396 }); 3397 } 3398 3399 $(_this26.element).closest('.modal').on('hide.bs.modal', function () { 3400 return _this26.hide(); 3401 }); 3402 }); 3403 3404 if (this.config.selector) { 3405 this.config = $.extend({}, this.config, { 3406 trigger: 'manual', 3407 selector: '' 3408 }); 3409 } else { 3410 this._fixTitle(); 3411 } 3412 }; 3413 3414 Tooltip.prototype._fixTitle = function _fixTitle() { 3415 var titleType = _typeof(this.element.getAttribute('data-original-title')); 3416 if (this.element.getAttribute('title') || titleType !== 'string') { 3417 this.element.setAttribute('data-original-title', this.element.getAttribute('title') || ''); 3418 this.element.setAttribute('title', ''); 3419 } 3420 }; 3421 3422 Tooltip.prototype._enter = function _enter(event, context) { 3423 var dataKey = this.constructor.DATA_KEY; 3424 3425 context = context || $(event.currentTarget).data(dataKey); 3426 3427 if (!context) { 3428 context = new this.constructor(event.currentTarget, this._getDelegateConfig()); 3429 $(event.currentTarget).data(dataKey, context); 3430 } 3431 3432 if (event) { 3433 context._activeTrigger[event.type === 'focusin' ? Trigger.FOCUS : Trigger.HOVER] = true; 3434 } 3435 3436 if ($(context.getTipElement()).hasClass(ClassName.SHOW) || context._hoverState === HoverState.SHOW) { 3437 context._hoverState = HoverState.SHOW; 3438 return; 3439 } 3440 3441 clearTimeout(context._timeout); 3442 3443 context._hoverState = HoverState.SHOW; 3444 3445 if (!context.config.delay || !context.config.delay.show) { 3446 context.show(); 3447 return; 3448 } 3449 3450 context._timeout = setTimeout(function () { 3451 if (context._hoverState === HoverState.SHOW) { 3452 context.show(); 3453 } 3454 }, context.config.delay.show); 3455 }; 3456 3457 Tooltip.prototype._leave = function _leave(event, context) { 3458 var dataKey = this.constructor.DATA_KEY; 3459 3460 context = context || $(event.currentTarget).data(dataKey); 3461 3462 if (!context) { 3463 context = new this.constructor(event.currentTarget, this._getDelegateConfig()); 3464 $(event.currentTarget).data(dataKey, context); 3465 } 3466 3467 if (event) { 3468 context._activeTrigger[event.type === 'focusout' ? Trigger.FOCUS : Trigger.HOVER] = false;
3469 } 3470 3471 if (context._isWithActiveTrigger()) { 3472 return; 3473 } 3474 3475 clearTimeout(context._timeout); 3476 3477 context._hoverState = HoverState.OUT; 3478 3479 if (!context.config.delay || !context.config.delay.hide) { 3480 context.hide(); 3481 return; 3482 } 3483 3484 context._timeout = setTimeout(function () { 3485 if (context._hoverState === HoverState.OUT) { 3486 context.hide(); 3487 } 3488 }, context.config.delay.hide); 3489 }; 3490 3491 Tooltip.prototype._isWithActiveTrigger = function _isWithActiveTrigger() { 3492 for (var trigger in this._activeTrigger) { 3493 if (this._activeTrigger[trigger]) { 3494 return true; 3495 } 3496 } 3497 3498 return false; 3499 }; 3500 3501 Tooltip.prototype._getConfig = function _getConfig(config) { 3502 config = $.extend({}, this.constructor.Default, $(this.element).data(), config); 3503 3504 if (config.delay && typeof config.delay === 'number') { 3505 config.delay = { 3506 show: config.delay, 3507 hide: config.delay 3508 }; 3509 } 3510 3511 if (config.title && typeof config.title === 'number') { 3512 config.title = config.title.toString(); 3513 } 3514 3515 if (config.content && typeof config.content === 'number') { 3516 config.content = config.content.toString(); 3517 } 3518 3519 Util.typeCheckConfig(NAME, config, this.constructor.DefaultType); 3520 3521 return config; 3522 }; 3523 3524 Tooltip.prototype._getDelegateConfig = function _getDelegateConfig() { 3525 var config = {}; 3526 3527 if (this.config) { 3528 for (var key in this.config) { 3529 if (this.constructor.Default[key] !== this.config[key]) { 3530 config[key] = this.config[key]; 3531 } 3532 } 3533 } 3534 3535 return config; 3536 }; 3537 3538 Tooltip.prototype._cleanTipClass = function _cleanTipClass() { 3539 var $tip = $(this.getTipElement()); 3540 var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX); 3541 if (tabClass !== null && tabClass.length > 0) { 3542 $tip.removeClass(tabClass.join('')); 3543 } 3544 }; 3545 3546 Tooltip.prototype._handlePopperPlacementChange = function _handlePopperPlacementChange(data) { 3547 this._cleanTipClass(); 3548 this.addAttachmentClass(this._getAttachment(data.placement)); 3549 }; 3550 3551 Tooltip.prototype._fixTransition = function _fixTransition() { 3552 var tip = this.getTipElement(); 3553 var initConfigAnimation = this.config.animation; 3554 if (tip.getAttribute('x-placement') !== null) { 3555 return; 3556 } 3557 $(tip).removeClass(ClassName.FADE); 3558 this.config.animation = false; 3559 this.hide(); 3560 this.show(); 3561 this.config.animation = initConfigAnimation; 3562 }; 3563 3564 // static 3565 3566 Tooltip._jQueryInterface = function _jQueryInterface(config) { 3567 return this.each(function () { 3568 var data = $(this).data(DATA_KEY); 3569 var _config = (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' && config; 3570 3571 if (!data && /dispose|hide/.test(config)) { 3572 return; 3573 } 3574 3575 if (!data) { 3576 data = new Tooltip(this, _config); 3577 $(this).data(DATA_KEY, data); 3578 } 3579 3580 if (typeof config === 'string') { 3581 if (data[config] === undefined) {
3582 throw new Error('No method named "' + config + '"'); 3583 } 3584 data[config](); 3585 } 3586 }); 3587 }; 3588 3589 _createClass(Tooltip, null, [{ 3590 key: 'VERSION', 3591 get: function get() { 3592 return VERSION; 3593 } 3594 }, { 3595 key: 'Default', 3596 get: function get() { 3597 return Default; 3598 } 3599 }, { 3600 key: 'NAME', 3601 get: function get() { 3602 return NAME; 3603 } 3604 }, { 3605 key: 'DATA_KEY', 3606 get: function get() { 3607 return DATA_KEY; 3608 } 3609 }, { 3610 key: 'Event', 3611 get: function get() { 3612 return Event; 3613 } 3614 }, { 3615 key: 'EVENT_KEY', 3616 get: function get() { 3617 return EVENT_KEY; 3618 } 3619 }, { 3620 key: 'DefaultType', 3621 get: function get() { 3622 return DefaultType; 3623 } 3624 }]); 3625 3626 return Tooltip; 3627 }(); 3628 3629 /** 3630 * ------------------------------------------------------------------------ 3631 * jQuery 3632 * ------------------------------------------------------------------------ 3633 */ 3634 3635 $.fn[NAME] = Tooltip._jQueryInterface; 3636 $.fn[NAME].Constructor = Tooltip; 3637 $.fn[NAME].noConflict = function () { 3638 $.fn[NAME] = JQUERY_NO_CONFLICT; 3639 return Tooltip._jQueryInterface; 3640 }; 3641 3642 return Tooltip; 3643 }(jQuery); 3644 3645 /** 3646 * -------------------------------------------------------------------------- 3647 * Bootstrap (v4.0.0-beta): popover.js 3648 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 3649 * -------------------------------------------------------------------------- 3650 */ 3651 3652 var Popover = function ($) { 3653 3654 /** 3655 * ------------------------------------------------------------------------ 3656 * Constants 3657 * ------------------------------------------------------------------------ 3658 */ 3659 3660 var NAME = 'popover'; 3661 var VERSION = '4.0.0-beta'; 3662 var DATA_KEY = 'bs.popover'; 3663 var EVENT_KEY = '.' + DATA_KEY; 3664 var JQUERY_NO_CONFLICT = $.fn[NAME]; 3665 var CLASS_PREFIX = 'bs-popover'; 3666 var BSCLS_PREFIX_REGEX = new RegExp('(^|\\s)' + CLASS_PREFIX + '\\S+', 'g'); 3667 3668 var Default = $.extend({}, Tooltip.Default, { 3669 placement: 'right', 3670 trigger: 'click', 3671 content: '', 3672 template: '<div class="popover" role="tooltip">' + '<div class="arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div></div>' 3673 }); 3674 3675 var DefaultType = $.extend({}, Tooltip.DefaultType, { 3676 content: '(string|element|function)' 3677 }); 3678 3679 var ClassName = { 3680 FADE: 'fade', 3681 SHOW: 'show' 3682 }; 3683 3684 var Selector = { 3685 TITLE: '.popover-header', 3686 CONTENT: '.popover-body' 3687 }; 3688 3689 var Event = { 3690 HIDE: 'hide' + EVENT_KEY, 3691 HIDDEN: 'hidden' + EVENT_KEY, 3692 SHOW: 'show' + EVENT_KEY, 3693 SHOWN: 'shown' + EVENT_KEY, 3694 INSERTED: 'inserted' + EVENT_KEY, 3695 CLICK: 'click' + EVENT_KEY, 3696 FOCUSIN: 'focusin' + EVENT_KEY, 3697 FOCUSOUT: 'focusout' + EVENT_KEY, 3698 MOUSEENTER: 'mouseenter' + EVENT_KEY, 3699 MOUSELEAVE: 'mouseleave' + EVENT_KEY 3700 3701 /** 3702 * ------------------------------------------------------------------------ 3703 * Class Definition 3704 * ------------------------------------------------------------------------ 3705 */ 3706 3707 }; 3708 var Popover = function (_Tooltip) { 3709 _inherits(Popover, _Tooltip); 3710 3711 function Popover() { 3712 _classCallCheck(this, Popover); 3713 3714 return _possibleConstructorReturn(this, _Tooltip.apply(this, arguments)); 3715 } 3716 3717 // overrides 3718 3719 Popover.prototype.isWithContent = function isWithContent() { 3720 return this.getTitle() || this._getContent(); 3721 }; 3722 3723 Popover.prototype.addAttachmentClass = function addAttachmentClass(attachment) { 3724 $(this.getTipElement()).addClass(CLASS_PREFIX + '-' + attachment); 3725 }; 3726 3727 Popover.prototype.getTipElement = function getTipElement() { 3728 return this.tip = this.tip || $(this.config.template)[0]; 3729 }; 3730 3731 Popover.prototype.setContent = function setContent() { 3732 var $tip = $(this.getTipElement()); 3733 3734 // we use append for html objects to maintain js events 3735 this.setElementContent($tip.find(Selector.TITLE), this.getTitle()); 3736 this.setElementContent($tip.find(Selector.CONTENT), this._getContent()); 3737 3738 $tip.removeClass(ClassName.FADE + ' ' + ClassName.SHOW); 3739 }; 3740 3741 // private 3742 3743 Popover.prototype._getContent = function _getContent() { 3744 return this.element.getAttribute('data-content') || (typeof this.config.content === 'function' ? this.config.content.call(this.element) : this.config.content); 3745 }; 3746 3747 Popover.prototype._cleanTipClass = function _cleanTipClass() { 3748 var $tip = $(this.getTipElement()); 3749 var tabClass = $tip.attr('class').match(BSCLS_PREFIX_REGEX); 3750 if (tabClass !== null && tabClass.length > 0) { 3751 $tip.removeClass(tabClass.join('')); 3752 } 3753 }; 3754 3755 // static 3756 3757 Popover._jQueryInterface = function _jQueryInterface(config) { 3758 return this.each(function () { 3759 var data = $(this).data(DATA_KEY); 3760 var _config = (typeof config === 'undefined' ? 'undefined' : _typeof(config)) === 'object' ? config : null; 3761 3762 if (!data && /destroy|hide/.test(config)) { 3763 return; 3764 } 3765 3766 if (!data) { 3767 data = new Popover(this, _config); 3768 $(this).data(DATA_KEY, data); 3769 } 3770 3771 if (typeof config === 'string') { 3772 if (data[config] === undefined) {
vendor: 1,813 bytes, lines 3773-3841
3773 throw new Error('No method named "' + config + '"'); 3774 } 3775 data[config](); 3776 } 3777 }); 3778 }; 3779 3780 _createClass(Popover, null, [{ 3781 key: 'VERSION', 3782 3783 3784 // getters 3785 3786 get: function get() { 3787 return VERSION; 3788 } 3789 }, { 3790 key: 'Default', 3791 get: function get() { 3792 return Default; 3793 } 3794 }, { 3795 key: 'NAME', 3796 get: function get() { 3797 return NAME; 3798 } 3799 }, { 3800 key: 'DATA_KEY', 3801 get: function get() { 3802 return DATA_KEY; 3803 } 3804 }, { 3805 key: 'Event', 3806 get: function get() { 3807 return Event; 3808 } 3809 }, { 3810 key: 'EVENT_KEY', 3811 get: function get() { 3812 return EVENT_KEY; 3813 } 3814 }, { 3815 key: 'DefaultType', 3816 get: function get() { 3817 return DefaultType; 3818 } 3819 }]); 3820 3821 return Popover; 3822 }(Tooltip); 3823 3824 /** 3825 * ------------------------------------------------------------------------ 3826 * jQuery 3827 * ------------------------------------------------------------------------ 3828 */ 3829 3830 $.fn[NAME] = Popover._jQueryInterface; 3831 $.fn[NAME].Constructor = Popover; 3832 $.fn[NAME].noConflict = function () { 3833 $.fn[NAME] = JQUERY_NO_CONFLICT; 3834 return Popover._jQueryInterface; 3835 }; 3836 3837 return Popover; 3838 }(jQuery); 3839 3840 3841})();
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.