Files
PyRIGS/RIGS/static/js/collapse.js
2020-10-09 09:25:23 +01:00

6 lines
6.0 KiB
JavaScript

/*!
* Bootstrap collapse.js v4.5.2 (https://getbootstrap.com/)
* Copyright 2011-2020 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("jquery"),require("./util.js")):"function"==typeof define&&define.amd?define(["jquery","./util.js"],t):(e="undefined"!=typeof globalThis?globalThis:e||self).Collapse=t(e.jQuery,e.Util)}(this,(function(e,t){"use strict";function n(){return(n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var l in n)Object.prototype.hasOwnProperty.call(n,l)&&(e[l]=n[l])}return e}).apply(this,arguments)}function l(e,t){for(var n=0;n<t.length;n++){var l=t[n];l.enumerable=l.enumerable||!1,l.configurable=!0,"value"in l&&(l.writable=!0),Object.defineProperty(e,l.key,l)}}e=e&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e,t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t;var i="collapse",r="bs.collapse",s=e.fn[i],a={toggle:!0,parent:""},o={toggle:"boolean",parent:"(string|element)"},c=function(){function s(e,n){this._isTransitioning=!1,this._element=e,this._config=this._getConfig(n),this._triggerArray=[].slice.call(document.querySelectorAll('[data-toggle="collapse"][href="#'+e.id+'"],[data-toggle="collapse"][data-target="#'+e.id+'"]'));for(var l=[].slice.call(document.querySelectorAll('[data-toggle="collapse"]')),i=0,r=l.length;i<r;i++){var s=l[i],a=t.getSelectorFromElement(s),o=[].slice.call(document.querySelectorAll(a)).filter((function(t){return t===e}));null!==a&&o.length>0&&(this._selector=a,this._triggerArray.push(s))}this._parent=this._config.parent?this._getParent():null,this._config.parent||this._addAriaAndCollapsedClass(this._element,this._triggerArray),this._config.toggle&&this.toggle()}var c,g,h,u=s.prototype;return u.toggle=function(){e(this._element).hasClass("show")?this.hide():this.show()},u.show=function(){var n,l,i=this;if(!this._isTransitioning&&!e(this._element).hasClass("show")&&(this._parent&&0===(n=[].slice.call(this._parent.querySelectorAll(".show, .collapsing")).filter((function(e){return"string"==typeof i._config.parent?e.getAttribute("data-parent")===i._config.parent:e.classList.contains("collapse")}))).length&&(n=null),!(n&&(l=e(n).not(this._selector).data(r))&&l._isTransitioning))){var a=e.Event("show.bs.collapse");if(e(this._element).trigger(a),!a.isDefaultPrevented()){n&&(s._jQueryInterface.call(e(n).not(this._selector),"hide"),l||e(n).data(r,null));var o=this._getDimension();e(this._element).removeClass("collapse").addClass("collapsing"),this._element.style[o]=0,this._triggerArray.length&&e(this._triggerArray).removeClass("collapsed").attr("aria-expanded",!0),this.setTransitioning(!0);var c="scroll"+(o[0].toUpperCase()+o.slice(1)),g=t.getTransitionDurationFromElement(this._element);e(this._element).one(t.TRANSITION_END,(function(){e(i._element).removeClass("collapsing").addClass("collapse show"),i._element.style[o]="",i.setTransitioning(!1),e(i._element).trigger("shown.bs.collapse")})).emulateTransitionEnd(g),this._element.style[o]=this._element[c]+"px"}}},u.hide=function(){var n=this;if(!this._isTransitioning&&e(this._element).hasClass("show")){var l=e.Event("hide.bs.collapse");if(e(this._element).trigger(l),!l.isDefaultPrevented()){var i=this._getDimension();this._element.style[i]=this._element.getBoundingClientRect()[i]+"px",t.reflow(this._element),e(this._element).addClass("collapsing").removeClass("collapse show");var r=this._triggerArray.length;if(r>0)for(var s=0;s<r;s++){var a=this._triggerArray[s],o=t.getSelectorFromElement(a);if(null!==o)e([].slice.call(document.querySelectorAll(o))).hasClass("show")||e(a).addClass("collapsed").attr("aria-expanded",!1)}this.setTransitioning(!0);this._element.style[i]="";var c=t.getTransitionDurationFromElement(this._element);e(this._element).one(t.TRANSITION_END,(function(){n.setTransitioning(!1),e(n._element).removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")})).emulateTransitionEnd(c)}}},u.setTransitioning=function(e){this._isTransitioning=e},u.dispose=function(){e.removeData(this._element,r),this._config=null,this._parent=null,this._element=null,this._triggerArray=null,this._isTransitioning=null},u._getConfig=function(e){return(e=n({},a,e)).toggle=Boolean(e.toggle),t.typeCheckConfig(i,e,o),e},u._getDimension=function(){return e(this._element).hasClass("width")?"width":"height"},u._getParent=function(){var n,l=this;t.isElement(this._config.parent)?(n=this._config.parent,void 0!==this._config.parent.jquery&&(n=this._config.parent[0])):n=document.querySelector(this._config.parent);var i='[data-toggle="collapse"][data-parent="'+this._config.parent+'"]',r=[].slice.call(n.querySelectorAll(i));return e(r).each((function(e,t){l._addAriaAndCollapsedClass(s._getTargetFromElement(t),[t])})),n},u._addAriaAndCollapsedClass=function(t,n){var l=e(t).hasClass("show");n.length&&e(n).toggleClass("collapsed",!l).attr("aria-expanded",l)},s._getTargetFromElement=function(e){var n=t.getSelectorFromElement(e);return n?document.querySelector(n):null},s._jQueryInterface=function(t){return this.each((function(){var l=e(this),i=l.data(r),o=n({},a,l.data(),"object"==typeof t&&t?t:{});if(!i&&o.toggle&&"string"==typeof t&&/show|hide/.test(t)&&(o.toggle=!1),i||(i=new s(this,o),l.data(r,i)),"string"==typeof t){if(void 0===i[t])throw new TypeError('No method named "'+t+'"');i[t]()}}))},c=s,h=[{key:"VERSION",get:function(){return"4.5.2"}},{key:"Default",get:function(){return a}}],(g=null)&&l(c.prototype,g),h&&l(c,h),s}();return e(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',(function(n){"A"===n.currentTarget.tagName&&n.preventDefault();var l=e(this),i=t.getSelectorFromElement(this),s=[].slice.call(document.querySelectorAll(i));e(s).each((function(){var t=e(this),n=t.data(r)?"toggle":l.data();c._jQueryInterface.call(t,n)}))})),e.fn[i]=c._jQueryInterface,e.fn[i].Constructor=c,e.fn[i].noConflict=function(){return e.fn[i]=s,c._jQueryInterface},c}));