1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-08 22:56:46 +02:00
This commit is contained in:
XhmikosR
2019-04-18 14:47:52 +03:00
committed by GitHub
parent 5c5b15a077
commit 091aa1e9fd
48 changed files with 2632 additions and 2060 deletions

62
js/dist/toast.js vendored
View File

@@ -102,7 +102,9 @@
};
var triggerTransitionEnd = function triggerTransitionEnd(element) {
element.dispatchEvent(new Event(TRANSITION_END));
var evt = document.createEvent('HTMLEvents');
evt.initEvent(TRANSITION_END, true, true);
element.dispatchEvent(evt);
};
var isElement = function isElement(obj) {
@@ -149,7 +151,7 @@
var VERSION = '4.3.1';
var DATA_KEY = 'bs.toast';
var EVENT_KEY = "." + DATA_KEY;
var Event$1 = {
var Event = {
CLICK_DISMISS: "click.dismiss" + EVENT_KEY,
HIDE: "hide" + EVENT_KEY,
HIDDEN: "hidden" + EVENT_KEY,
@@ -202,7 +204,7 @@
_proto.show = function show() {
var _this = this;
EventHandler.trigger(this._element, Event$1.SHOW);
EventHandler.trigger(this._element, Event.SHOW);
if (this._config.animation) {
this._element.classList.add(ClassName.FADE);
@@ -213,10 +215,12 @@
_this._element.classList.add(ClassName.SHOW);
EventHandler.trigger(_this._element, Event$1.SHOWN);
EventHandler.trigger(_this._element, Event.SHOWN);
if (_this._config.autohide) {
_this.hide();
_this._timeout = setTimeout(function () {
_this.hide();
}, _this._config.delay);
}
};
@@ -233,21 +237,29 @@
}
};
_proto.hide = function hide(withoutTimeout) {
_proto.hide = function hide() {
var _this2 = this;
if (!this._element.classList.contains(ClassName.SHOW)) {
return;
}
EventHandler.trigger(this._element, Event$1.HIDE);
EventHandler.trigger(this._element, Event.HIDE);
if (withoutTimeout) {
this._close();
var complete = function complete() {
_this2._element.classList.add(ClassName.HIDE);
EventHandler.trigger(_this2._element, Event.HIDDEN);
};
this._element.classList.remove(ClassName.SHOW);
if (this._config.animation) {
var transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler.one(this._element, TRANSITION_END, complete);
emulateTransitionEnd(this._element, transitionDuration);
} else {
this._timeout = setTimeout(function () {
_this2._close();
}, this._config.delay);
complete();
}
};
@@ -259,7 +271,7 @@
this._element.classList.remove(ClassName.SHOW);
}
EventHandler.off(this._element, Event$1.CLICK_DISMISS);
EventHandler.off(this._element, Event.CLICK_DISMISS);
Data.removeData(this._element, DATA_KEY);
this._element = null;
this._config = null;
@@ -275,29 +287,9 @@
_proto._setListeners = function _setListeners() {
var _this3 = this;
EventHandler.on(this._element, Event$1.CLICK_DISMISS, Selector.DATA_DISMISS, function () {
return _this3.hide(true);
EventHandler.on(this._element, Event.CLICK_DISMISS, Selector.DATA_DISMISS, function () {
return _this3.hide();
});
};
_proto._close = function _close() {
var _this4 = this;
var complete = function complete() {
_this4._element.classList.add(ClassName.HIDE);
EventHandler.trigger(_this4._element, Event$1.HIDDEN);
};
this._element.classList.remove(ClassName.SHOW);
if (this._config.animation) {
var transitionDuration = getTransitionDurationFromElement(this._element);
EventHandler.one(this._element, TRANSITION_END, complete);
emulateTransitionEnd(this._element, transitionDuration);
} else {
complete();
}
} // Static
;