widgets
2 weeks ago
animate-circle.js
2 weeks ago
editor-promotion.js
2 weeks ago
ekit-masonry.js
2 weeks ago
ekit-ui.js
2 weeks ago
info-tip.js
2 weeks ago
lottie.init.js
2 weeks ago
mail-chimp.js
2 weeks ago
nav-menu.js
2 weeks ago
ekit-ui.js
56 lines
| 1 | !function(){var e={204:function(e,t,n){var i,r,o,a;function s(e){return s="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},s(e)} |
| 2 | /*! |
| 3 | * ElementsKit UI toggle script |
| 4 | * --------------------------------------------------------------------- |
| 5 | * Author: WPMet |
| 6 | * Version: 1.0.0 |
| 7 | * License: GPL-2.0-or-later |
| 8 | * --------------------------------------------------------------------- |
| 9 | * |
| 10 | * WHAT THIS FILE IS |
| 11 | * --------------------------------------------------------------------- |
| 12 | * A clean-room rewrite of the Bootstrap 4.0.0 "ui-slim" bundle that |
| 13 | * ElementsKit's Accordion / Tab / Advanced Accordion / Advanced Tab / |
| 14 | * Advanced Toggle widgets rely on. |
| 15 | * |
| 16 | * It contains NO Bootstrap source code. It independently reimplements |
| 17 | * only the two behaviors ElementsKit actually uses — Collapse and Tab — |
| 18 | * while reproducing the same public surface, so no PHP or widget JS |
| 19 | * files need to change: |
| 20 | * |
| 21 | * - window.bootstrap.Util / .Collapse / .Tab (global, same as before) |
| 22 | * - jQuery.fn.collapse(...) / jQuery.fn.tab(...) |
| 23 | * - data-ekit-toggle="collapse|tab|pill|list", data-target, data-parent, |
| 24 | * href="#id" |
| 25 | * - classes: collapse / collapsing / show / collapsed / active / |
| 26 | * disabled / fade |
| 27 | * - events: show.bs.collapse / shown.bs.collapse / hide.bs.collapse / |
| 28 | * hidden.bs.collapse / show.bs.tab / shown.bs.tab / hide.bs.tab / |
| 29 | * hidden.bs.tab |
| 30 | * |
| 31 | * Note: data-ekit-toggle-trigger (click/hover) is read by the companion |
| 32 | * widget scripts (e.g. widgets/tab.js), not by this file — this file only |
| 33 | * ever reacts to the resulting click event. |
| 34 | * |
| 35 | * SECURITY NOTE |
| 36 | * --------------------------------------------------------------------- |
| 37 | * The previous library resolved data-parent / data-target / href values |
| 38 | * by handing them to jQuery's `$()` constructor and to hand-built |
| 39 | * selector strings — both of which can be tricked into parsing an |
| 40 | * attacker-controlled attribute value as HTML (CVE-2018-14040, plus the |
| 41 | * same code pattern repeated a second time in that file). |
| 42 | * |
| 43 | * This rewrite never does that. Every attribute-derived value is only |
| 44 | * ever resolved with `document.querySelector` / `querySelectorAll` |
| 45 | * (native APIs that are structurally incapable of interpreting a string |
| 46 | * as HTML — they only ever run it as a CSS selector, or throw), and |
| 47 | * `getSelectorFromElement` additionally rejects anything that isn't a |
| 48 | * plain `#id` (or comma-separated list of them) before it is used at |
| 49 | * all. There is no code path in this file that can turn an attribute |
| 50 | * value into executable markup. |
| 51 | * |
| 52 | * STATUS: not wired into WordPress yet. This sits alongside the |
| 53 | * original ui-slim.min.js, unregistered and unused, pending review and |
| 54 | * testing before it replaces the original. |
| 55 | * --------------------------------------------------------------------- |
| 56 | */a=function(e,t){"use strict";if(!t)throw new TypeError("ElementsKit UI toggle script requires jQuery. Load jQuery before this file.");var n=function(){var e="ekitTransitionEnd",n="undefined"!=typeof document&&"undefined"!=typeof window&&("ontransitionend"in document.documentElement||"TransitionEvent"in window);function i(e,t){if(!e||"string"!=typeof e)return null;try{return(t||document).querySelector(e)}catch(n){return null}}return n&&(t.event.special[e]={bindType:"transitionend",delegateType:"transitionend",handle:function(e){if(t(e.target).is(this))return e.handleObj.handler.apply(this,arguments)}}),{TRANSITION_END:e,supportsTransitionEnd:function(){return n},safeQuery:i,safeQueryAll:function(e,t){if(!e||"string"!=typeof e)return[];try{return Array.prototype.slice.call((t||document).querySelectorAll(e))}catch(n){return[]}},getSelectorFromElement:function(e){var t=e.getAttribute("data-target");return t&&"#"!==t||(t=e.getAttribute("href")||""),!(t=t.trim())||"#"!==t.charAt(0)||t.length<2?null:/^#[\w-]+(?:,#[\w-]+)*$/.test(t)&&i(t)?t:null},reflow:function(e){return e.offsetHeight},getTransitionDurationFromElement:function(e,t){if(!e||"undefined"==typeof window||!window.getComputedStyle)return t;var n=window.getComputedStyle(e),i=parseFloat(n.transitionDuration)||0,r=parseFloat(n.transitionDelay)||0;return i||r?1e3*(i+r):t},emulateTransitionEnd:function(t,n){var i=!1;t.one(e,function(){i=!0}),setTimeout(function(){i||t.trigger(e)},n)},isElement:function(e){return!(!e||!(e.nodeType||e[0]&&e[0].nodeType))}}}(),i=function(){var e="collapse",i="bs.collapse",r="show",o="collapse",a="collapsing",l="collapsed",u="width",f='[data-ekit-toggle="collapse"]',d={toggle:!0,parent:""};function c(e,t){this._isTransitioning=!1,this._element=e,this._config=Object.assign({},d,t),this._triggerArray=function(e){return n.safeQueryAll(f).filter(function(t){var i=n.getSelectorFromElement(t);return i&&n.safeQuery(i)===e})}(e),this._parent=this._config.parent?this._getParent():null,this._config.parent||this._addAriaAndCollapsedClass(this._element,this._triggerArray),this._config.toggle&&this.toggle()}c.prototype.toggle=function(){t(this._element).hasClass(r)?this.hide():this.show()},c.prototype.show=function(){var e=this;if(!this._isTransitioning&&!t(this._element).hasClass(r)){var s=null;if(this._parent){var u=n.safeQueryAll(".show, .collapsing",this._parent).filter(function(t){var i=t.getAttribute("data-parent");return!!i&&("string"==typeof e._config.parent?i===e._config.parent:n.safeQuery(i)===e._parent)});if(u.length){var f=t((s=u)[0]).data(i);if(f&&f._isTransitioning)return}}var d=t.Event("show.bs.collapse");if(t(this._element).trigger(d),!d.isDefaultPrevented()){s&&s.forEach(function(n){if(n!==e._element){var r=t(n),o=r.data(i);o||(o=new c(n,{toggle:!1}),r.data(i,o)),o.hide()}});var h=this._getDimension();t(this._element).removeClass(o).addClass(a),this._element.style[h]="0px",this._triggerArray.length&&t(this._triggerArray).removeClass(l).attr("aria-expanded",!0),this.setTransitioning(!0);var g=function(){t(e._element).removeClass(a).addClass(o).addClass(r),e._element.style[h]="",e.setTransitioning(!1),t(e._element).trigger("shown.bs.collapse")};if(n.supportsTransitionEnd()){var p="scroll"+(h.charAt(0).toUpperCase()+h.slice(1)),m=n.getTransitionDurationFromElement(this._element,600);n.emulateTransitionEnd(t(this._element).one(n.TRANSITION_END,g),m),this._element.style[h]=this._element[p]+"px"}else g()}}},c.prototype.hide=function(){var e=this;if(!this._isTransitioning&&t(this._element).hasClass(r)){var i=t.Event("hide.bs.collapse");if(t(this._element).trigger(i),!i.isDefaultPrevented()){var s=this._getDimension();this._element.style[s]=this._element.getBoundingClientRect()[s]+"px",n.reflow(this._element),t(this._element).addClass(a).removeClass(o).removeClass(r),this._triggerArray.length&&this._triggerArray.forEach(function(e){var i=n.getSelectorFromElement(e);i&&(n.safeQueryAll(i).some(function(e){return e.classList.contains(r)})||t(e).addClass(l).attr("aria-expanded",!1))}),this.setTransitioning(!0);var u=function(){e.setTransitioning(!1),t(e._element).removeClass(a).addClass(o).trigger("hidden.bs.collapse")};if(this._element.style[s]="",n.supportsTransitionEnd()){var f=n.getTransitionDurationFromElement(this._element,600);n.emulateTransitionEnd(t(this._element).one(n.TRANSITION_END,u),f)}else u()}}},c.prototype.setTransitioning=function(e){this._isTransitioning=e},c.prototype.dispose=function(){t.removeData(this._element,i),this._config=null,this._parent=null,this._element=null,this._triggerArray=null,this._isTransitioning=null},c.prototype._getDimension=function(){return t(this._element).hasClass(u)?u:"height"},c.prototype._getParent=function(){var e,t=this,i=this._config.parent;return(e=n.isElement(i)?i.jquery?i[0]:i:n.safeQuery(i))?(n.safeQueryAll(f,e).filter(function(t){var r=t.getAttribute("data-parent");return!!r&&("string"==typeof i?r===i:n.safeQuery(r)===e)}).forEach(function(e){var i=n.getSelectorFromElement(e),r=i?n.safeQuery(i):null;t._addAriaAndCollapsedClass(r,[e])}),e):null},c.prototype._addAriaAndCollapsedClass=function(e,n){if(e){var i=t(e).hasClass(r);n.length&&t(n).toggleClass(l,!i).attr("aria-expanded",i)}};var h=t.fn[e];function g(r){"A"===this.tagName&&r.preventDefault();var o=t(this),a=n.getSelectorFromElement(this);a&&n.safeQueryAll(a).forEach(function(n){var r=t(n),a=!!r.data(i);r[e](a?"toggle":o.data())})}return t.fn[e]=function(e){return this.each(function(){var n=t(this),r=n.data(i),o=n.data(),a={};o.toggle!==undefined&&(a.toggle=o.toggle),o.parent!==undefined&&(a.parent=o.parent);var l=Object.assign({},d,a,"object"===s(e)&&e);if(!r&&l.toggle&&"string"==typeof e&&/show|hide/.test(e)&&(l.toggle=!1),r||(r=new c(this,l),n.data(i,r)),"string"==typeof e){if("undefined"==typeof r[e])throw new TypeError('No method named "'+e+'"');r[e]()}})},t.fn[e].Constructor=c,t.fn[e].noConflict=function(){return t.fn[e]=h,this},t(document).on("click",f,g),c.teardown=function(){t(document).off("click",f,g)},c.VERSION="1.0.0",c.Default=d,c}(),r=function(){var e="tab",i="bs.tab",r="active",o="show",a=".active",s="> li > .active",l='[data-ekit-toggle="tab"], [data-ekit-toggle="pill"], [data-ekit-toggle="list"]';function u(e){this._element=e}u.prototype.show=function(){var e=this;if(!(this._element.parentNode&&1===this._element.parentNode.nodeType&&t(this._element).hasClass(r)||t(this._element).hasClass("disabled"))){var i,o,l=t(this._element).closest(".nav, .list-group")[0],u=n.getSelectorFromElement(this._element);if(l){var f="UL"===l.nodeName||"OL"===l.nodeName?s:a,d=t.makeArray(t(l).find(f));o=d[d.length-1]}var c=t.Event("hide.bs.tab",{relatedTarget:this._element}),h=t.Event("show.bs.tab",{relatedTarget:o});if(o&&t(o).trigger(c),t(this._element).trigger(h),!h.isDefaultPrevented()&&!c.isDefaultPrevented()){u&&(i=n.safeQuery(u)),this._activate(this._element,l);var g=function(){var n=t.Event("hidden.bs.tab",{relatedTarget:e._element}),i=t.Event("shown.bs.tab",{relatedTarget:o});t(o).trigger(n),t(e._element).trigger(i)};i?this._activate(i,i.parentNode,g):g()}}},u.prototype.dispose=function(){t.removeData(this._element,i),this._element=null},u.prototype._activate=function(e,i,r){var o=(!i||"UL"!==i.nodeName&&"OL"!==i.nodeName?t(i).children(a):t(i).find(s))[0],l=r&&n.supportsTransitionEnd()&&o&&t(o).hasClass("fade"),f=function(){u.prototype._transitionComplete.call(this,e,o,r)}.bind(this);if(o&&l){var d=n.getTransitionDurationFromElement(o,150);n.emulateTransitionEnd(t(o).one(n.TRANSITION_END,f),d)}else f()},u.prototype._transitionComplete=function(e,i,a){if(i){t(i).removeClass(o+" "+r);var s=t(i.parentNode).find("> .dropdown-menu .active")[0];s&&t(s).removeClass(r),"tab"===i.getAttribute("role")&&i.setAttribute("aria-selected",!1)}if(t(e).addClass(r),"tab"===e.getAttribute("role")&&e.setAttribute("aria-selected",!0),n.reflow(e),t(e).addClass(o),e.parentNode&&t(e.parentNode).hasClass("dropdown-menu")){var l=t(e).closest(".dropdown")[0];l&&t(l).find(".dropdown-toggle").addClass(r),e.setAttribute("aria-expanded",!0)}a&&a()};var f=t.fn[e];function d(e){e.preventDefault(),t(this).tab("show")}return t.fn[e]=function(e){return this.each(function(){var n=t(this),r=n.data(i);if(r||(r=new u(this),n.data(i,r)),"string"==typeof e){if("undefined"==typeof r[e])throw new TypeError('No method named "'+e+'"');r[e]()}})},t.fn[e].Constructor=u,t.fn[e].noConflict=function(){return t.fn[e]=f,this},t(document).on("click",l,d),u.teardown=function(){t(document).off("click",l,d)},u.VERSION="1.0.0",u}();e.Util=n,e.Collapse=i,e.Tab=r,Object.defineProperty(e,"__esModule",{value:!0})},"object"===s(t)?a(t,n(669)):(r=[t,n(669)],(o="function"==typeof(i=a)?i.apply(t,r):i)===undefined||(e.exports=o))},669:function(e){"use strict";e.exports=jQuery}},t={};(function n(i){var r=t[i];if(r!==undefined)return r.exports;var o=t[i]={exports:{}};return e[i].call(o.exports,o,o.exports,n),o.exports})(204)}(); |