mirror of
https://github.com/mdbootstrap/mdb-ui-kit.git
synced 2024-11-29 13:04:14 +03:00
1 line
81 KiB
JavaScript
1 line
81 KiB
JavaScript
|
(function(){'use strict';var e=Math.max,t=function(e){function t(e){return{}.toString.call(e).match(/\s([a-zA-Z]+)/)[1].toLowerCase()}function n(e){return(e[0]||e).nodeType}function a(){return{bindType:l.end,delegateType:l.end,handle:function(t){return e(t.target).is(this)?t.handleObj.handler.apply(this,arguments):void 0}}}function o(){if(window.QUnit)return!1;var e=document.createElement('bootstrap');for(var t in i)if(void 0!==e.style[t])return{end:i[t]};return!1}function r(t){var n=this,a=!1;return e(this).one(s.TRANSITION_END,function(){a=!0}),setTimeout(function(){a||s.triggerTransitionEnd(n)},t),this}var l=!1,i={WebkitTransition:'webkitTransitionEnd',MozTransition:'transitionend',OTransition:'oTransitionEnd otransitionend',transition:'transitionend'},s={TRANSITION_END:'bsTransitionEnd',getUID:function(e){do e+=~~(1e6*Math.random());while(document.getElementById(e));return e},getSelectorFromElement:function(t){var n=t.getAttribute('data-target');n&&'#'!==n||(n=t.getAttribute('href')||'');try{var a=e(n);return 0<a.length?n:null}catch(e){return null}},reflow:function(e){return e.offsetHeight},triggerTransitionEnd:function(t){e(t).trigger(l.end)},supportsTransitionEnd:function(){return!!l},typeCheckConfig:function(e,a,o){for(var r in o)if(o.hasOwnProperty(r)){var l=o[r],i=a[r],s=i&&n(i)?'element':t(i);if(!new RegExp(l).test(s))throw new Error(e.toUpperCase()+': '+('Option "'+r+'" provided type "'+s+'" ')+('but expected type "'+l+'".'))}}};return function(){l=o(),e.fn.emulateTransitionEnd=r,s.supportsTransitionEnd()&&(e.event.special[s.TRANSITION_END]=a())}(),s}(jQuery),n='function'==typeof Symbol&&'symbol'==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&'function'==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?'symbol':typeof e},a=function(e,t){if(!(e instanceof t))throw new TypeError('Cannot call a class as a function')},o=function(){function e(e,t){for(var n,a=0;a<t.length;a++)n=t[a],n.enumerable=n.enumerable||!1,n.configurable=!0,'value'in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}return function(t,n,a){return n&&e(t.prototype,n),a&&e(t,a),t}}(),r=function e(t,n,a){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,n);if(void 0===o){var r=Object.getPrototypeOf(t);return null===r?void 0:e(r,n,a)}if('value'in o)return o.value;var l=o.get;return void 0===l?void 0:l.call(a)},l=function(e,t){if('function'!=typeof t&&null!==t)throw new TypeError('Super expression must either be null or a function, not '+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)},i=function(e,t){if(!e)throw new ReferenceError('this hasn\'t been initialised - super() hasn\'t been called');return t&&('object'==typeof t||'function'==typeof t)?t:e},s=function(e){var n='alert',r='bs.alert',l='.'+r,i=e.fn[n],s={CLOSE:'close'+l,CLOSED:'closed'+l,CLICK_DATA_API:'click'+l+'.data-api'},d={ALERT:'alert',FADE:'fade',SHOW:'show'},c=function(){function n(e){a(this,n),this._element=e}return o(n,[{key:'close',value:function(e){e=e||this._element;var t=this._getRootElement(e),n=this._triggerCloseEvent(t);n.isDefaultPrevented()||this._removeElement(t)}},{key:'dispose',value:function(){e.removeData(this._element,r),this._element=null}},{key:'_getRootElement',value:function(n){var a=t.getSelectorFromElement(n),o=!1;return a&&(o=e(a)[0]),o||(o=e(n).closest('.'+d.ALERT)[0]),o}},{key:'_triggerCloseEvent',value:function(t){var n=e.Event(s.CLOSE);return e(t).trigger(n),n}},{key:'_removeElement',value:function(n){var a=this;return e(n).removeClass(d.SHOW),t.supportsTransitionEnd()&&e(n).hasClass(d.FADE)?void e(n).one(t.TRANSITION_END,function(e){return a._destroyElement(n,e)}).emulateTransitionEnd(150):void this._destroyElement(n)}},{key:'_destroyElement',value:function(t){e(t).detach().trigger(s.CLOSED).remove()}}],[{key:'_jQueryInterface',value:function(t){return this.each(function(){var a=e(this),o=a.data(r);o||(o=new n(this),a.data(r,o)),'close'===t&&o[t](this)})}}
|