aboutsummaryrefslogtreecommitdiffstats
path: root/library/bootstrap/js/bootstrap.js
diff options
context:
space:
mode:
Diffstat (limited to 'library/bootstrap/js/bootstrap.js')
-rw-r--r--library/bootstrap/js/bootstrap.js160
1 files changed, 77 insertions, 83 deletions
diff --git a/library/bootstrap/js/bootstrap.js b/library/bootstrap/js/bootstrap.js
index 086ba45b6..1da566756 100644
--- a/library/bootstrap/js/bootstrap.js
+++ b/library/bootstrap/js/bootstrap.js
@@ -1625,8 +1625,6 @@ var Dropdown = function ($) {
};
Dropdown.prototype._getPopperConfig = function _getPopperConfig() {
- var _this10 = this;
-
var popperConfig = {
placement: this._getPlacement(),
modifiers: {
@@ -1639,14 +1637,10 @@ var Dropdown = function ($) {
}
};
+ // Disable Popper.js for Dropdown in Navbar
if (this._inNavbar) {
- popperConfig.modifiers.AfterApplyStyle = {
- enabled: true,
- order: 901, // ApplyStyle order + 1
- fn: function fn() {
- // reset Popper styles
- $(_this10._menu).attr('style', '');
- }
+ popperConfig.modifiers.applyStyle = {
+ enabled: !this._inNavbar
};
}
return popperConfig;
@@ -1929,7 +1923,7 @@ var Modal = function ($) {
};
Modal.prototype.show = function show(relatedTarget) {
- var _this11 = this;
+ var _this10 = this;
if (this._isTransitioning) {
return;
@@ -1960,24 +1954,24 @@ var Modal = function ($) {
this._setResizeEvent();
$(this._element).on(Event.CLICK_DISMISS, Selector.DATA_DISMISS, function (event) {
- return _this11.hide(event);
+ return _this10.hide(event);
});
$(this._dialog).on(Event.MOUSEDOWN_DISMISS, function () {
- $(_this11._element).one(Event.MOUSEUP_DISMISS, function (event) {
- if ($(event.target).is(_this11._element)) {
- _this11._ignoreBackdropClick = true;
+ $(_this10._element).one(Event.MOUSEUP_DISMISS, function (event) {
+ if ($(event.target).is(_this10._element)) {
+ _this10._ignoreBackdropClick = true;
}
});
});
this._showBackdrop(function () {
- return _this11._showElement(relatedTarget);
+ return _this10._showElement(relatedTarget);
});
};
Modal.prototype.hide = function hide(event) {
- var _this12 = this;
+ var _this11 = this;
if (event) {
event.preventDefault();
@@ -2016,7 +2010,7 @@ var Modal = function ($) {
if (transition) {
$(this._element).one(Util.TRANSITION_END, function (event) {
- return _this12._hideModal(event);
+ return _this11._hideModal(event);
}).emulateTransitionEnd(TRANSITION_DURATION);
} else {
this._hideModal();
@@ -2051,7 +2045,7 @@ var Modal = function ($) {
};
Modal.prototype._showElement = function _showElement(relatedTarget) {
- var _this13 = this;
+ var _this12 = this;
var transition = Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.FADE);
@@ -2079,11 +2073,11 @@ var Modal = function ($) {
});
var transitionComplete = function transitionComplete() {
- if (_this13._config.focus) {
- _this13._element.focus();
+ if (_this12._config.focus) {
+ _this12._element.focus();
}
- _this13._isTransitioning = false;
- $(_this13._element).trigger(shownEvent);
+ _this12._isTransitioning = false;
+ $(_this12._element).trigger(shownEvent);
};
if (transition) {
@@ -2094,24 +2088,24 @@ var Modal = function ($) {
};
Modal.prototype._enforceFocus = function _enforceFocus() {
- var _this14 = this;
+ var _this13 = this;
$(document).off(Event.FOCUSIN) // guard against infinite focus loop
.on(Event.FOCUSIN, function (event) {
- if (document !== event.target && _this14._element !== event.target && !$(_this14._element).has(event.target).length) {
- _this14._element.focus();
+ if (document !== event.target && _this13._element !== event.target && !$(_this13._element).has(event.target).length) {
+ _this13._element.focus();
}
});
};
Modal.prototype._setEscapeEvent = function _setEscapeEvent() {
- var _this15 = this;
+ var _this14 = this;
if (this._isShown && this._config.keyboard) {
$(this._element).on(Event.KEYDOWN_DISMISS, function (event) {
if (event.which === ESCAPE_KEYCODE) {
event.preventDefault();
- _this15.hide();
+ _this14.hide();
}
});
} else if (!this._isShown) {
@@ -2120,11 +2114,11 @@ var Modal = function ($) {
};
Modal.prototype._setResizeEvent = function _setResizeEvent() {
- var _this16 = this;
+ var _this15 = this;
if (this._isShown) {
$(window).on(Event.RESIZE, function (event) {
- return _this16.handleUpdate(event);
+ return _this15.handleUpdate(event);
});
} else {
$(window).off(Event.RESIZE);
@@ -2132,16 +2126,16 @@ var Modal = function ($) {
};
Modal.prototype._hideModal = function _hideModal() {
- var _this17 = this;
+ var _this16 = this;
this._element.style.display = 'none';
this._element.setAttribute('aria-hidden', true);
this._isTransitioning = false;
this._showBackdrop(function () {
$(document.body).removeClass(ClassName.OPEN);
- _this17._resetAdjustments();
- _this17._resetScrollbar();
- $(_this17._element).trigger(Event.HIDDEN);
+ _this16._resetAdjustments();
+ _this16._resetScrollbar();
+ $(_this16._element).trigger(Event.HIDDEN);
});
};
@@ -2153,7 +2147,7 @@ var Modal = function ($) {
};
Modal.prototype._showBackdrop = function _showBackdrop(callback) {
- var _this18 = this;
+ var _this17 = this;
var animate = $(this._element).hasClass(ClassName.FADE) ? ClassName.FADE : '';
@@ -2170,17 +2164,17 @@ var Modal = function ($) {
$(this._backdrop).appendTo(document.body);
$(this._element).on(Event.CLICK_DISMISS, function (event) {
- if (_this18._ignoreBackdropClick) {
- _this18._ignoreBackdropClick = false;
+ if (_this17._ignoreBackdropClick) {
+ _this17._ignoreBackdropClick = false;
return;
}
if (event.target !== event.currentTarget) {
return;
}
- if (_this18._config.backdrop === 'static') {
- _this18._element.focus();
+ if (_this17._config.backdrop === 'static') {
+ _this17._element.focus();
} else {
- _this18.hide();
+ _this17.hide();
}
});
@@ -2204,7 +2198,7 @@ var Modal = function ($) {
$(this._backdrop).removeClass(ClassName.SHOW);
var callbackRemove = function callbackRemove() {
- _this18._removeBackdrop();
+ _this17._removeBackdrop();
if (callback) {
callback();
}
@@ -2248,7 +2242,7 @@ var Modal = function ($) {
};
Modal.prototype._setScrollbar = function _setScrollbar() {
- var _this19 = this;
+ var _this18 = this;
if (this._isBodyOverflowing) {
// Note: DOMNode.style.paddingRight returns the actual value or '' if not set
@@ -2258,14 +2252,14 @@ var Modal = function ($) {
$(Selector.FIXED_CONTENT).each(function (index, element) {
var actualPadding = $(element)[0].style.paddingRight;
var calculatedPadding = $(element).css('padding-right');
- $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this19._scrollbarWidth + 'px');
+ $(element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this18._scrollbarWidth + 'px');
});
// Adjust navbar-toggler margin
$(Selector.NAVBAR_TOGGLER).each(function (index, element) {
var actualMargin = $(element)[0].style.marginRight;
var calculatedMargin = $(element).css('margin-right');
- $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) + _this19._scrollbarWidth + 'px');
+ $(element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) + _this18._scrollbarWidth + 'px');
});
// Adjust body padding
@@ -2354,7 +2348,7 @@ var Modal = function ($) {
*/
$(document).on(Event.CLICK_DATA_API, Selector.DATA_TOGGLE, function (event) {
- var _this20 = this;
+ var _this19 = this;
var target = void 0;
var selector = Util.getSelectorFromElement(this);
@@ -2376,8 +2370,8 @@ var Modal = function ($) {
}
$target.one(Event.HIDDEN, function () {
- if ($(_this20).is(':visible')) {
- _this20.focus();
+ if ($(_this19).is(':visible')) {
+ _this19.focus();
}
});
});
@@ -2471,7 +2465,7 @@ var ScrollSpy = function ($) {
var ScrollSpy = function () {
function ScrollSpy(element, config) {
- var _this21 = this;
+ var _this20 = this;
_classCallCheck(this, ScrollSpy);
@@ -2485,7 +2479,7 @@ var ScrollSpy = function ($) {
this._scrollHeight = 0;
$(this._scrollElement).on(Event.SCROLL, function (event) {
- return _this21._process(event);
+ return _this20._process(event);
});
this.refresh();
@@ -2497,7 +2491,7 @@ var ScrollSpy = function ($) {
// public
ScrollSpy.prototype.refresh = function refresh() {
- var _this22 = this;
+ var _this21 = this;
var autoMethod = this._scrollElement !== this._scrollElement.window ? OffsetMethod.POSITION : OffsetMethod.OFFSET;
@@ -2533,8 +2527,8 @@ var ScrollSpy = function ($) {
}).sort(function (a, b) {
return a[0] - b[0];
}).forEach(function (item) {
- _this22._offsets.push(item[0]);
- _this22._targets.push(item[1]);
+ _this21._offsets.push(item[0]);
+ _this21._targets.push(item[1]);
});
};
@@ -2781,7 +2775,7 @@ var Tab = function ($) {
// public
Tab.prototype.show = function show() {
- var _this23 = this;
+ var _this22 = this;
if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && $(this._element).hasClass(ClassName.ACTIVE) || $(this._element).hasClass(ClassName.DISABLED)) {
return;
@@ -2823,7 +2817,7 @@ var Tab = function ($) {
var complete = function complete() {
var hiddenEvent = $.Event(Event.HIDDEN, {
- relatedTarget: _this23._element
+ relatedTarget: _this22._element
});
var shownEvent = $.Event(Event.SHOWN, {
@@ -2831,7 +2825,7 @@ var Tab = function ($) {
});
$(previous).trigger(hiddenEvent);
- $(_this23._element).trigger(shownEvent);
+ $(_this22._element).trigger(shownEvent);
};
if (target) {
@@ -2849,13 +2843,13 @@ var Tab = function ($) {
// private
Tab.prototype._activate = function _activate(element, container, callback) {
- var _this24 = this;
+ var _this23 = this;
var active = $(container).find(Selector.ACTIVE)[0];
var isTransitioning = callback && Util.supportsTransitionEnd() && active && $(active).hasClass(ClassName.FADE);
var complete = function complete() {
- return _this24._transitionComplete(element, active, isTransitioning, callback);
+ return _this23._transitionComplete(element, active, isTransitioning, callback);
};
if (active && isTransitioning) {
@@ -3167,7 +3161,7 @@ var Tooltip = function ($) {
};
Tooltip.prototype.show = function show() {
- var _this25 = this;
+ var _this24 = this;
if ($(this.element).css('display') === 'none') {
throw new Error('Please use show on visible elements');
@@ -3225,11 +3219,11 @@ var Tooltip = function ($) {
},
onCreate: function onCreate(data) {
if (data.originalPlacement !== data.placement) {
- _this25._handlePopperPlacementChange(data);
+ _this24._handlePopperPlacementChange(data);
}
},
onUpdate: function onUpdate(data) {
- _this25._handlePopperPlacementChange(data);
+ _this24._handlePopperPlacementChange(data);
}
});
@@ -3244,16 +3238,16 @@ var Tooltip = function ($) {
}
var complete = function complete() {
- if (_this25.config.animation) {
- _this25._fixTransition();
+ if (_this24.config.animation) {
+ _this24._fixTransition();
}
- var prevHoverState = _this25._hoverState;
- _this25._hoverState = null;
+ var prevHoverState = _this24._hoverState;
+ _this24._hoverState = null;
- $(_this25.element).trigger(_this25.constructor.Event.SHOWN);
+ $(_this24.element).trigger(_this24.constructor.Event.SHOWN);
if (prevHoverState === HoverState.OUT) {
- _this25._leave(null, _this25);
+ _this24._leave(null, _this24);
}
};
@@ -3266,20 +3260,20 @@ var Tooltip = function ($) {
};
Tooltip.prototype.hide = function hide(callback) {
- var _this26 = this;
+ var _this25 = this;
var tip = this.getTipElement();
var hideEvent = $.Event(this.constructor.Event.HIDE);
var complete = function complete() {
- if (_this26._hoverState !== HoverState.SHOW && tip.parentNode) {
+ if (_this25._hoverState !== HoverState.SHOW && tip.parentNode) {
tip.parentNode.removeChild(tip);
}
- _this26._cleanTipClass();
- _this26.element.removeAttribute('aria-describedby');
- $(_this26.element).trigger(_this26.constructor.Event.HIDDEN);
- if (_this26._popper !== null) {
- _this26._popper.destroy();
+ _this25._cleanTipClass();
+ _this25.element.removeAttribute('aria-describedby');
+ $(_this25.element).trigger(_this25.constructor.Event.HIDDEN);
+ if (_this25._popper !== null) {
+ _this25._popper.destroy();
}
if (callback) {
@@ -3374,28 +3368,28 @@ var Tooltip = function ($) {
};
Tooltip.prototype._setListeners = function _setListeners() {
- var _this27 = this;
+ var _this26 = this;
var triggers = this.config.trigger.split(' ');
triggers.forEach(function (trigger) {
if (trigger === 'click') {
- $(_this27.element).on(_this27.constructor.Event.CLICK, _this27.config.selector, function (event) {
- return _this27.toggle(event);
+ $(_this26.element).on(_this26.constructor.Event.CLICK, _this26.config.selector, function (event) {
+ return _this26.toggle(event);
});
} else if (trigger !== Trigger.MANUAL) {
- var eventIn = trigger === Trigger.HOVER ? _this27.constructor.Event.MOUSEENTER : _this27.constructor.Event.FOCUSIN;
- var eventOut = trigger === Trigger.HOVER ? _this27.constructor.Event.MOUSELEAVE : _this27.constructor.Event.FOCUSOUT;
+ var eventIn = trigger === Trigger.HOVER ? _this26.constructor.Event.MOUSEENTER : _this26.constructor.Event.FOCUSIN;
+ var eventOut = trigger === Trigger.HOVER ? _this26.constructor.Event.MOUSELEAVE : _this26.constructor.Event.FOCUSOUT;
- $(_this27.element).on(eventIn, _this27.config.selector, function (event) {
- return _this27._enter(event);
- }).on(eventOut, _this27.config.selector, function (event) {
- return _this27._leave(event);
+ $(_this26.element).on(eventIn, _this26.config.selector, function (event) {
+ return _this26._enter(event);
+ }).on(eventOut, _this26.config.selector, function (event) {
+ return _this26._leave(event);
});
}
- $(_this27.element).closest('.modal').on('hide.bs.modal', function () {
- return _this27.hide();
+ $(_this26.element).closest('.modal').on('hide.bs.modal', function () {
+ return _this26.hide();
});
});