Files
PyRIGS/RIGS/static/js/collapse.js
Arona 06f67f4f32 Very initial work at togglable darktheme.
Dammit @alexdaniel654 just when I had my scope creep kinda under control. It'll be v. nice to have though...!
2020-05-27 04:24:58 +02:00

6 lines
6.4 KiB
JavaScript

/*!
* Bootstrap collapse.js v4.5.0 (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/master/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=e||self).Collapse=t(e.jQuery,e.Util)}(this,(function(e,t){"use strict";function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function l(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?i(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}e=e&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e,t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t;var s="collapse",a="bs.collapse",o=e.fn[s],c={toggle:!0,parent:""},g={toggle:"boolean",parent:"(string|element)"},h=function(){function r(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 r=[].slice.call(document.querySelectorAll('[data-toggle="collapse"]')),i=0,l=r.length;i<l;i++){var s=r[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 i,o,h,u=r.prototype;return u.toggle=function(){e(this._element).hasClass("show")?this.hide():this.show()},u.show=function(){var n,i,l=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 l._config.parent?e.getAttribute("data-parent")===l._config.parent:e.classList.contains("collapse")}))).length&&(n=null),!(n&&(i=e(n).not(this._selector).data(a))&&i._isTransitioning))){var s=e.Event("show.bs.collapse");if(e(this._element).trigger(s),!s.isDefaultPrevented()){n&&(r._jQueryInterface.call(e(n).not(this._selector),"hide"),i||e(n).data(a,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(l._element).removeClass("collapsing").addClass("collapse show"),l._element.style[o]="",l.setTransitioning(!1),e(l._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 r=e.Event("hide.bs.collapse");if(e(this._element).trigger(r),!r.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 l=this._triggerArray.length;if(l>0)for(var s=0;s<l;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,a),this._config=null,this._parent=null,this._element=null,this._triggerArray=null,this._isTransitioning=null},u._getConfig=function(e){return(e=l(l({},c),e)).toggle=Boolean(e.toggle),t.typeCheckConfig(s,e,g),e},u._getDimension=function(){return e(this._element).hasClass("width")?"width":"height"},u._getParent=function(){var n,i=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 l='[data-toggle="collapse"][data-parent="'+this._config.parent+'"]',s=[].slice.call(n.querySelectorAll(l));return e(s).each((function(e,t){i._addAriaAndCollapsedClass(r._getTargetFromElement(t),[t])})),n},u._addAriaAndCollapsedClass=function(t,n){var r=e(t).hasClass("show");n.length&&e(n).toggleClass("collapsed",!r).attr("aria-expanded",r)},r._getTargetFromElement=function(e){var n=t.getSelectorFromElement(e);return n?document.querySelector(n):null},r._jQueryInterface=function(t){return this.each((function(){var n=e(this),i=n.data(a),s=l(l(l({},c),n.data()),"object"==typeof t&&t?t:{});if(!i&&s.toggle&&"string"==typeof t&&/show|hide/.test(t)&&(s.toggle=!1),i||(i=new r(this,s),n.data(a,i)),"string"==typeof t){if(void 0===i[t])throw new TypeError('No method named "'+t+'"');i[t]()}}))},i=r,h=[{key:"VERSION",get:function(){return"4.5.0"}},{key:"Default",get:function(){return c}}],(o=null)&&n(i.prototype,o),h&&n(i,h),r}();return e(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',(function(n){"A"===n.currentTarget.tagName&&n.preventDefault();var r=e(this),i=t.getSelectorFromElement(this),l=[].slice.call(document.querySelectorAll(i));e(l).each((function(){var t=e(this),n=t.data(a)?"toggle":r.data();h._jQueryInterface.call(t,n)}))})),e.fn[s]=h._jQueryInterface,e.fn[s].Constructor=h,e.fn[s].noConflict=function(){return e.fn[s]=o,h._jQueryInterface},h}));