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