CoreFiles by mySites.guru
joomla-tab-es5.min.js1 lines, 9,772 bytes, from Joomla_4.0.0-beta2-Beta-Full_Package.zip
Raw History Compare with 4.0.0-beta
md5
3e12f26fb5463bf28afb7fc510bd4d22
sha1
e0b6c194779e1c6e9811b381839ab0c4f17e3d8f
sha256
ab4487f92d292c2e51ef360d30e25dcf8ad79f02bc33b0765f6a0b3248664c58
!function(){return function t(e,r,i){function n(a,c){if(!r[a]){if(!e[a]){var u="function"==typeof require&&require;if(!c&&u)return u(a,!0);if(o)return o(a,!0);var s=new Error("Cannot find module '"+a+"'");throw s.code="MODULE_NOT_FOUND",s}var l=r[a]={exports:{}};e[a][0].call(l.exports,function(t){return n(e[a][1][t]||t)},l,l.exports,t,e,r,i)}return r[a].exports}for(var o="function"==typeof require&&require,a=0;a<i.length;a++)n(i[a]);return n}}()({1:[function(t,e,r){"use strict";function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function n(t){return(n="function"==typeof Symbol&&"symbol"===i(Symbol.iterator)?function(t){return i(t)}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":i(t)})(t)}function o(t,e){return!e||"object"!==n(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function a(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function c(t,e,r){return e&&a(t.prototype,e),r&&a(t,r),t}function u(t){var e="function"==typeof Map?new Map:void 0;return(u=function(t){if(null===t||(r=t,-1===Function.toString.call(r).indexOf("[native code]")))return t;var r;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,i)}function i(){return s(t,arguments,f(this).constructor)}return i.prototype=Object.create(t.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),l(i,t)})(t)}function s(t,e,r){return(s=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}()?Reflect.construct:function(t,e,r){var i=[null];i.push.apply(i,e);var n=new(Function.bind.apply(t,i));return r&&l(n,r.prototype),n}).apply(null,arguments)}function l(t,e){return(l=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function f(t){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}customElements.define("joomla-tab",function(t){function e(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=o(this,f(e).call(this))).hasActive=!1,t.currentActive="",t.hasNested=!1,t.isNested=!1,t.tabs=[],t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&l(t,e)}(e,u(HTMLElement)),c(e,[{key:"recall",get:function(){return this.getAttribute("recall")}},{key:"view",get:function(){return this.getAttribute("view")},set:function(t){this.setAttribute("view",t)}},{key:"orientation",get:function(){return this.getAttribute("orientation")},set:function(t){this.setAttribute("orientation",t)}}],[{key:"observedAttributes",get:function(){return["recall","orientation","view"]}}]),c(e,[{key:"connectedCallback",value:function(){var t=this;(!this.orientation||this.orientation&&-1===["horizontal","vertical"].indexOf(this.orientation))&&(this.orientation="horizontal");var e=this,r=[].slice.call(this.querySelectorAll("section")),i=[],n=[];if(r){if(this.parentNode.closest("joomla-tab")&&(this.isNested=!0),this.querySelector("joomla-tab")&&(this.hasNested=!0),this.hasAttribute("recall")){var o=sessionStorage.getItem(this.getStorageKey());o&&n.push(o)}if(this.hasNested){var a=sessionStorage.getItem(this.getStorageKey());if(a&&n.push(a),n.length&&""!==n[0]){var c=n[0].substring(5),u=this.querySelector("#".concat(c));if(u){var s=u.closest("joomla-tab");if(this.isNested){var l=s.closest("section");l&&n.push("#tab-".concat(l.id))}}}r.forEach(function(t){if(n.length){var r="#tab-".concat(t.id);-1===n.indexOf(r)?t.removeAttribute("active"):t.setAttribute("active","")}t.parentNode===e&&i.push(t)})}else r.forEach(function(t){if(n.length){var e="#tab-".concat(t.id);-1===n.indexOf(e)?t.removeAttribute("active"):t.setAttribute("active","")}}),i=r;if("accordion"!==this.view&&this.createNavigation(i),i.forEach(function(e){e.setAttribute("role","tabpanel"),t.tabs.push("#tab-".concat(e.id)),e.hasAttribute("active")&&(t.hasActive=!0,t.currentActive=e.id,t.querySelector("#tab-".concat(e.id)).setAttribute("aria-selected","true"),t.querySelector("#tab-".concat(e.id)).setAttribute("active",""),t.querySelector("#tab-".concat(e.id)).setAttribute("tabindex","0"))}),this.hasActive||(i[0].setAttribute("active",""),i[0].removeAttribute("aria-hidden"),this.hasActive=!0,this.currentActive=i[0].id,this.querySelector("#tab-".concat(i[0].id)).setAttribute("aria-selected","true"),this.querySelector("#tab-".concat(i[0].id)).setAttribute("tabindex","0"),this.querySelector("#tab-".concat(i[0].id)).setAttribute("active","")),window.location.href.match(/#\S[^&]*/)){var f=window.location.href.match(/#\S[^&]*/),h=this.querySelector(f[0]);if(h){var b=h.closest("joomla-tab");if(this.isNested){var d=b.closest("joomla-tab"),v=b.closest("section");d.showTab(v),this.show(h)}else this.showTab(h)}}e.checkView(e),window.addEventListener("resize",function(){e.checkView(e)})}}},{key:"disconnectedCallback",value:function(){var t=this,e=this.querySelector("ul");[].slice.call(e.querySelectorAll("a")).forEach(function(e){e.removeEventListener("click",t)}),e.removeEventListener("keydown",this)}},{key:"createNavigation",value:function(t){var e=this;if("ul"!==this.firstElementChild.nodeName.toLowerCase()){var r=document.createElement("ul");r.setAttribute("role","tablist");var i=function(t){t.preventDefault(),e.hasActive&&e.hideCurrent();var r=e.currentActive;e.dispatchCustomEvent("joomla.tab.show",t.target,e.querySelector("#tab-".concat(r))),t.target.setAttribute("active",""),t.target.setAttribute("aria-selected","true"),t.target.setAttribute("tabindex","0"),e.querySelector(t.target.hash).setAttribute("active",""),e.querySelector(t.target.hash).removeAttribute("aria-hidden"),e.currentActive=t.target.hash.substring(1),e.dispatchCustomEvent("joomla.tab.shown",t.target,e.querySelector("#tab-".concat(r))),e.saveState("#tab-".concat(t.target.hash.substring(1)))};t.forEach(function(t){if(t.id){var e=t.hasAttribute("active"),n=document.createElement("li"),o=document.createElement("a");n.setAttribute("role","presentation"),o.setAttribute("role","tab"),o.setAttribute("aria-controls",t.id),o.setAttribute("aria-selected",e?"true":"false"),o.setAttribute("tabindex",e?"0":"-1"),o.setAttribute("href","#".concat(t.id)),o.setAttribute("id","tab-".concat(t.id)),o.innerHTML=t.getAttribute("name"),e&&o.setAttribute("active",""),o.addEventListener("click",i),n.appendChild(o),r.appendChild(n),t.setAttribute("aria-labelledby","tab-".concat(t.id)),e||t.setAttribute("aria-hidden","true")}}),this.insertAdjacentElement("afterbegin",r),this.addKeyListeners()}}},{key:"hideCurrent",value:function(){if(this.currentActive){var t=this.querySelector('a[aria-controls="'.concat(this.currentActive,'"]'));this.dispatchCustomEvent("joomla.tab.hide",t,this.querySelector("#tab-".concat(this.currentActive))),t.removeAttribute("active"),t.setAttribute("tabindex","-1"),this.querySelector("#".concat(this.currentActive)).removeAttribute("active"),this.querySelector("#".concat(this.currentActive)).setAttribute("aria-hidden","true"),t.removeAttribute("aria-selected"),this.dispatchCustomEvent("joomla.tab.hidden",t,this.querySelector("#tab-".concat(this.currentActive)))}}},{key:"showTab",value:function(t){document.querySelector("#tab-".concat(t.id)).click()}},{key:"show",value:function(t){t.click()}},{key:"addKeyListeners",value:function(){var t=this;this.querySelector("ul").addEventListener("keyup",function(e){var r=t.querySelector("#tab-".concat(t.currentActive)),i=r.parentNode.previousElementSibling||r.parentNode.parentNode.lastElementChild,n=r.parentNode.nextElementSibling||r.parentNode.parentNode.firstElementChild;if(!e.metaKey&&!e.altKey&&-1!==t.tabs.indexOf("#".concat(document.activeElement.id)))switch(e.keyCode){case 37:case 38:i.querySelector("a").click(),i.querySelector("a").focus(),e.preventDefault();break;case 39:case 40:n.querySelector("a").click(),n.querySelector("a").focus(),e.preventDefault()}})}},{key:"getStorageKey",value:function(){return window.location.href.toString().split(window.location.host)[1].replace(/&return=[a-zA-Z0-9%]+/,"").split("#")[0]}},{key:"saveState",value:function(t){var e=this.getStorageKey();sessionStorage.setItem(e,t)}},{key:"checkView",value:function(t){var e=t,r=e.querySelector("ul"),i=[];if(document.body.getBoundingClientRect().width>920){if("tabs"===this.view)return;e.view="tabs";for(var n=[].slice.call(r.querySelectorAll("section")),o=0,a=n.length;o<a;++o)n[o].parentNode.parentNode.parentNode===e&&i.push(n[o]);i.length&&i.forEach(function(t){e.appendChild(t)})}else{if("accordion"===this.view)return;e.view="accordion";for(var c=[].slice.call(e.querySelectorAll("section")),u=0,s=c.length;u<s;++u)c[u].parentNode===e&&i.push(c[u]);i.length&&i.forEach(function(t){var r=e.querySelector('a[aria-controls="'.concat(t.id,'"]'));r.parentNode.parentNode===e.firstElementChild&&r.parentNode.appendChild(t)})}}},{key:"dispatchCustomEvent",value:function(t,e,r){var i=new CustomEvent(t,{bubbles:!0,cancelable:!0});i.relatedTarget=r,e.dispatchEvent(i),e.removeEventListener(t,e)}}]),e}())},{}]},{},[1]);

The same content is in 5 releases, Joomla 4.0.0-beta to 4.0.0-beta5. See them all, or every version of this file.