0
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-03-02 02:29:24 +01:00
Bootstrap/dist/js/bootstrap.min.js

7 lines
41 KiB
JavaScript
Raw Normal View History

/*!
2015-01-19 14:55:25 -08:00
* Bootstrap v4.0.0-alpha (http://getbootstrap.com)
2015-01-01 12:02:02 -08:00
* Copyright 2011-2015 Twitter, Inc.
2013-12-18 15:08:16 -08:00
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
2013-10-03 10:42:55 -07:00
*/
2015-05-13 12:48:34 -07:00
if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");+function(a){var b=a.fn.jquery.split(" ")[0].split(".");if(b[0]<2&&b[1]<9||1==b[0]&&9==b[1]&&b[2]<1)throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher")}(jQuery),+function(){"use strict";function a(a,b){if("function"!=typeof b&&null!==b)throw new TypeError("Super expression must either be null or a function, not "+typeof b);a.prototype=Object.create(b&&b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}),b&&(a.__proto__=b)}function b(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}{var c=function(){function a(a,b){for(var c=0;c<b.length;c++){var d=b[c];d.enumerable=d.enumerable||!1,d.configurable=!0,"value"in d&&(d.writable=!0),Object.defineProperty(a,d.key,d)}}return function(b,c,d){return c&&a(b.prototype,c),d&&a(b,d),b}}(),d=function(a){function b(){return{bindType:f.end,delegateType:f.end,handle:function(b){return a(b.target).is(this)?b.handleObj.handler.apply(this,arguments):void 0}}}function c(){if(window.QUnit)return!1;var a=document.createElement("bootstrap");for(var b in g)if(void 0!==a.style[b])return{end:g[b]};return!1}function d(b){var c=this,d=!1;return a(this).one(h.TRANSITION_END,function(){d=!0}),setTimeout(function(){d||h.triggerTransitionEnd(c)},b),this}function e(){f=c(),a.fn.emulateTransitionEnd=d,h.supportsTransitionEnd()&&(a.event.special[h.TRANSITION_END]=b())}var f=!1,g={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"},h={TRANSITION_END:"bsTransitionEnd",getUID:function(a){do a+=~~(1e6*Math.random());while(document.getElementById(a));return a},getSelectorFromElement:function(a){var b=a.getAttribute("data-target");return b||(b=a.getAttribute("href")||"",b=/^#[a-z]/i.test(b)?b:null),b},reflow:function(a){new Function("bs","return bs")(a.offsetHeight)},triggerTransitionEnd:function(b){a(b).trigger(f.end)},supportsTransitionEnd:function(){return!!f}};return e(),h}(jQuery),e=(function(a){var e="alert",f="4.0.0",g="bs.alert",h="."+g,i=".data-api",j=a.fn[e],k=150,l={DISMISS:'[data-dismiss="alert"]'},m={CLOSE:"close"+h,CLOSED:"closed"+h,CLICK_DATA_API:"click"+h+i},n={ALERT:"alert",FADE:"fade",IN:"in"},o=function(){function e(a){b(this,e),this._element=a}return c(e,[{key:"close",value:function(a){a=a||this._element;var b=this._getRootElement(a),c=this._triggerCloseEvent(b);c.isDefaultPrevented()||this._removeElement(b)}},{key:"dispose",value:function(){a.removeData(this._element,g),this._element=null}},{key:"_getRootElement",value:function(b){var c=!1,e=d.getSelectorFromElement(b);return e&&(c=a(e)[0]),c||(c=a(b).closest("."+n.ALERT)[0]),c}},{key:"_triggerCloseEvent",value:function(b){var c=a.Event(m.CLOSE);return a(b).trigger(c),c}},{key:"_removeElement",value:function(b){return a(b).removeClass(n.IN),d.supportsTransitionEnd()&&a(b).hasClass(n.FADE)?void a(b).one(d.TRANSITION_END,this._destroyElement.bind(this,b)).emulateTransitionEnd(k):void this._destroyElement(b)}},{key:"_destroyElement",value:function(b){a(b).detach().trigger(m.CLOSED).remove()}}],[{key:"VERSION",get:function(){return f}},{key:"_jQueryInterface",value:function(b){return this.each(function(){var c=a(this),d=c.data(g);d||(d=new e(this),c.data(g,d)),"close"===b&&d[b](this)})}},{key:"_handleDismiss",value:function(a){return function(b){b&&b.preventDefault(),a.close(this)}}}]),e}();return a(document).on(m.CLICK_DATA_API,l.DISMISS,o._handleDismiss(new o)),a.fn[e]=o._jQueryInterface,a.fn[e].Constructor=o,a.fn[e].noConflict=function(){return a.fn[e]=j,o._jQueryInterface},o}(jQuery),function(a){var d="button",e="4.0.0",f="bs.button",g="."+f,h=".data-api",i=a.fn[d],j={ACTIVE:"active",BUTTON:"btn",FOCUS:"focus"},k={DATA_TOGGLE_CARROT:'[data-toggle^="button"]',DATA_TOGGLE:'[data-toggle="buttons"]',INPUT:"input",ACTIVE:".active",BUTTON:".btn"},l={CLICK_DATA_API:"click"+g+h,FOCUS_BLUR_DATA_API:"focus"+g+h+" "+("blur"+g+h)},m=function(){function d(a){b(this,d),this._element=a}return
trigger:"hover focus",title:"",delay:0,html:!1,selector:!1,placement:"top",offset:"0 0",constraints:null},m={TOP:"bottom center",RIGHT:"middle left",BOTTOM:"top center",LEFT:"middle right"},n={IN:"in",OUT:"out"},o={HIDE:"hide"+h,HIDDEN:"hidden"+h,SHOW:"show"+h,SHOWN:"shown"+h,INSERTED:"inserted"+h,CLICK:"click"+h,FOCUSIN:"focusin"+h,FOCUSOUT:"focusout"+h,MOUSEENTER:"mouseenter"+h,MOUSELEAVE:"mouseleave"+h},p={FADE:"fade",IN:"in"},q={TOOLTIP:".tooltip",TOOLTIP_INNER:".tooltip-inner"},r={element:!1,enabled:!1},s={HOVER:"hover",FOCUS:"focus",CLICK:"click",MANUAL:"manual"},t=function(){function i(a,c){b(this,i),this._isEnabled=!0,this._timeout=0,this._hoverState="",this._activeTrigger={},this._tether=null,this.element=a,this.config=this._getConfig(c),this.tip=null,this._setListeners()}return c(i,[{key:"enable",value:function(){this._isEnabled=!0}},{key:"disable",value:function(){this._isEnabled=!1}},{key:"toggleEnabled",value:function(){this._isEnabled=!this._isEnabled}},{key:"toggle",value:function(b){var c=this,d=this.constructor.DATA_KEY;b?(c=a(b.currentTarget).data(d),c||(c=new this.constructor(b.currentTarget,this._getDelegateConfig()),a(b.currentTarget).data(d,c)),c._activeTrigger.click=!c._activeTrigger.click,c._isWithActiveTrigger()?c._enter(null,c):c._leave(null,c)):a(c.getTipElement()).hasClass(p.IN)?c._leave(null,c):c._enter(null,c)}},{key:"dispose",value:function(){clearTimeout(this._timeout),this.cleanupTether(),a.removeData(this.element,this.constructor.DATA_KEY),a(this.element).off(this.constructor.EVENT_KEY),this.tip&&a(this.tip).remove(),this._isEnabled=null,this._timeout=null,this._hoverState=null,this._activeTrigger=null,this._tether=null,this.element=null,this.config=null,this.tip=null}},{key:"show",value:function(){var b=this,c=a.Event(this.constructor.Event.SHOW);if(this.isWithContent()&&this._isEnabled){a(this.element).trigger(c);var e=a.contains(this.element.ownerDocument.documentElement,this.element);if(c.isDefaultPrevented()||!e)return;var f=this.getTipElement(),g=d.getUID(this.constructor.NAME);f.setAttribute("id",g),this.element.setAttribute("aria-describedby",g),this.setContent(),this.config.animation&&a(f).addClass(p.FADE);var h="function"==typeof this.config.placement?this.config.placement.call(this,f,this.element):this.config.placement,j=this._getAttachment(h);a(f).data(this.constructor.DATA_KEY,this).appendTo(document.body),a(this.element).trigger(this.constructor.Event.INSERTED),this._tether=new Tether({element:f,target:this.element,attachment:j,classes:r,classPrefix:k,offset:this.config.offset,constraints:this.config.constraints}),d.reflow(f),this._tether.position(),a(f).addClass(p.IN);var l=function(){var c=b._hoverState;b._hoverState=null,a(b.element).trigger(b.constructor.Event.SHOWN),c===n.OUT&&b._leave(null,b)};d.supportsTransitionEnd()&&a(this.tip).hasClass(p.FADE)?a(this.tip).one(d.TRANSITION_END,l).emulateTransitionEnd(i._TRANSITION_DURATION):l()}}},{key:"hide",value:function(b){var c=this,e=this.getTipElement(),f=a.Event(this.constructor.Event.HIDE),g=function(){c._hoverState!==n.IN&&e.parentNode&&e.parentNode.removeChild(e),c.element.removeAttribute("aria-describedby"),a(c.element).trigger(c.constructor.Event.HIDDEN),c.cleanupTether(),b&&b()};a(this.element).trigger(f),f.isDefaultPrevented()||(a(e).removeClass(p.IN),d.supportsTransitionEnd()&&a(this.tip).hasClass(p.FADE)?a(e).one(d.TRANSITION_END,g).emulateTransitionEnd(j):g(),this._hoverState="")}},{key:"isWithContent",value:function(){return!!this.getTitle()}},{key:"getTipElement",value:function(){return this.tip=this.tip||a(this.config.template)[0]}},{key:"setContent",value:function(){var b=this.getTipElement(),c=this.getTitle(),d=this.config.html?"innerHTML":"innerText";a(b).find(q.TOOLTIP_INNER)[0][d]=c,a(b).removeClass(p.FADE).removeClass(p.IN),this.cleanupTether()}},{key:"getTitle",value:function(){var a=this.element.getAttribute("data-original-title");return a||(a="function"==typeof this.config.title?this.config.title.call(this.element):this.config.title),a}},{key:"cleanupTether",value:function(){this._tether&&(this._teth