芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/public_html/media/system/js/searchtools-es5.min.js
!function(){"use strict";Joomla=window.Joomla||{},function(t){t.resetFilters=function(t){var e=t.form;if(!e)throw new Error("Element must be inside a form!");var i=[].slice.call(e.elements);if(i.length){var s=[];i.forEach((function(e){"task"===e.getAttribute("name")||"boxchecked"===e.getAttribute("name")||"1"===e.value&&/^[0-9A-F]{32}$/i.test(e.name)||e===t||s.push(e)})),s.forEach((function(t){t.value=""})),e.submit()}};var e=function(){function e(e,i){this.element=e,this.options=t.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},i),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;var s=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",(function(t){s.toggleFilters(),t.stopPropagation(),t.preventDefault()})),this.listButton&&this.listButton.addEventListener("click",(function(t){s.toggleList(),t.stopPropagation(),t.preventDefault()})),this.getFilterFields().forEach((function(t){s.checkFilter(t),t.addEventListener("change",(function(){s.checkFilter(t)}))})),this.clearButton&&this.clearButton.addEventListener("click",s.clear),this.createOrderField(),this.orderCols.forEach((function(t){t.addEventListener("click",(function(t){var e=t.target,i="span"===e.tagName.toLowerCase()?e.parentNode:e,o=i.getAttribute("data-order"),r=i.getAttribute("data-direction"),n=o+" "+r;o.length&&(s.activeColumn=o,n!==s.activeOrder?(s.activeDirection=r,s.activeOrder=n,s.updateFieldValue(s.orderField,n)):s.toggleDirection(),s.theForm.submit())}))})),this.checkActiveStatus(this)}var i=e.prototype;return i.checkFilter=function(t){if("select"===t.tagName.toLowerCase()){var e=t.querySelector("option:checked");e&&(""!==e.value?this.activeFilter(t,this):this.deactiveFilter(t,this))}else""!==t.value?this.activeFilter(t,this):this.deactiveFilter(t,this)},i.clear=function(){var t=this;t.searchField&&(t.searchField.value=""),t.getFilterFields().forEach((function(e){e.value="",t.checkFilter(e),window.jQuery&&window.jQuery.chosen&&window.jQuery(e).trigger("chosen:updated")})),t.clearListOptions&&(t.getListFields().forEach((function(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()},i.updateFilterCount=function(t){this.clearButton&&(this.clearButton.disabled=0===t&&!this.searchString.length)},i.checkActiveStatus=function(t){var e=0;if(this.getFilterFields().forEach((function(i){i.classList.contains("active")&&(e+=1,t.filterButton.classList.remove("btn-secondary"),t.filterButton.classList.add("btn-primary"))})),0===e){var i=document.getElementById("filteredBy");i&&i.parentNode.removeChild(i)}this.clearButton&&(this.clearButton.disabled=0===e&&!this.searchString.length)},i.activeFilter=function(t){t.classList.add("active");var e="#"+t.getAttribute("id"),i=t.querySelector(e);i&&i.classList.add("active");var s=document.getElementById("filteredBy"),o=Object.prototype.hasOwnProperty.call(t.attributes,"type")&&"hidden"===t.attributes.type.value;if(s&&!o){var r="";if("select"===t.tagName.toLowerCase())if(!0===t.multiple){var n=t.querySelectorAll("option:checked"),l=[].slice.call(n).map((function(t){return t.text}));r=t.labels[0].textContent+" - "+l.join()}else r=t.labels[0].textContent+" - "+t.options[t.selectedIndex].text;else r=t.labels[0].textContent+" - "+t.value;s.textContent+=r}},i.deactiveFilter=function(t){t.classList.remove("active");var e="#"+t.getAttribute("id"),i=t.querySelector(e);i&&i.classList.remove("active")},i.getFilterFields=function(){return this.filterContainer?Array.prototype.slice.call(this.filterContainer.querySelectorAll("select,input")):[]},i.getListFields=function(){return Array.prototype.slice.call(this.listContainer.querySelectorAll("select"))},i.hideContainer=function(t){t&&(t.classList.remove("js-stools-container-filters-visible"),document.body.classList.remove("filters-shown"))},i.showContainer=function(t){t.classList.add("js-stools-container-filters-visible"),document.body.classList.add("filters-shown")},i.toggleContainer=function(t){t.classList.contains("js-stools-container-filters-visible")?this.hideContainer(t):this.showContainer(t)},i.hideList=function(){this.hideContainer(this.filterContainer)},i.showList=function(){this.showContainer(this.filterContainer)},i.toggleList=function(){this.toggleContainer(this.filterContainer)},i.hideFilters=function(){this.hideContainer(this.filterContainer)},i.showFilters=function(){this.showContainer(this.filterContainer)},i.toggleFilters=function(){this.toggleContainer(this.filterContainer)},i.toggleDirection=function(){var t=this,e="ASC";"ASC"===t.activeDirection.toUpperCase()&&(e="DESC"),t.activeDirection=e,t.activeOrder=t.activeColumn+" "+e,t.updateFieldValue(t.orderField,t.activeOrder)},i.createOrderField=function(){var e=this,i=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",i.options.orderFieldName),this.orderField.setAttribute("value",i.activeOrder+" "+this.activeDirection),this.theForm.append(this.orderField)),"select"===this.orderField.tagName.toLowerCase())&&([].slice.call(this.orderField.options).forEach((function(s){var o=s.getAttribute("data-order"),r=s.getAttribute("data-name"),n=s.getAttribute("data-direction");if(o&&o.length){o=o+" "+n;var l=i.findOption(i.orderField,o);l.length||((l=document.createElement("option")).text=r,l.value=o,s.classList.contains("active")&&l.setAttribute("selected","selected"),e.orderFieldName.innerHTML+=t.sanitizeHtml(l))}})),window.jQuery&&window.jQuery.chosen&&window.jQuery(this.orderField).trigger("chosen:updated"));this.activeOrder=this.orderField.value},i.updateFieldValue=function(t,e){var i=t.getAttribute("type");if("hidden"===i||"text"===i)t.setAttribute("value",e);else if("select"===t.tagName.toLowerCase()){var s;if([].slice.call(t.options).forEach((function(t){t.value===e&&(s=t)})),s&&s.length)s.setAttribute("selected","selected");else{var o=document.createElement("option");o.text=e,o.value=e,o.setAttribute("selected","selected"),t.appendChild(o)}t.value=e,window.jQuery&&window.jQuery.chosen&&t.trigger("chosen:updated")}},i.findOption=function(t,e){for(var i=0,s=t.length;s>i;i++)if(t[i].value===e)return t[i]},e}();document.addEventListener("DOMContentLoaded",(function i(){if(t.getOptions("searchtools")){var s=t.getOptions("searchtools"),o=document.querySelector(s.selector);new e(o,s)}var r=document.getElementById("sorted"),n=document.getElementById("orderedBy");if(r&&r.hasAttribute("data-caption")&&n){var l=r.getAttribute("data-caption");n.textContent+=l}if(r&&r.hasAttribute("data-sort")){var c=r.getAttribute("data-sort");r.parentNode.setAttribute("aria-sort",c)}document.removeEventListener("DOMContentLoaded",i)}))}(Joomla)}();