diff options
author | fat <fat@folders.local> | 2015-05-08 02:34:28 +0300 |
---|---|---|
committer | fat <fat@folders.local> | 2015-05-08 02:34:28 +0300 |
commit | c3a79b1a8c2fa8d7fc8edcd3e626dad8b45d5dc3 (patch) | |
tree | 06a02f216b801efdba5d920da89b2cad47fd2408 /js | |
parent | 0724bd91ff81b5eca0addce0c336c72b3ec10be5 (diff) |
change the export pattern to protect against leaking globals
Diffstat (limited to 'js')
-rw-r--r-- | js/dist/alert.js | 270 | ||||
-rw-r--r-- | js/dist/alert.js.map | 2 | ||||
-rw-r--r-- | js/dist/util.js | 167 | ||||
-rw-r--r-- | js/dist/util.js.map | 2 | ||||
-rw-r--r-- | js/script-compiled.js | 305 | ||||
-rw-r--r-- | js/src/alert.js | 238 | ||||
-rw-r--r-- | js/src/util.js | 166 |
7 files changed, 738 insertions, 412 deletions
diff --git a/js/dist/alert.js b/js/dist/alert.js index 0dbfe767b7..76b280a0c3 100644 --- a/js/dist/alert.js +++ b/js/dist/alert.js @@ -6,165 +6,171 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons /** * -------------------------------------------------------------------------- - * Constants - * -------------------------------------------------------------------------- - */ - -var NAME = 'alert'; -var VERSION = '4.0.0'; -var DATA_KEY = 'bs.alert'; -var JQUERY_NO_CONFLICT = $.fn[NAME]; -var TRANSITION_DURATION = 150; - -var Selector = { - DISMISS: '[data-dismiss="alert"]' -}; - -var Event = { - CLOSE: 'close.bs.alert', - CLOSED: 'closed.bs.alert', - CLICK: 'click.bs.alert.data-api' -}; - -var ClassName = { - ALERT: 'alert', - FADE: 'fade', - IN: 'in' -}; - -/** - * -------------------------------------------------------------------------- - * Class Definition + * Bootstrap (v4.0.0): alert.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) * -------------------------------------------------------------------------- */ var Alert = (function () { - function Alert(element) { - _classCallCheck(this, Alert); - if (element) { - this.element = element; + /** + * ------------------------------------------------------------------------ + * Constants + * ------------------------------------------------------------------------ + */ + + var NAME = 'alert'; + var VERSION = '4.0.0'; + var DATA_KEY = 'bs.alert'; + var JQUERY_NO_CONFLICT = $.fn[NAME]; + var TRANSITION_DURATION = 150; + + var Selector = { + DISMISS: '[data-dismiss="alert"]' + }; + + var Event = { + CLOSE: 'close.bs.alert', + CLOSED: 'closed.bs.alert', + CLICK: 'click.bs.alert.data-api' + }; + + var ClassName = { + ALERT: 'alert', + FADE: 'fade', + IN: 'in' + }; + + /** + * ------------------------------------------------------------------------ + * Class Definition + * ------------------------------------------------------------------------ + */ + + var Alert = (function () { + function Alert(element) { + _classCallCheck(this, Alert); + + if (element) { + this.element = element; + } } - } - _createClass(Alert, [{ - key: 'close', + _createClass(Alert, [{ + key: 'close', + + // public - // public + value: function close(element) { + var rootElement = this._getRootElement(element); + var customEvent = this._triggerCloseEvent(rootElement); - value: function close(element) { - var rootElement = this._getRootElement(element); - var customEvent = this._triggerCloseEvent(rootElement); + if (customEvent.isDefaultPrevented()) { + return; + } - if (customEvent.isDefaultPrevented()) { - return; + this._removeElement(rootElement); } + }, { + key: '_getRootElement', - this._removeElement(rootElement); - } - }, { - key: '_getRootElement', + // private - // private + value: function _getRootElement(element) { + var parent = false; + var selector = Util.getSelectorFromElement(element); - value: function _getRootElement(element) { - var parent = false; - var selector = Util.getSelectorFromElement(element); + if (selector) { + parent = $(selector)[0]; + } - if (selector) { - parent = $(selector)[0]; - } + if (!parent) { + parent = $(element).closest('.' + ClassName.ALERT)[0]; + } - if (!parent) { - parent = $(element).closest('.' + ClassName.ALERT)[0]; + return parent; + } + }, { + 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; + } - return parent; - } - }, { - 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, this._destroyElement.bind(this, element)).emulateTransitionEnd(TRANSITION_DURATION); + } + }, { + key: '_destroyElement', + value: function _destroyElement(element) { + $(element).detach().trigger(Event.CLOSED).remove(); } + }], [{ + key: '_jQueryInterface', - $(element).one(Util.TRANSITION_END, this._destroyElement.bind(this, element)).emulateTransitionEnd(TRANSITION_DURATION); - } - }, { - key: '_destroyElement', - value: function _destroyElement(element) { - $(element).detach().trigger(Event.CLOSED).remove(); - } - }], [{ - key: '_jQueryInterface', + // static - // static + value: function _jQueryInterface(config) { + return this.each(function () { + var $element = $(this); + var data = $element.data(DATA_KEY); - value: 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); - } - }); - } - }, { - key: '_handleDismiss', - value: function _handleDismiss(alertInstance) { - return function (event) { - if (event) { - event.preventDefault(); - } + return Alert; + })(); - alertInstance.close(this); - }; - } - }]); + /** + * ------------------------------------------------------------------------ + * Data Api implementation + * ------------------------------------------------------------------------ + */ - return Alert; -})(); + $(document).on(Event.CLICK, Selector.DISMISS, Alert._handleDismiss(new Alert())); -/** - * -------------------------------------------------------------------------- - * Data Api implementation - * -------------------------------------------------------------------------- - */ + /** + * ------------------------------------------------------------------------ + * jQuery + * ------------------------------------------------------------------------ + */ -$(document).on(Event.CLICK, Selector.DISMISS, Alert._handleDismiss(new Alert())); + $.fn[NAME] = Alert._jQueryInterface; + $.fn[NAME].Constructor = Alert; + $.fn[NAME].noConflict = function () { + $.fn[NAME] = Alert._JQUERY_NO_CONFLICT; + return Alert._jQueryInterface; + }; -/** - * -------------------------------------------------------------------------- - * jQuery - * -------------------------------------------------------------------------- - */ - -$.fn[NAME] = Alert._jQueryInterface; -$.fn[NAME].Constructor = Alert; -$.fn[NAME].noConflict = function () { - $.fn[NAME] = Alert._JQUERY_NO_CONFLICT; - return Alert._jQueryInterface; -}; -/** - * -------------------------------------------------------------------------- - * Bootstrap (v4.0.0): alert.js - * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) - * -------------------------------------------------------------------------- - */ + return Alert; +})(); //# sourceMappingURL=alert.js.map
\ No newline at end of file diff --git a/js/dist/alert.js.map b/js/dist/alert.js.map index d2d9be6b6d..f3bc7ad7fc 100644 --- a/js/dist/alert.js.map +++ b/js/dist/alert.js.map @@ -1 +1 @@ -{"version":3,"sources":["js/src/alert.js"],"names":[],"mappings":";;;;;;;;;;;;AAgBA,IAAM,IAAI,GAAkB,OAAO,CAAA;AACnC,IAAM,OAAO,GAAe,OAAO,CAAA;AACnC,IAAM,QAAQ,GAAc,UAAU,CAAA;AACtC,IAAM,kBAAkB,GAAI,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAA;AACtC,IAAM,mBAAmB,GAAG,GAAG,CAAA;;AAE/B,IAAM,QAAQ,GAAG;AACf,SAAO,EAAG,wBAAwB;CACnC,CAAA;;AAED,IAAM,KAAK,GAAG;AACZ,OAAK,EAAI,gBAAgB;AACzB,QAAM,EAAG,iBAAiB;AAC1B,OAAK,EAAI,yBAAyB;CACnC,CAAA;;AAED,IAAM,SAAS,GAAG;AAChB,OAAK,EAAG,OAAO;AACf,MAAI,EAAI,MAAM;AACd,IAAE,EAAM,IAAI;CACb,CAAA;;;;;;;;IASY,KAAK;AAEL,WAFA,KAAK,CAEJ,OAAO,EAAE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IAAI,KAAK,EAAE,CAAC,CAClC,CAAA;;;;;;;;AASD,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAe,KAAK,CAAC,gBAAgB,CAAA;AAC/C,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,WAAW,GAAG,KAAK,CAAA;AAC9B,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,UAAU,GAAI,YAAY;AACnC,GAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,mBAAmB,CAAA;AACtC,SAAO,KAAK,CAAC,gBAAgB,CAAA;CAC9B,CAAA","file":"js/src/alert.js","sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v4.0.0): alert.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport Util from 'util'\n\n\n/**\n * --------------------------------------------------------------------------\n * Constants\n * --------------------------------------------------------------------------\n */\n\nconst NAME = 'alert'\nconst VERSION = '4.0.0'\nconst DATA_KEY = 'bs.alert'\nconst JQUERY_NO_CONFLICT = $.fn[NAME]\nconst TRANSITION_DURATION = 150\n\nconst Selector = {\n DISMISS : '[data-dismiss=\"alert\"]'\n}\n\nconst Event = {\n CLOSE : 'close.bs.alert',\n CLOSED : 'closed.bs.alert',\n CLICK : 'click.bs.alert.data-api'\n}\n\nconst ClassName = {\n ALERT : 'alert',\n FADE : 'fade',\n IN : 'in'\n}\n\n\n/**\n * --------------------------------------------------------------------------\n * Class Definition\n * --------------------------------------------------------------------------\n */\n\nexport class Alert {\n\n constructor(element) {\n if (element) {\n this.element = element\n }\n }\n\n\n // public\n\n close(element) {\n let rootElement = this._getRootElement(element)\n let customEvent = this._triggerCloseEvent(rootElement)\n\n if (customEvent.isDefaultPrevented()) {\n return\n }\n\n this._removeElement(rootElement)\n }\n\n\n // private\n\n _getRootElement(element) {\n let parent = false\n let selector = Util.getSelectorFromElement(element)\n\n if (selector) {\n parent = $(selector)[0]\n }\n\n if (!parent) {\n parent = $(element).closest('.' + ClassName.ALERT)[0]\n }\n\n return parent\n }\n\n _triggerCloseEvent(element) {\n var closeEvent = $.Event(Event.CLOSE)\n $(element).trigger(closeEvent)\n return closeEvent\n }\n\n _removeElement(element) {\n $(element).removeClass(ClassName.IN)\n\n if (!Util.supportsTransitionEnd() || !$(element).hasClass(ClassName.FADE)) {\n this._destroyElement(element)\n return\n }\n\n $(element)\n .one(Util.TRANSITION_END, this._destroyElement.bind(this, element))\n .emulateTransitionEnd(TRANSITION_DURATION)\n }\n\n _destroyElement(element) {\n $(element)\n .detach()\n .trigger(Event.CLOSED)\n .remove()\n }\n\n\n // static\n\n static _jQueryInterface(config) {\n return this.each(function () {\n let $element = $(this)\n let data = $element.data(DATA_KEY)\n\n if (!data) {\n data = new Alert(this)\n $element.data(DATA_KEY, data)\n }\n\n if (config === 'close') {\n data[config](this)\n }\n })\n }\n\n static _handleDismiss(alertInstance) {\n return function (event) {\n if (event) {\n event.preventDefault()\n }\n\n alertInstance.close(this)\n }\n }\n\n}\n\n\n/**\n * --------------------------------------------------------------------------\n * Data Api implementation\n * --------------------------------------------------------------------------\n */\n\n$(document).on(\n Event.CLICK,\n Selector.DISMISS,\n Alert._handleDismiss(new Alert())\n)\n\n\n/**\n * --------------------------------------------------------------------------\n * jQuery\n * --------------------------------------------------------------------------\n */\n\n$.fn[NAME] = Alert._jQueryInterface\n$.fn[NAME].Constructor = Alert\n$.fn[NAME].noConflict = function () {\n $.fn[NAME] = Alert._JQUERY_NO_CONFLICT\n return Alert._jQueryInterface\n}\n"]}
\ No newline at end of file +{"version":3,"sources":["js/src/alert.js"],"names":[],"mappings":";;;;;;;;;;;;;AAUA,IAAM,KAAK,GAAG,CAAC,YAAM;;;;;;;;AASnB,MAAM,IAAI,GAAkB,OAAO,CAAA;AACnC,MAAM,OAAO,GAAe,OAAO,CAAA;AACnC,MAAM,QAAQ,GAAc,UAAU,CAAA;AACtC,MAAM,kBAAkB,GAAI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AAO,EAAE;AACtB,gBAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAA;WACnB;SACF,CAAC,CAAA;OACH;;;aAEoB,wBAAC,aAAa,EAAE;AACnC,eAAO,UAAU,KAAK,EAAE;AACtB,cAAI,KAAK,EAAE;AACT,iBAAK,CAAC,cAAc,EAAE,CAAA;WACvB;;AAED,uBAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;SAC1B,CAAA;OACF;;;WA9FG,KAAK;;;;;;;;;AAyGX,GAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,CACZ,KAAK,CAAC,KAAK,EACX,QAAQ,CAAC,OAAO,EAChB,KAAK,CAAC,cAAc,CAAC,IAAI,KAAK,EAAE,CAAC,CAClC,CAAA;;;;;;;;AASD,GAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAe,KAAK,CAAC,gBAAgB,CAAA;AAC/C,GAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,WAAW,GAAG,KAAK,CAAA;AAC9B,GAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,UAAU,GAAI,YAAY;AACnC,KAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,mBAAmB,CAAA;AACtC,WAAO,KAAK,CAAC,gBAAgB,CAAA;GAC9B,CAAA;;AAED,SAAO,KAAK,CAAA;CAEb,CAAA,EAAG,CAAA","file":"js/src/alert.js","sourcesContent":["import Util from './util'\n\n\n/**\n * --------------------------------------------------------------------------\n * Bootstrap (v4.0.0): alert.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nconst Alert = (() => {\n\n\n /**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\n const NAME = 'alert'\n const VERSION = '4.0.0'\n const DATA_KEY = 'bs.alert'\n const JQUERY_NO_CONFLICT = $.fn[NAME]\n const TRANSITION_DURATION = 150\n\n const Selector = {\n DISMISS : '[data-dismiss=\"alert\"]'\n }\n\n const Event = {\n CLOSE : 'close.bs.alert',\n CLOSED : 'closed.bs.alert',\n CLICK : 'click.bs.alert.data-api'\n }\n\n const ClassName = {\n ALERT : 'alert',\n FADE : 'fade',\n IN : 'in'\n }\n\n\n /**\n * ------------------------------------------------------------------------\n * Class Definition\n * ------------------------------------------------------------------------\n */\n\n class Alert {\n\n constructor(element) {\n if (element) {\n this.element = element\n }\n }\n\n\n // public\n\n close(element) {\n let rootElement = this._getRootElement(element)\n let customEvent = this._triggerCloseEvent(rootElement)\n\n if (customEvent.isDefaultPrevented()) {\n return\n }\n\n this._removeElement(rootElement)\n }\n\n\n // private\n\n _getRootElement(element) {\n let parent = false\n let selector = Util.getSelectorFromElement(element)\n\n if (selector) {\n parent = $(selector)[0]\n }\n\n if (!parent) {\n parent = $(element).closest('.' + ClassName.ALERT)[0]\n }\n\n return parent\n }\n\n _triggerCloseEvent(element) {\n var closeEvent = $.Event(Event.CLOSE)\n $(element).trigger(closeEvent)\n return closeEvent\n }\n\n _removeElement(element) {\n $(element).removeClass(ClassName.IN)\n\n if (!Util.supportsTransitionEnd() ||\n !$(element).hasClass(ClassName.FADE)) {\n this._destroyElement(element)\n return\n }\n\n $(element)\n .one(Util.TRANSITION_END, this._destroyElement.bind(this, element))\n .emulateTransitionEnd(TRANSITION_DURATION)\n }\n\n _destroyElement(element) {\n $(element)\n .detach()\n .trigger(Event.CLOSED)\n .remove()\n }\n\n\n // static\n\n static _jQueryInterface(config) {\n return this.each(function () {\n let $element = $(this)\n let data = $element.data(DATA_KEY)\n\n if (!data) {\n data = new Alert(this)\n $element.data(DATA_KEY, data)\n }\n\n if (config === 'close') {\n data[config](this)\n }\n })\n }\n\n static _handleDismiss(alertInstance) {\n return function (event) {\n if (event) {\n event.preventDefault()\n }\n\n alertInstance.close(this)\n }\n }\n\n }\n\n\n /**\n * ------------------------------------------------------------------------\n * Data Api implementation\n * ------------------------------------------------------------------------\n */\n\n $(document).on(\n Event.CLICK,\n Selector.DISMISS,\n Alert._handleDismiss(new Alert())\n )\n\n\n /**\n * ------------------------------------------------------------------------\n * jQuery\n * ------------------------------------------------------------------------\n */\n\n $.fn[NAME] = Alert._jQueryInterface\n $.fn[NAME].Constructor = Alert\n $.fn[NAME].noConflict = function () {\n $.fn[NAME] = Alert._JQUERY_NO_CONFLICT\n return Alert._jQueryInterface\n }\n\n return Alert\n\n})()\n\nexport default Alert\n"]}
\ No newline at end of file diff --git a/js/dist/util.js b/js/dist/util.js index 48865c5d76..4c8c4e6392 100644 --- a/js/dist/util.js +++ b/js/dist/util.js @@ -5,120 +5,119 @@ * -------------------------------------------------------------------------- */ -/** - * ------------------------------------------------------------------------ - * Public Util Api - * ------------------------------------------------------------------------ - */ - 'use strict'; -var Util = { +var Util = (function () { - TRANSITION_END: 'bsTransitionEnd', + /** + * ------------------------------------------------------------------------ + * Private TransitionEnd Helpers + * ------------------------------------------------------------------------ + */ - getUID: function getUID(prefix) { - do prefix += ~ ~(Math.random() * 1000000); while (document.getElementById(prefix)); - return prefix; - }, + var transition = false; - getSelectorFromElement: function getSelectorFromElement(element) { - var selector = element.getAttribute('data-target'); + var TransitionEndEvent = { + WebkitTransition: 'webkitTransitionEnd', + MozTransition: 'transitionend', + OTransition: 'oTransitionEnd otransitionend', + transition: 'transitionend' + }; + + function getSpecialTransitionEndEvent() { + return { + bindType: transition.end, + delegateType: transition.end, + handle: function handle(event) { + if ($(event.target).is(this)) { + return event.handleObj.handler.apply(this, arguments); + } + } + }; + } - if (!selector) { - selector = element.getAttribute('href') || ''; - selector = /^#[a-z]/i.test(selector) ? selector : null; + function transitionEndTest() { + if (window.QUnit) { + return false; } - return selector; - }, + var el = document.createElement('bootstrap'); - reflow: function reflow(element) { - new Function('bs', 'return bs')(element.offsetHeight); - }, + for (var name in TransitionEndEvent) { + if (el.style[name] !== undefined) { + return { end: TransitionEndEvent[name] }; + } + } - supportsTransitionEnd: function supportsTransitionEnd() { - return !!transition; + return false; } -}; + function transitionEndEmulator(duration) { + var _this = this; -/** - * ------------------------------------------------------------------------ - * Private TransitionEnd Helpers - * ------------------------------------------------------------------------ - */ + var called = false; + + $(this).one(Util.TRANSITION_END, function () { + called = true; + }); -var transition = false; - -var TransitionEndEvent = { - WebkitTransition: 'webkitTransitionEnd', - MozTransition: 'transitionend', - OTransition: 'oTransitionEnd otransitionend', - transition: 'transitionend' -}; - -function getSpecialTransitionEndEvent() { - return { - bindType: transition.end, - delegateType: transition.end, - handle: function handle(event) { - if ($(event.target).is(this)) { - return event.handleObj.handler.apply(this, arguments); + setTimeout(function () { + if (!called) { + $(_this).trigger(transition.end); } - } - }; -} + }, duration); -function transitionEndTest() { - if (window.QUnit) { - return false; + return this; } - var el = document.createElement('bootstrap'); + function setTransitionEndSupport() { + transition = transitionEndTest(); - for (var name in TransitionEndEvent) { - if (el.style[name] !== undefined) { - return { end: TransitionEndEvent[name] }; + $.fn.emulateTransitionEnd = transitionEndEmulator; + + if (Util.supportsTransitionEnd()) { + $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent(); } } - return false; -} + /** + * -------------------------------------------------------------------------- + * Public Util Api + * -------------------------------------------------------------------------- + */ -function transitionEndEmulator(duration) { - var _this = this; + var Util = { - var called = false; + TRANSITION_END: 'bsTransitionEnd', - $(this).one(Util.TRANSITION_END, function () { - called = true; - }); + getUID: function getUID(prefix) { + do prefix += ~ ~(Math.random() * 1000000); while (document.getElementById(prefix)); + return prefix; + }, - setTimeout(function () { - if (!called) { - $(_this).trigger(transition.end); - } - }, duration); + getSelectorFromElement: function getSelectorFromElement(element) { + var selector = element.getAttribute('data-target'); + + if (!selector) { + selector = element.getAttribute('href') || ''; + selector = /^#[a-z]/i.test(selector) ? selector : null; + } - return this; -} + return selector; + }, -function setTransitionEndSupport() { - transition = transitionEndTest(); + reflow: function reflow(element) { + new Function('bs', 'return bs')(element.offsetHeight); + }, - $.fn.emulateTransitionEnd = transitionEndEmulator; + supportsTransitionEnd: function supportsTransitionEnd() { + return !!transition; + } - if (Util.supportsTransitionEnd()) { - $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent(); - } -} + }; -setTransitionEndSupport(); + setTransitionEndSupport(); -/** - * ------------------------------------------------------------------------ - * Export Api - * ------------------------------------------------------------------------ - */ + return Util; +})(); //# sourceMappingURL=util.js.map
\ No newline at end of file diff --git a/js/dist/util.js.map b/js/dist/util.js.map index 5de0badbd7..71ad2163a1 100644 --- a/js/dist/util.js.map +++ b/js/dist/util.js.map @@ -1 +1 @@ -{"version":3,"sources":["js/src/util.js"],"names":[],"mappings":";;;;;;;;;;;;;;;AAcA,IAAI,IAAI,GAAG;;AAET,gBAAc,EAAE,iBAAiB;;AAEjC,QAAM,EAAA,gBAAC,MAAM,EAAE;AACb,OAAG,MAAM,IAAI,EAAC,EAAE,IAAI,CAAC,MAAM,EAAE,GAAG,OAAO,CAAA,AAAC,CAAA,QACjC,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,EAAC;AACvC,WAAO,MAAM,CAAA;GACd;;AAED,wBAAsB,EAAA,gCAAC,OAAO,EAAE;AAC9B,QAAI,QAAQ,GAAG,OAAO,CAAC,YAAY,CAAC,aAAa,CAAC,CAAA;;AAElD,QAAI,CAAC,QAAQ,EAAE;AACb,cAAQ,GAAG,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,EAAE,CAAA;AAC7C,cAAQ,GAAG,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,QAAQ,GAAG,IAAI,CAAA;KACvD;;AAED,WAAO,QAAQ,CAAA;GAChB;;AAED,QAAM,EAAA,gBAAC,OAAO,EAAE;AACd,QAAI,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAA;GACtD;;AAED,uBAAqB,EAAA,iCAAG;AACtB,WAAO,CAAC,CAAC,UAAU,CAAA;GACpB;;CAEF,CAAA;;;;;;;;AASD,IAAI,UAAU,GAAG,KAAK,CAAA;;AAEtB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;;AAEZ,SAAO,IAAI,CAAA;CACZ;;AAED,SAAS,uBAAuB,GAAG;AACjC,YAAU,GAAG,iBAAiB,EAAE,CAAA;;AAEhC,GAAC,CAAC,EAAE,CAAC,oBAAoB,GAAG,qBAAqB,CAAA;;AAEjD,MAAI,IAAI,CAAC,qBAAqB,EAAE,EAAE;AAChC,KAAC,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,GAAG,4BAA4B,EAAE,CAAA;GACtE;CACF;;AAED,uBAAuB,EAAE,CAAA","file":"js/src/util.js","sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v4.0.0): util.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * --------------------------------------------------------------------------\n */\n\n\n/**\n * ------------------------------------------------------------------------\n * Public Util Api\n * ------------------------------------------------------------------------\n */\n\nvar Util = {\n\n TRANSITION_END: 'bsTransitionEnd',\n\n getUID(prefix) {\n do prefix += ~~(Math.random() * 1000000)\n while (document.getElementById(prefix))\n return prefix\n },\n\n getSelectorFromElement(element) {\n let selector = element.getAttribute('data-target')\n\n if (!selector) {\n selector = element.getAttribute('href') || ''\n selector = /^#[a-z]/i.test(selector) ? selector : null\n }\n\n return selector\n },\n\n reflow(element) {\n new Function('bs', 'return bs')(element.offsetHeight)\n },\n\n supportsTransitionEnd() {\n return !!transition\n }\n\n}\n\n\n/**\n * ------------------------------------------------------------------------\n * Private TransitionEnd Helpers\n * ------------------------------------------------------------------------\n */\n\nlet transition = false\n\nconst TransitionEndEvent = {\n WebkitTransition : 'webkitTransitionEnd',\n MozTransition : 'transitionend',\n OTransition : 'oTransitionEnd otransitionend',\n transition : 'transitionend'\n}\n\nfunction getSpecialTransitionEndEvent() {\n return {\n bindType: transition.end,\n delegateType: transition.end,\n handle: function (event) {\n if ($(event.target).is(this)) {\n return event.handleObj.handler.apply(this, arguments)\n }\n }\n }\n}\n\nfunction transitionEndTest() {\n if (window.QUnit) {\n return false\n }\n\n let el = document.createElement('bootstrap')\n\n for (var name in TransitionEndEvent) {\n if (el.style[name] !== undefined) {\n return { end: TransitionEndEvent[name] }\n }\n }\n\n return false\n}\n\nfunction transitionEndEmulator(duration) {\n let called = false\n\n $(this).one(Util.TRANSITION_END, function () {\n called = true\n })\n\n setTimeout(() => {\n if (!called) {\n $(this).trigger(transition.end)\n }\n }, duration)\n\n return this\n}\n\nfunction setTransitionEndSupport() {\n transition = transitionEndTest()\n\n $.fn.emulateTransitionEnd = transitionEndEmulator\n\n if (Util.supportsTransitionEnd()) {\n $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent()\n }\n}\n\nsetTransitionEndSupport()\n\n\n/**\n * ------------------------------------------------------------------------\n * Export Api\n * ------------------------------------------------------------------------\n */\n\nexport default Util\n"]}
\ No newline at end of file +{"version":3,"sources":["js/src/util.js"],"names":[],"mappings":";;;;;;;;;AAOA,IAAM,IAAI,GAAG,CAAC,YAAM;;;;;;;;AASlB,MAAI,UAAU,GAAG,KAAK,CAAA;;AAEtB,MAAM,kBAAkB,GAAG;AACzB,oBAAgB,EAAG,qBAAqB;AACxC,iBAAa,EAAM,eAAe;AAClC,eAAW,EAAQ,+BAA+B;AAClD,cAAU,EAAS,eAAe;GACnC,CAAA;;AAED,WAAS,4BAA4B,GAAG;AACtC,WAAO;AACL,cAAQ,EAAE,UAAU,CAAC,GAAG;AACxB,kBAAY,EAAE,UAAU,CAAC,GAAG;AAC5B,YAAM,EAAE,gBAAU,KAAK,EAAE;AACvB,YAAI,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE;AAC5B,iBAAO,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,CAAA;SACtD;OACF;KACF,CAAA;GACF;;AAED,WAAS,iBAAiB,GAAG;AAC3B,QAAI,MAAM,CAAC,KAAK,EAAE;AAChB,aAAO,KAAK,CAAA;KACb;;AAED,Q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EAAA,gCAAC,OAAO,EAAE;AAC9B,UAAI,QAAQ,GAAG,OAAO,CAAC,YAAY,CAAC,aAAa,CAAC,CAAA;;AAElD,UAAI,CAAC,QAAQ,EAAE;AACb,gBAAQ,GAAG,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,IAAI,EAAE,CAAA;AAC7C,gBAAQ,GAAG,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,QAAQ,GAAG,IAAI,CAAA;OACvD;;AAED,aAAO,QAAQ,CAAA;KAChB;;AAED,UAAM,EAAA,gBAAC,OAAO,EAAE;AACd,UAAI,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAA;KACtD;;AAED,yBAAqB,EAAA,iCAAG;AACtB,aAAO,CAAC,CAAC,UAAU,CAAA;KACpB;;GAEF,CAAA;;AAED,yBAAuB,EAAE,CAAA;;AAEzB,SAAO,IAAI,CAAA;CAEZ,CAAA,EAAG,CAAA","file":"js/src/util.js","sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v4.0.0): util.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nconst Util = (() => {\n\n\n /**\n * ------------------------------------------------------------------------\n * Private TransitionEnd Helpers\n * ------------------------------------------------------------------------\n */\n\n let transition = false\n\n const TransitionEndEvent = {\n WebkitTransition : 'webkitTransitionEnd',\n MozTransition : 'transitionend',\n OTransition : 'oTransitionEnd otransitionend',\n transition : 'transitionend'\n }\n\n function getSpecialTransitionEndEvent() {\n return {\n bindType: transition.end,\n delegateType: transition.end,\n handle: function (event) {\n if ($(event.target).is(this)) {\n return event.handleObj.handler.apply(this, arguments)\n }\n }\n }\n }\n\n function transitionEndTest() {\n if (window.QUnit) {\n return false\n }\n\n let el = document.createElement('bootstrap')\n\n for (var name in TransitionEndEvent) {\n if (el.style[name] !== undefined) {\n return { end: TransitionEndEvent[name] }\n }\n }\n\n return false\n }\n\n function transitionEndEmulator(duration) {\n let called = false\n\n $(this).one(Util.TRANSITION_END, function () {\n called = true\n })\n\n setTimeout(() => {\n if (!called) {\n $(this).trigger(transition.end)\n }\n }, duration)\n\n return this\n }\n\n function setTransitionEndSupport() {\n transition = transitionEndTest()\n\n $.fn.emulateTransitionEnd = transitionEndEmulator\n\n if (Util.supportsTransitionEnd()) {\n $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent()\n }\n }\n\n\n /**\n * --------------------------------------------------------------------------\n * Public Util Api\n * --------------------------------------------------------------------------\n */\n\n let Util = {\n\n TRANSITION_END: 'bsTransitionEnd',\n\n getUID(prefix) {\n do prefix += ~~(Math.random() * 1000000)\n while (document.getElementById(prefix))\n return prefix\n },\n\n getSelectorFromElement(element) {\n let selector = element.getAttribute('data-target')\n\n if (!selector) {\n selector = element.getAttribute('href') || ''\n selector = /^#[a-z]/i.test(selector) ? selector : null\n }\n\n return selector\n },\n\n reflow(element) {\n new Function('bs', 'return bs')(element.offsetHeight)\n },\n\n supportsTransitionEnd() {\n return !!transition\n }\n\n }\n\n setTransitionEndSupport()\n\n return Util\n\n})()\n\nexport default Util\n"]}
\ No newline at end of file diff --git a/js/script-compiled.js b/js/script-compiled.js new file mode 100644 index 0000000000..2a50eb3b3c --- /dev/null +++ b/js/script-compiled.js @@ -0,0 +1,305 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); + +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 _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } + +/** + * -------------------------------------------------------------------------- + * Bootstrap (v4.0.0): alert.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * -------------------------------------------------------------------------- + */ + +var _util = require('util'); + +var _util2 = _interopRequireDefault(_util); + +/** + * -------------------------------------------------------------------------- + * Constants + * -------------------------------------------------------------------------- + */ + +var NAME = 'alert'; +var VERSION = '4.0.0'; +var DATA_KEY = 'bs.alert'; +var JQUERY_NO_CONFLICT = $.fn[NAME]; +var TRANSITION_DURATION = 150; + +var Selector = { + DISMISS: '[data-dismiss="alert"]' +}; + +var Event = { + CLOSE: 'close.bs.alert', + CLOSED: 'closed.bs.alert', + CLICK: 'click.bs.alert.data-api' +}; + +var ClassName = { + ALERT: 'alert', + FADE: 'fade', + IN: 'in' +}; + +/** + * -------------------------------------------------------------------------- + * Class Definition + * -------------------------------------------------------------------------- + */ + +var Alert = (function () { + function Alert(element) { + _classCallCheck(this, Alert); + + if (element) { + this.element = element; + } + } + + _createClass(Alert, [{ + key: 'close', + + // public + + value: function close(element) { + var rootElement = this._getRootElement(element); + var customEvent = this._triggerCloseEvent(rootElement); + + if (customEvent.isDefaultPrevented()) { + return; + } + + this._removeElement(rootElement); + } + }, { + key: '_getRootElement', + + // private + + value: function _getRootElement(element) { + var parent = false; + var selector = _util2['default'].getSelectorFromElement(element); + + if (selector) { + parent = $(selector)[0]; + } + + if (!parent) { + parent = $(element).closest('.' + ClassName.ALERT)[0]; + } + + return parent; + } + }, { + 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 (!_util2['default'].supportsTransitionEnd() || !$(element).hasClass(ClassName.FADE)) { + this._destroyElement(element); + return; + } + + $(element).one(_util2['default'].TRANSITION_END, this._destroyElement.bind(this, element)).emulateTransitionEnd(TRANSITION_DURATION); + } + }, { + key: '_destroyElement', + value: function _destroyElement(element) { + $(element).detach().trigger(Event.CLOSED).remove(); + } + }], [{ + key: '_jQueryInterface', + + // static + + value: 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 (config === 'close') { + data[config](this); + } + }); + } + }, { + key: '_handleDismiss', + value: function _handleDismiss(alertInstance) { + return function (event) { + if (event) { + event.preventDefault(); + } + + alertInstance.close(this); + }; + } + }]); + + return Alert; +})(); + +exports.Alert = Alert; + +/** + * -------------------------------------------------------------------------- + * Data Api implementation + * -------------------------------------------------------------------------- + */ + +$(document).on(Event.CLICK, Selector.DISMISS, Alert._handleDismiss(new Alert())); + +/** + * -------------------------------------------------------------------------- + * jQuery + * -------------------------------------------------------------------------- + */ + +$.fn[NAME] = Alert._jQueryInterface; +$.fn[NAME].Constructor = Alert; +$.fn[NAME].noConflict = function () { + $.fn[NAME] = Alert._JQUERY_NO_CONFLICT; + return Alert._jQueryInterface; +}; +'use strict'; + +Object.defineProperty(exports, '__esModule', { + value: true +}); +/** + * -------------------------------------------------------------------------- + * Bootstrap (v4.0.0): util.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) + * -------------------------------------------------------------------------- + */ + +/** + * -------------------------------------------------------------------------- + * Public Util Api + * -------------------------------------------------------------------------- + */ + +var Util = { + + TRANSITION_END: 'bsTransitionEnd', + + getUID: function getUID(prefix) { + do prefix += ~ ~(Math.random() * 1000000); while (document.getElementById(prefix)); + return prefix; + }, + + getSelectorFromElement: function getSelectorFromElement(element) { + var selector = element.getAttribute('data-target'); + + if (!selector) { + selector = element.getAttribute('href') || ''; + selector = /^#[a-z]/i.test(selector) ? selector : null; + } + + return selector; + }, + + reflow: function reflow(element) { + new Function('bs', 'return bs')(element.offsetHeight); + }, + + supportsTransitionEnd: function supportsTransitionEnd() { + return !!transition; + } + +}; + +exports['default'] = Util; + +/** + * -------------------------------------------------------------------------- + * Private TransitionEnd Helpers + * -------------------------------------------------------------------------- + */ + +var transition = false; + +var TransitionEndEvent = { + WebkitTransition: 'webkitTransitionEnd', + MozTransition: 'transitionend', + OTransition: 'oTransitionEnd otransitionend', + transition: 'transitionend' +}; + +function getSpecialTransitionEndEvent() { + return { + bindType: transition.end, + delegateType: transition.end, + handle: function handle(event) { + if ($(event.target).is(this)) { + return event.handleObj.handler.apply(this, arguments); + } + } + }; +} + +function transitionEndTest() { + if (window.QUnit) { + return false; + } + + var el = document.createElement('bootstrap'); + + for (var name in TransitionEndEvent) { + if (el.style[name] !== undefined) { + return { end: TransitionEndEvent[name] }; + } + } + + return false; +} + +function transitionEndEmulator(duration) { + var _this = this; + + var called = false; + + $(this).one(Util.TRANSITION_END, function () { + called = true; + }); + + setTimeout(function () { + if (!called) { + $(_this).trigger(transition.end); + } + }, duration); + + return this; +} + +function setTransitionEndSupport() { + transition = transitionEndTest(); + + $.fn.emulateTransitionEnd = transitionEndEmulator; + + if (Util.supportsTransitionEnd()) { + $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent(); + } +} + +setTransitionEndSupport(); +module.exports = exports['default']; diff --git a/js/src/alert.js b/js/src/alert.js index bd12b1a559..d69ad8910d 100644 --- a/js/src/alert.js +++ b/js/src/alert.js @@ -1,3 +1,6 @@ +import Util from './util' + + /** * -------------------------------------------------------------------------- * Bootstrap (v4.0.0): alert.js @@ -5,164 +8,171 @@ * -------------------------------------------------------------------------- */ -import Util from 'util' +const Alert = (() => { -/** - * -------------------------------------------------------------------------- - * Constants - * -------------------------------------------------------------------------- - */ + /** + * ------------------------------------------------------------------------ + * Constants + * ------------------------------------------------------------------------ + */ -const NAME = 'alert' -const VERSION = '4.0.0' -const DATA_KEY = 'bs.alert' -const JQUERY_NO_CONFLICT = $.fn[NAME] -const TRANSITION_DURATION = 150 + const NAME = 'alert' + const VERSION = '4.0.0' + const DATA_KEY = 'bs.alert' + const JQUERY_NO_CONFLICT = $.fn[NAME] + const TRANSITION_DURATION = 150 -const Selector = { - DISMISS : '[data-dismiss="alert"]' -} + const Selector = { + DISMISS : '[data-dismiss="alert"]' + } -const Event = { - CLOSE : 'close.bs.alert', - CLOSED : 'closed.bs.alert', - CLICK : 'click.bs.alert.data-api' -} + const Event = { + CLOSE : 'close.bs.alert', + CLOSED : 'closed.bs.alert', + CLICK : 'click.bs.alert.data-api' + } -const ClassName = { - ALERT : 'alert', - FADE : 'fade', - IN : 'in' -} + const ClassName = { + ALERT : 'alert', + FADE : 'fade', + IN : 'in' + } -/** - * -------------------------------------------------------------------------- - * Class Definition - * -------------------------------------------------------------------------- - */ + /** + * ------------------------------------------------------------------------ + * Class Definition + * ------------------------------------------------------------------------ + */ -export class Alert { + class Alert { - constructor(element) { - if (element) { - this.element = element + constructor(element) { + if (element) { + this.element = element + } } - } - // public + // public + + close(element) { + let rootElement = this._getRootElement(element) + let customEvent = this._triggerCloseEvent(rootElement) - close(element) { - let rootElement = this._getRootElement(element) - let customEvent = this._triggerCloseEvent(rootElement) + if (customEvent.isDefaultPrevented()) { + return + } - if (customEvent.isDefaultPrevented()) { - return + this._removeElement(rootElement) } - this._removeElement(rootElement) - } + // private - // private + _getRootElement(element) { + let parent = false + let selector = Util.getSelectorFromElement(element) - _getRootElement(element) { - let parent = false - let selector = Util.getSelectorFromElement(element) + if (selector) { + parent = $(selector)[0] + } - if (selector) { - parent = $(selector)[0] + if (!parent) { + parent = $(element).closest('.' + ClassName.ALERT)[0] + } + + return parent } - if (!parent) { - parent = $(element).closest('.' + ClassName.ALERT)[0] + _triggerCloseEvent(element) { + var closeEvent = $.Event(Event.CLOSE) + $(element).trigger(closeEvent) + return closeEvent } - return parent - } + _removeElement(element) { + $(element).removeClass(ClassName.IN) - _triggerCloseEvent(element) { - var closeEvent = $.Event(Event.CLOSE) - $(element).trigger(closeEvent) - return closeEvent - } + if (!Util.supportsTransitionEnd() || + !$(element).hasClass(ClassName.FADE)) { + this._destroyElement(element) + return + } - _removeElement(element) { - $(element).removeClass(ClassName.IN) + $(element) + .one(Util.TRANSITION_END, this._destroyElement.bind(this, element)) + .emulateTransitionEnd(TRANSITION_DURATION) + } - if (!Util.supportsTransitionEnd() || !$(element).hasClass(ClassName.FADE)) { - this._destroyElement(element) - return + _destroyElement(element) { + $(element) + .detach() + .trigger(Event.CLOSED) + .remove() } - $(element) - .one(Util.TRANSITION_END, this._destroyElement.bind(this, element)) - .emulateTransitionEnd(TRANSITION_DURATION) - } - _destroyElement(element) { - $(element) - .detach() - .trigger(Event.CLOSED) - .remove() - } + // static + static _jQueryInterface(config) { + return this.each(function () { + let $element = $(this) + let data = $element.data(DATA_KEY) - // static + if (!data) { + data = new Alert(this) + $element.data(DATA_KEY, data) + } - static _jQueryInterface(config) { - return this.each(function () { - let $element = $(this) - let data = $element.data(DATA_KEY) + if (config === 'close') { + data[config](this) + } + }) + } - if (!data) { - data = new Alert(this) - $element.data(DATA_KEY, data) - } + static _handleDismiss(alertInstance) { + return function (event) { + if (event) { + event.preventDefault() + } - if (config === 'close') { - data[config](this) + alertInstance.close(this) } - }) + } + } - static _handleDismiss(alertInstance) { - return function (event) { - if (event) { - event.preventDefault() - } - alertInstance.close(this) - } - } + /** + * ------------------------------------------------------------------------ + * Data Api implementation + * ------------------------------------------------------------------------ + */ -} + $(document).on( + Event.CLICK, + Selector.DISMISS, + Alert._handleDismiss(new Alert()) + ) -/** - * -------------------------------------------------------------------------- - * Data Api implementation - * -------------------------------------------------------------------------- - */ + /** + * ------------------------------------------------------------------------ + * jQuery + * ------------------------------------------------------------------------ + */ -$(document).on( - Event.CLICK, - Selector.DISMISS, - Alert._handleDismiss(new Alert()) -) + $.fn[NAME] = Alert._jQueryInterface + $.fn[NAME].Constructor = Alert + $.fn[NAME].noConflict = function () { + $.fn[NAME] = Alert._JQUERY_NO_CONFLICT + return Alert._jQueryInterface + } + return Alert -/** - * -------------------------------------------------------------------------- - * jQuery - * -------------------------------------------------------------------------- - */ +})() -$.fn[NAME] = Alert._jQueryInterface -$.fn[NAME].Constructor = Alert -$.fn[NAME].noConflict = function () { - $.fn[NAME] = Alert._JQUERY_NO_CONFLICT - return Alert._jQueryInterface -} +export default Alert diff --git a/js/src/util.js b/js/src/util.js index e9542149e6..68205edef1 100644 --- a/js/src/util.js +++ b/js/src/util.js @@ -5,114 +5,120 @@ * -------------------------------------------------------------------------- */ +const Util = (() => { -/** - * -------------------------------------------------------------------------- - * Public Util Api - * -------------------------------------------------------------------------- - */ -var Util = { + /** + * ------------------------------------------------------------------------ + * Private TransitionEnd Helpers + * ------------------------------------------------------------------------ + */ - TRANSITION_END: 'bsTransitionEnd', + let transition = false - getUID(prefix) { - do prefix += ~~(Math.random() * 1000000) - while (document.getElementById(prefix)) - return prefix - }, + const TransitionEndEvent = { + WebkitTransition : 'webkitTransitionEnd', + MozTransition : 'transitionend', + OTransition : 'oTransitionEnd otransitionend', + transition : 'transitionend' + } - getSelectorFromElement(element) { - let selector = element.getAttribute('data-target') + function getSpecialTransitionEndEvent() { + return { + bindType: transition.end, + delegateType: transition.end, + handle: function (event) { + if ($(event.target).is(this)) { + return event.handleObj.handler.apply(this, arguments) + } + } + } + } - if (!selector) { - selector = element.getAttribute('href') || '' - selector = /^#[a-z]/i.test(selector) ? selector : null + function transitionEndTest() { + if (window.QUnit) { + return false } - return selector - }, + let el = document.createElement('bootstrap') - reflow(element) { - new Function('bs', 'return bs')(element.offsetHeight) - }, + for (var name in TransitionEndEvent) { + if (el.style[name] !== undefined) { + return { end: TransitionEndEvent[name] } + } + } - supportsTransitionEnd() { - return !!transition + return false } -} - -export default Util - + function transitionEndEmulator(duration) { + let called = false -/** - * -------------------------------------------------------------------------- - * Private TransitionEnd Helpers - * -------------------------------------------------------------------------- - */ + $(this).one(Util.TRANSITION_END, function () { + called = true + }) -let transition = false - -const TransitionEndEvent = { - WebkitTransition : 'webkitTransitionEnd', - MozTransition : 'transitionend', - OTransition : 'oTransitionEnd otransitionend', - transition : 'transitionend' -} - -function getSpecialTransitionEndEvent() { - return { - bindType: transition.end, - delegateType: transition.end, - handle: function (event) { - if ($(event.target).is(this)) { - return event.handleObj.handler.apply(this, arguments) + setTimeout(() => { + if (!called) { + $(this).trigger(transition.end) } - } - } -} + }, duration) -function transitionEndTest() { - if (window.QUnit) { - return false + return this } - let el = document.createElement('bootstrap') + function setTransitionEndSupport() { + transition = transitionEndTest() + + $.fn.emulateTransitionEnd = transitionEndEmulator - for (var name in TransitionEndEvent) { - if (el.style[name] !== undefined) { - return { end: TransitionEndEvent[name] } + if (Util.supportsTransitionEnd()) { + $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent() } } - return false -} -function transitionEndEmulator(duration) { - let called = false + /** + * -------------------------------------------------------------------------- + * Public Util Api + * -------------------------------------------------------------------------- + */ - $(this).one(Util.TRANSITION_END, function () { - called = true - }) + let Util = { - setTimeout(() => { - if (!called) { - $(this).trigger(transition.end) - } - }, duration) + TRANSITION_END: 'bsTransitionEnd', + + getUID(prefix) { + do prefix += ~~(Math.random() * 1000000) + while (document.getElementById(prefix)) + return prefix + }, - return this -} + getSelectorFromElement(element) { + let selector = element.getAttribute('data-target') -function setTransitionEndSupport() { - transition = transitionEndTest() + if (!selector) { + selector = element.getAttribute('href') || '' + selector = /^#[a-z]/i.test(selector) ? selector : null + } + + return selector + }, - $.fn.emulateTransitionEnd = transitionEndEmulator + reflow(element) { + new Function('bs', 'return bs')(element.offsetHeight) + }, + + supportsTransitionEnd() { + return !!transition + } - if (Util.supportsTransitionEnd()) { - $.event.special[Util.TRANSITION_END] = getSpecialTransitionEndEvent() } -} -setTransitionEndSupport() + setTransitionEndSupport() + + return Util + +})() + +export default Util |