0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-12-01 13:24:25 +01:00
Bootstrap/js/dist/alert.js.map
2015-05-07 12:57:31 -07:00

1 line
6.5 KiB
Plaintext

{"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;0BAFV,KAAK;;AAGd,QAAI,OAAO,EAAE;AACX,UAAI,CAAC,OAAO,GAAG,OAAO,CAAA;KACvB;GACF;;eANU,KAAK;;;;;WAWX,eAAC,OAAO,EAAE;AACb,UAAI,WAAW,GAAG,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAA;AAC/C,UAAI,WAAW,GAAG,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAA;;AAEtD,UAAI,WAAW,CAAC,kBAAkB,EAAE,EAAE;AACpC,eAAM;OACP;;AAED,UAAI,CAAC,cAAc,CAAC,WAAW,CAAC,CAAA;KACjC;;;;;;WAKc,yBAAC,OAAO,EAAE;AACvB,UAAI,MAAM,GAAK,KAAK,CAAA;AACpB,UAAI,QAAQ,GAAG,IAAI,CAAC,sBAAsB,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,YAAI,QAAQ,GAAG,CAAC,CAAC,IAAI,CAAC,CAAA;AACtB,YAAI,IAAI,GAAO,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;;AAEtC,YAAI,CAAC,IAAI,EAAE;AACT,cAAI,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,CAAA;AACtB,kBAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;SAC9B;;AAED,YAAI,MAAM,KAAK,OAAO,EAAE;AACtB,cAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAA;SACnB;OACF,CAAC,CAAA;KACH;;;WAEoB,wBAAC,aAAa,EAAE;AACnC,aAAO,UAAU,KAAK,EAAE;AACtB,YAAI,KAAK,EAAE;AACT,eAAK,CAAC,cAAc,EAAE,CAAA;SACvB;;AAED,qBAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;OAC1B,CAAA;KACF;;;SA7FU,KAAK;;;;;;;;;AAwGlB,CAAC,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,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"]}