- md5
- 394e40741b908d4b4dd5ce0d94ada011
- sha1
- 8de0aaf1bb9d59b43a703e63ea80359bb0ffd68a
- sha256
- 3a0851bf70b8eda4148f3d7a1f99a51c96ed95b740d2ed61362e0762e0587e9c
(()=>{"use strict";const t=()=>{if(Joomla.getOptions("searchtools")){const t=Joomla.getOptions("searchtools");new class{constructor(t,e){this.element=t,this.options=Joomla.extend({formSelector:".js-stools-form",searchFieldSelector:".js-stools-field-search",clearBtnSelector:".js-stools-btn-clear",mainContainerSelector:".js-stools",searchBtnSelector:".js-stools-btn-search",filterBtnSelector:".js-stools-btn-filter",filterContainerSelector:".js-stools-container-filters",filtersHidden:!0,listBtnSelector:".js-stools-btn-list",listContainerSelector:".js-stools-container-list",listHidden:!0,orderColumnSelector:".js-stools-column-order",orderBtnSelector:".js-stools-btn-order",orderFieldSelector:".js-stools-field-order",orderFieldName:"list[fullordering]",limitFieldSelector:".js-stools-field-limit",defaultLimit:20,activeOrder:null,activeDirection:"ASC",clearListOptions:!1},e),this.theForm=document.querySelector(this.options.formSelector),this.filterButton=document.querySelector(`${this.options.formSelector} ${this.options.filterBtnSelector}`),this.filterContainer=document.querySelector(`${this.options.formSelector} ${this.options.filterContainerSelector}`)?document.querySelector(`${this.options.formSelector} ${this.options.filterContainerSelector}`):"",this.filtersHidden=this.options.filtersHidden,this.listButton=document.querySelector(this.options.listBtnSelector),this.listContainer=document.querySelector(`${this.options.formSelector} ${this.options.listContainerSelector}`),this.listHidden=this.options.listHidden,this.mainContainer=document.querySelector(this.options.mainContainerSelector),this.searchButton=document.querySelector(`${this.options.formSelector} ${this.options.searchBtnSelector}`),this.searchField=document.querySelector(`${this.options.formSelector} ${this.options.searchFieldSelector}`),this.searchString=null,this.clearButton=document.querySelector(this.options.clearBtnSelector),this.orderCols=Array.prototype.slice.call(document.querySelectorAll(`${this.options.formSelector} ${this.options.orderColumnSelector}`)),this.orderField=document.querySelector(`${this.options.formSelector} ${this.options.orderFieldSelector}`),this.limitField=document.querySelector(`${this.options.formSelector} ${this.options.limitFieldSelector}`),this.activeColumn=null,this.activeDirection=this.options.activeDirection,this.activeOrder=this.options.activeOrder,this.activeLimit=null,this.clearListOptions=this.options.clearListOptions;const i=this;this.searchString=this.searchField.value,this.showFilters=this.showFilters.bind(this),this.hideFilters=this.hideFilters.bind(this),this.showList=this.showList.bind(this),this.hideList=this.hideList.bind(this),this.toggleFilters=this.toggleFilters.bind(this),this.toggleList=this.toggleList.bind(this),this.checkFilter=this.checkFilter.bind(this),this.clear=this.clear.bind(this),this.createOrderField=this.createOrderField.bind(this),this.checkActiveStatus=this.checkActiveStatus.bind(this),this.activeFilter=this.activeFilter.bind(this),this.deactiveFilter=this.deactiveFilter.bind(this),this.getFilterFields=this.getFilterFields.bind(this),this.getListFields=this.getListFields.bind(this),this.hideContainer=this.hideContainer.bind(this),this.showContainer=this.showContainer.bind(this),this.toggleContainer=this.toggleContainer.bind(this),this.toggleDirection=this.toggleDirection.bind(this),this.updateFieldValue=this.updateFieldValue.bind(this),this.findOption=this.findOption.bind(this),this.filterContainer&&this.filterContainer.classList.contains("js-stools-container-filters-visible")?(this.showFilters(),this.showList()):(this.hideFilters(),this.hideList()),this.filterButton&&this.filterButton.addEventListener("click",t=>{i.toggleFilters(),t.stopPropagation(),t.preventDefault()}),this.listButton&&this.listButton.addEventListener("click",t=>{i.toggleList(),t.stopPropagation(),t.preventDefault()}),this.getFilterFields()&&this.getFilterFields().forEach(t=>{i.checkFilter(t),t.addEventListener("change",()=>{i.checkFilter(t)})}),this.clearButton&&this.clearButton.addEventListener("click",i.clear),this.createOrderField(),this.orderCols.forEach(t=>{t.addEventListener("click",t=>{const e="span"===t.target.tagName.toLowerCase()?t.target.parentNode:t.target,s=e.getAttribute("data-order"),o=e.getAttribute("data-direction"),r=`${s} ${o}`;s.length&&(i.activeColumn=s,r!==i.activeOrder?(i.activeDirection=o,i.activeOrder=r,i.updateFieldValue(i.orderField,r)):i.toggleDirection(),i.theForm.submit())})}),this.checkActiveStatus(this),document.body.addEventListener("click",t=>{if(document.body.classList.contains("filters-shown")){if(t.composedPath&&"function"==typeof t.composedPath){if(-1!==t.composedPath().indexOf(this.filterContainer))return}else{let e=t.target;for(;e!==document.body;){if(e===this.filterContainer)return;e=e.parentNode}}this.hideFilters()}})}checkFilter(t){const e=t.querySelector("option:checked");e&&(""!==e.value?this.activeFilter(t,this):this.deactiveFilter(t,this))}clear(){const t=this;t.searchField&&(t.searchField.value=""),t.getFilterFields()&&t.getFilterFields().forEach(e=>{e.value="",t.checkFilter(e),window.jQuery&&window.jQuery.chosen&&window.jQuery(e).trigger("chosen:updated")}),t.clearListOptions&&(t.getListFields().forEach(e=>{e.value="",t.checkFilter(e),window.jQuery&&window.jQuery.chosen&&window.jQuery(e).trigger("chosen:updated")}),document.querySelector("#list_limit").value=t.options.defaultLimit,window.jQuery&&window.jQuery.chosen&&window.jQuery("#list_limit").trigger("chosen:updated")),t.theForm.submit()}checkActiveStatus(t){const e=t.mainContainer;[].slice.call(e.querySelectorAll(".js-stools-field-filter select")).forEach(e=>{e.classList.contains("active")&&(t.filterButton.classList.remove("btn-secondary"),t.filterButton.classList.add("btn-primary"))})}activeFilter(t){t.classList.add("active");const e=`#${t.getAttribute("id")}`,i=t.querySelector(e);i&&i.classList.add("active")}deactiveFilter(t){t.classList.remove("active");const e=`#${t.getAttribute("id")}`,i=t.querySelector(e);i&&i.classList.remove("active")}getFilterFields(){if(this.filterContainer)return Array.prototype.slice.call(this.filterContainer.querySelectorAll("select,input"))}getListFields(){return Array.prototype.slice.call(this.listContainer.querySelectorAll("select"))}hideContainer(t){t&&(t.classList.remove("js-filters-show"),document.body.classList.remove("filters-shown"))}showContainer(t){t.classList.add("js-filters-show"),document.body.classList.add("filters-shown")}toggleContainer(t){t.classList.contains("js-filters-show")?this.hideContainer(t):this.showContainer(t)}hideList(){this.hideContainer(this.filterContainer)}showList(){this.showContainer(this.filterContainer)}toggleList(){this.toggleContainer(this.filterContainer)}hideFilters(){this.hideContainer(this.filterContainer)}showFilters(){this.showContainer(this.filterContainer)}toggleFilters(){this.toggleContainer(this.filterContainer)}toggleDirection(){let t="ASC";"ASC"===this.activeDirection.toUpperCase()&&(t="DESC"),this.activeDirection=t,this.activeOrder=`${this.activeColumn} ${t}`,this.updateFieldValue(this.orderField,this.activeOrder)}createOrderField(){const t=this;this.orderField||(this.orderField=document.createElement("input"),this.orderField.setAttribute("type","hidden"),this.orderField.setAttribute("id","js-stools-field-order"),this.orderField.setAttribute("class","js-stools-field-order"),this.orderField.setAttribute("name",t.options.orderFieldName),this.orderField.setAttribute("value",`${t.activeOrder} ${this.activeDirection}`),this.theForm.innerHTML+=this.orderField.outerHTML),"select"===this.orderField.tagName.toLowerCase()&&([].slice.call(this.orderField.options).forEach(e=>{let i=e.getAttribute("data-order");const s=e.getAttribute("data-name"),o=e.getAttribute("data-direction");if(i&&i.length){i=`${i} ${o}`;let r=t.findOption(t.orderField,i);r.length||((r=document.createElement("option")).text=s,r.value=i,e.classList.contains("active")&&r.setAttribute("selected","selected"),this.orderFieldName.innerHTML+=r)}}),window.jQuery&&window.jQuery.chosen&&window.jQuery(this.orderField).trigger("chosen:updated")),this.activeOrder=this.orderField.value}updateFieldValue(t,e){const i=t.getAttribute("type");if("hidden"===i||"text"===i)t.setAttribute("value",e);else if("select"===t.tagName.toLowerCase()){let i;if([].slice.call(t.options).forEach(t=>{t.value===e&&(i=t)}),i&&i.length)i.setAttribute("selected","selected");else{const i=document.createElement("option");i.text=e,i.value=e,i.setAttribute("selected","selected"),t.appendChild(i)}t.value=e,window.jQuery&&window.jQuery.chosen&&t.trigger("chosen:updated")}}findOption(t,e){for(let i=0,s=t.length;s>i;i++)if(t[i].value===e)return t[i]}}(document.querySelector(t.selector),t)}const e=document.getElementById("sorted");if(e&&e.hasAttribute("data-caption")){const t=e.getAttribute("data-caption");document.getElementById("captionTable").textContent+=t}if(e&&e.hasAttribute("data-sort")){const t=e.getAttribute("data-sort");e.parentNode.setAttribute("aria-sorted",t)}document.removeEventListener("DOMContentLoaded",t)};document.addEventListener("DOMContentLoaded",t)})();
No other release has this exact content. See every version of this file.