diff options
Diffstat (limited to 'js/dist/alert.js')
-rw-r--r-- | js/dist/alert.js | 175 |
1 files changed, 81 insertions, 94 deletions
diff --git a/js/dist/alert.js b/js/dist/alert.js index b9cc9dd0fb..4b99701665 100644 --- a/js/dist/alert.js +++ b/js/dist/alert.js @@ -1,8 +1,6 @@ -'use strict'; +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; }; }(); -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; }; })(); - -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * -------------------------------------------------------------------------- @@ -11,7 +9,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons * -------------------------------------------------------------------------- */ -var Alert = (function ($) { +var Alert = function ($) { /** * ------------------------------------------------------------------------ @@ -49,120 +47,103 @@ var Alert = (function ($) { * ------------------------------------------------------------------------ */ - var Alert = (function () { + var Alert = function () { function Alert(element) { _classCallCheck(this, Alert); this._element = element; } - /** - * ------------------------------------------------------------------------ - * Data Api implementation - * ------------------------------------------------------------------------ - */ - // getters - _createClass(Alert, [{ - key: 'close', + // public - // public + Alert.prototype.close = function close(element) { + element = element || this._element; - value: function close(element) { - element = element || this._element; + var rootElement = this._getRootElement(element); + var customEvent = this._triggerCloseEvent(rootElement); - var rootElement = this._getRootElement(element); - var customEvent = this._triggerCloseEvent(rootElement); + if (customEvent.isDefaultPrevented()) { + return; + } - if (customEvent.isDefaultPrevented()) { - return; - } + this._removeElement(rootElement); + }; + + Alert.prototype.dispose = function dispose() { + $.removeData(this._element, DATA_KEY); + this._element = null; + }; + + // private + + Alert.prototype._getRootElement = function _getRootElement(element) { + var selector = Util.getSelectorFromElement(element); + var parent = false; - this._removeElement(rootElement); + if (selector) { + parent = $(selector)[0]; } - }, { - key: 'dispose', - value: function dispose() { - $.removeData(this._element, DATA_KEY); - this._element = null; + + if (!parent) { + parent = $(element).closest('.' + ClassName.ALERT)[0]; } - // private + return parent; + }; - }, { - key: '_getRootElement', - value: function _getRootElement(element) { - var selector = Util.getSelectorFromElement(element); - var parent = false; + Alert.prototype._triggerCloseEvent = function _triggerCloseEvent(element) { + var closeEvent = $.Event(Event.CLOSE); - if (selector) { - parent = $(selector)[0]; - } + $(element).trigger(closeEvent); + return closeEvent; + }; - if (!parent) { - parent = $(element).closest('.' + ClassName.ALERT)[0]; - } + Alert.prototype._removeElement = function _removeElement(element) { + $(element).removeClass(ClassName.IN); - return parent; + if (!Util.supportsTransitionEnd() || !$(element).hasClass(ClassName.FADE)) { + this._destroyElement(element); + return; } - }, { - key: '_triggerCloseEvent', - value: function _triggerCloseEvent(element) { - var closeEvent = $.Event(Event.CLOSE); - $(element).trigger(closeEvent); - return closeEvent; - } - }, { - key: '_removeElement', - value: function _removeElement(element) { - $(element).removeClass(ClassName.IN); - - if (!Util.supportsTransitionEnd() || !$(element).hasClass(ClassName.FADE)) { - this._destroyElement(element); - return; - } + $(element).one(Util.TRANSITION_END, $.proxy(this._destroyElement, this, element)).emulateTransitionEnd(TRANSITION_DURATION); + }; - $(element).one(Util.TRANSITION_END, $.proxy(this._destroyElement, this, element)).emulateTransitionEnd(TRANSITION_DURATION); - } - }, { - key: '_destroyElement', - value: function _destroyElement(element) { - $(element).detach().trigger(Event.CLOSED).remove(); - } + Alert.prototype._destroyElement = function _destroyElement(element) { + $(element).detach().trigger(Event.CLOSED).remove(); + }; - // static + // static - }], [{ - key: '_jQueryInterface', - value: function _jQueryInterface(config) { - return this.each(function () { - var $element = $(this); - var data = $element.data(DATA_KEY); + Alert._jQueryInterface = function _jQueryInterface(config) { + return this.each(function () { + var $element = $(this); + var data = $element.data(DATA_KEY); - if (!data) { - data = new Alert(this); - $element.data(DATA_KEY, data); - } + if (!data) { + data = new Alert(this); + $element.data(DATA_KEY, data); + } - if (config === 'close') { - data[config](this); - } - }); - } - }, { - key: '_handleDismiss', - value: function _handleDismiss(alertInstance) { - return function (event) { - if (event) { - event.preventDefault(); - } - - alertInstance.close(this); - }; - } - }, { + if (config === 'close') { + data[config](this); + } + }); + }; + + Alert._handleDismiss = function _handleDismiss(alertInstance) { + return function (event) { + if (event) { + event.preventDefault(); + } + + alertInstance.close(this); + }; + }; + + _createClass(Alert, null, [{ key: 'VERSION', get: function get() { return VERSION; @@ -170,7 +151,13 @@ var Alert = (function ($) { }]); return Alert; - })(); + }(); + + /** + * ------------------------------------------------------------------------ + * Data Api implementation + * ------------------------------------------------------------------------ + */ $(document).on(Event.CLICK_DATA_API, Selector.DISMISS, Alert._handleDismiss(new Alert())); @@ -188,5 +175,5 @@ var Alert = (function ($) { }; return Alert; -})(jQuery); +}(jQuery); //# sourceMappingURL=alert.js.map |