This repository has been archived on 2020-05-08. You can view files and clone it, but cannot push or open issues or pull requests.
understrap/js/theme.min.js

3 lines
70 KiB
JavaScript
Raw Normal View History

2017-04-21 12:08:39 +00:00
if(function(t,e){"function"==typeof define&&define.amd?define(e):"object"==typeof exports?module.exports=e(require,exports,module):t.Tether=e()}(this,function(t,e,i){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t){var e=t.getBoundingClientRect(),i={};for(var n in e)i[n]=e[n];if(t.ownerDocument!==document){var r=t.ownerDocument.defaultView.frameElement;if(r){var s=o(r);i.top+=s.top,i.bottom+=s.top,i.left+=s.left,i.right+=s.left}}return i}function r(t){var e=getComputedStyle(t)||{},i=e.position,n=[];if("fixed"===i)return[t];for(var o=t;(o=o.parentNode)&&o&&1===o.nodeType;){var r=void 0;try{r=getComputedStyle(o)}catch(t){}if(void 0===r||null===r)return n.push(o),n;var s=r,a=s.overflow,l=s.overflowX;/(auto|scroll)/.test(a+s.overflowY+l)&&("absolute"!==i||["relative","absolute","fixed"].indexOf(r.position)>=0)&&n.push(o)}return n.push(t.ownerDocument.body),t.ownerDocument!==document&&n.push(t.ownerDocument.defaultView),n}function s(){O&&document.body.removeChild(O),O=null}function a(t){var e=void 0;t===document?(e=document,t=document.documentElement):e=t.ownerDocument;var i=e.documentElement,n=o(t),r=w();return n.top-=r.top,n.left-=r.left,void 0===n.width&&(n.width=document.body.scrollWidth-n.left-n.right),void 0===n.height&&(n.height=document.body.scrollHeight-n.top-n.bottom),n.top=n.top-i.clientTop,n.left=n.left-i.clientLeft,n.right=e.body.clientWidth-n.width-n.left,n.bottom=e.body.clientHeight-n.height-n.top,n}function l(t){return t.offsetParent||document.documentElement}function h(){if(D)return D;var t=document.createElement("div");t.style.width="100%",t.style.height="200px";var e=document.createElement("div");f(e.style,{position:"absolute",top:0,left:0,pointerEvents:"none",visibility:"hidden",width:"200px",height:"150px",overflow:"hidden"}),e.appendChild(t),document.body.appendChild(e);var i=t.offsetWidth;e.style.overflow="scroll";var n=t.offsetWidth;i===n&&(n=e.clientWidth),document.body.removeChild(e);var o=i-n;return D={width:o,height:o}}function f(){var t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],e=[];return Array.prototype.push.apply(e,arguments),e.slice(1).forEach(function(e){if(e)for(var i in e)({}).hasOwnProperty.call(e,i)&&(t[i]=e[i])}),t}function c(t,e){if(void 0!==t.classList)e.split(" ").forEach(function(e){e.trim()&&t.classList.remove(e)});else{var i=new RegExp("(^| )"+e.split(" ").join("|")+"( |$)","gi"),n=p(t).replace(i," ");g(t,n)}}function d(t,e){if(void 0!==t.classList)e.split(" ").forEach(function(e){e.trim()&&t.classList.add(e)});else{c(t,e);var i=p(t)+" "+e;g(t,i)}}function u(t,e){if(void 0!==t.classList)return t.classList.contains(e);var i=p(t);return new RegExp("(^| )"+e+"( |$)","gi").test(i)}function p(t){return t.className instanceof t.ownerDocument.defaultView.SVGAnimatedString?t.className.baseVal:t.className}function g(t,e){t.setAttribute("class",e)}function m(t,e,i){i.forEach(function(i){-1===e.indexOf(i)&&u(t,i)&&c(t,i)}),e.forEach(function(e){u(t,e)||d(t,e)})}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function v(t,e){var i=arguments.length<=2||void 0===arguments[2]?1:arguments[2];return t+i>=e&&e>=t-i}function E(){return"undefined"!=typeof performance&&void 0!==performance.now?performance.now():+new Date}function y(){for(var t={top:0,left:0},e=arguments.length,i=Array(e),n=0;n<e;n++)i[n]=arguments[n];return i.forEach(function(e){var i=e.top,n=e.left;"string"==typeof i&&(i=parseFloat(i,10)),"string"==typeof n&&(n=parseFloat(n,10)),t.top+=i,t.left+=n}),t}function T(t,e){return"string"==typeof t.left&&-1!==t.left.indexOf("%")&&(t.left=parseFloat(t.left,10)/100*e.width),"string"==typeof t.top&&-1!==t.top.indexOf("%")&&(t.top=parseFloat(t.top,10)/1
if(this._isSliding)throw new Error("Carousel is sliding");this._slide(c.PREVIOUS)},l.prototype.pause=function(e){e||(this._isPaused=!0),t(this._element).find(p.NEXT_PREV)[0]&&r.supportsTransitionEnd()&&(r.triggerTransitionEnd(this._element),this.cycle(!0)),clearInterval(this._interval),this._interval=null},l.prototype.cycle=function(t){t||(this._isPaused=!1),this._interval&&(clearInterval(this._interval),this._interval=null),this._config.interval&&!this._isPaused&&(this._interval=setInterval((document.visibilityState?this.nextWhenVisible:this.next).bind(this),this._config.interval))},l.prototype.to=function(e){var i=this;this._activeElement=t(this._element).find(p.ACTIVE_ITEM)[0];var n=this._getItemIndex(this._activeElement);if(!(e>this._items.length-1||e<0)){if(this._isSliding)return void t(this._element).one(d.SLID,function(){return i.to(e)});if(n===e)return this.pause(),void this.cycle();var o=e>n?c.NEXT:c.PREVIOUS;this._slide(o,this._items[e])}},l.prototype.dispose=function(){t(this._element).off(a),t.removeData(this._element,s),this._items=null,this._config=null,this._element=null,this._interval=null,this._isPaused=null,this._isSliding=null,this._activeElement=null,this._indicatorsElement=null},l.prototype._getConfig=function(i){return i=t.extend({},h,i),r.typeCheckConfig(e,i,f),i},l.prototype._addEventListeners=function(){var e=this;this._config.keyboard&&t(this._element).on(d.KEYDOWN,function(t){return e._keydown(t)}),"hover"!==this._config.pause||"ontouchstart"in document.documentElement||t(this._element).on(d.MOUSEENTER,function(t){return e.pause(t)}).on(d.MOUSELEAVE,function(t){return e.cycle(t)})},l.prototype._keydown=function(t){if(!/input|textarea/i.test(t.target.tagName))switch(t.which){case 37:t.preventDefault(),this.prev();break;case 39:t.preventDefault(),this.next();break;default:return}},l.prototype._getItemIndex=function(e){return this._items=t.makeArray(t(e).parent().find(p.ITEM)),this._items.indexOf(e)},l.prototype._getItemByDirection=function(t,e){var i=t===c.NEXT,n=t===c.PREVIOUS,o=this._getItemIndex(e),r=this._items.length-1;if((n&&0===o||i&&o===r)&&!this._config.wrap)return e;var s=t===c.PREVIOUS?-1:1,a=(o+s)%this._items.length;return-1===a?this._items[this._items.length-1]:this._items[a]},l.prototype._triggerSlideEvent=function(e,i){var n=t.Event(d.SLIDE,{relatedTarget:e,direction:i});return t(this._element).trigger(n),n},l.prototype._setActiveIndicatorElement=function(e){if(this._indicatorsElement){t(this._indicatorsElement).find(p.ACTIVE).removeClass(u.ACTIVE);var i=this._indicatorsElement.children[this._getItemIndex(e)];i&&t(i).addClass(u.ACTIVE)}},l.prototype._slide=function(e,i){var n=this,o=t(this._element).find(p.ACTIVE_ITEM)[0],s=i||o&&this._getItemByDirection(e,o),a=Boolean(this._interval),l=void 0,h=void 0,f=void 0;if(e===c.NEXT?(l=u.LEFT,h=u.NEXT,f=c.LEFT):(l=u.RIGHT,h=u.PREV,f=c.RIGHT),s&&t(s).hasClass(u.ACTIVE))return void(this._isSliding=!1);if(!this._triggerSlideEvent(s,f).isDefaultPrevented()&&o&&s){this._isSliding=!0,a&&this.pause(),this._setActiveIndicatorElement(s);var g=t.Event(d.SLID,{relatedTarget:s,direction:f});r.supportsTransitionEnd()&&t(this._element).hasClass(u.SLIDE)?(t(s).addClass(h),r.reflow(s),t(o).addClass(l),t(s).addClass(l),t(o).one(r.TRANSITION_END,function(){t(s).removeClass(l+" "+h).addClass(u.ACTIVE),t(o).removeClass(u.ACTIVE+" "+h+" "+l),n._isSliding=!1,setTimeout(function(){return t(n._element).trigger(g)},0)}).emulateTransitionEnd(600)):(t(o).removeClass(u.ACTIVE),t(s).addClass(u.ACTIVE),this._isSliding=!1,t(this._element).trigger(g)),a&&this.cycle()}},l._jQueryInterface=function(e){return this.each(function(){var i=t(this).data(s),o=t.extend({},h,t(this).data());"object"===(void 0===e?"undefined":n(e))&&t.extend(o,e);var r="string"==typeof e?e:o.slide;if(i||(i=new l(this,o),t(this).data(s,i)),"number"==typeof e)i.to(e);else if("string"==typeof r){if(void 0===i[r])throw new Error('No method named "'+r+'"');i[r]()}else o.interval&&(i.pause(),i.cycle())})},l._dataApiClickHandler=function(e){var i=r.getSelectorFromElement(this);if(i){var n=t(i)[0];if(n&&t(
;if(this._isTransitioning)throw new Error("Tooltip is transitioning");var s=function(){i._hoverState!==c.SHOW&&n.parentNode&&n.parentNode.removeChild(n),i.element.removeAttribute("aria-describedby"),t(i.element).trigger(i.constructor.Event.HIDDEN),i._isTransitioning=!1,i.cleanupTether(),e&&e()};t(this.element).trigger(o),o.isDefaultPrevented()||(t(n).removeClass(u.SHOW),this._activeTrigger[m.CLICK]=!1,this._activeTrigger[m.FOCUS]=!1,this._activeTrigger[m.HOVER]=!1,r.supportsTransitionEnd()&&t(this.tip).hasClass(u.FADE)?(this._isTransitioning=!0,t(n).one(r.TRANSITION_END,s).emulateTransitionEnd(150)):s(),this._hoverState="")},a.prototype.isWithContent=function(){return Boolean(this.getTitle())},a.prototype.getTipElement=function(){return this.tip=this.tip||t(this.config.template)[0]},a.prototype.setContent=function(){var e=t(this.getTipElement());this.setElementContent(e.find(p.TOOLTIP_INNER),this.getTitle()),e.removeClass(u.FADE+" "+u.SHOW),this.cleanupTether()},a.prototype.setElementContent=function(e,i){var o=this.config.html;"object"===(void 0===i?"undefined":n(i))&&(i.nodeType||i.jquery)?o?t(i).parent().is(e)||e.empty().append(i):e.text(t(i).text()):e[o?"html":"text"](i)},a.prototype.getTitle=function(){var t=this.element.getAttribute("data-original-title");return t||(t="function"==typeof this.config.title?this.config.title.call(this.element):this.config.title),t},a.prototype.cleanupTether=function(){this._tether&&this._tether.destroy()},a.prototype._getAttachment=function(t){return f[t.toUpperCase()]},a.prototype._setListeners=function(){var e=this;this.config.trigger.split(" ").forEach(function(i){if("click"===i)t(e.element).on(e.constructor.Event.CLICK,e.config.selector,function(t){return e.toggle(t)});else if(i!==m.MANUAL){var n=i===m.HOVER?e.constructor.Event.MOUSEENTER:e.constructor.Event.FOCUSIN,o=i===m.HOVER?e.constructor.Event.MOUSELEAVE:e.constructor.Event.FOCUSOUT;t(e.element).on(n,e.config.selector,function(t){return e._enter(t)}).on(o,e.config.selector,function(t){return e._leave(t)})}t(e.element).closest(".modal").on("hide.bs.modal",function(){return e.hide()})}),this.config.selector?this.config=t.extend({},this.config,{trigger:"manual",selector:""}):this._fixTitle()},a.prototype._fixTitle=function(){var t=n(this.element.getAttribute("data-original-title"));(this.element.getAttribute("title")||"string"!==t)&&(this.element.setAttribute("data-original-title",this.element.getAttribute("title")||""),this.element.setAttribute("title",""))},a.prototype._enter=function(e,i){var n=this.constructor.DATA_KEY;return i=i||t(e.currentTarget).data(n),i||(i=new this.constructor(e.currentTarget,this._getDelegateConfig()),t(e.currentTarget).data(n,i)),e&&(i._activeTrigger["focusin"===e.type?m.FOCUS:m.HOVER]=!0),t(i.getTipElement()).hasClass(u.SHOW)||i._hoverState===c.SHOW?void(i._hoverState=c.SHOW):(clearTimeout(i._timeout),i._hoverState=c.SHOW,i.config.delay&&i.config.delay.show?void(i._timeout=setTimeout(function(){i._hoverState===c.SHOW&&i.show()},i.config.delay.show)):void i.show())},a.prototype._leave=function(e,i){var n=this.constructor.DATA_KEY;if(i=i||t(e.currentTarget).data(n),i||(i=new this.constructor(e.currentTarget,this._getDelegateConfig()),t(e.currentTarget).data(n,i)),e&&(i._activeTrigger["focusout"===e.type?m.FOCUS:m.HOVER]=!1),!i._isWithActiveTrigger()){if(clearTimeout(i._timeout),i._hoverState=c.OUT,!i.config.delay||!i.config.delay.hide)return void i.hide();i._timeout=setTimeout(function(){i._hoverState===c.OUT&&i.hide()},i.config.delay.hide)}},a.prototype._isWithActiveTrigger=function(){for(var t in this._activeTrigger)if(this._activeTrigger[t])return!0;return!1},a.prototype._getConfig=function(i){return i=t.extend({},this.constructor.Default,t(this.element).data(),i),i.delay&&"number"==typeof i.delay&&(i.delay={show:i.delay,hide:i.delay}),r.typeCheckConfig(e,i,this.constructor.DefaultType),i},a.prototype._getDelegateConfig=function(){var t={};if(this.config)for(var e in this.config)this.constructor.Default[e]!==this.config[e]&&(t[e]=this.config[e]);return t},a._jQueryInterface=function(e){return th