芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/testcors.sdektun.com/media/system/js/fields/joomla-field-module-order-es5.min.js
!function(){"use strict";function t(e){return(t=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(e)}function e(t,i){return(e=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,i)}function i(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function n(t,r,o){return(n=i()?Reflect.construct:function(t,i,n){var r=[null];r.push.apply(r,i);var o=new(Function.bind.apply(t,r));return n&&e(o,n.prototype),o}).apply(null,arguments)}function r(i){var o="function"==typeof Map?new Map:void 0;return(r=function(i){if(null===i||(r=i,-1===Function.toString.call(r).indexOf("[native code]")))return i;var r;if("function"!=typeof i)throw new TypeError("Super expression must either be null or a function");if(void 0!==o){if(o.has(i))return o.get(i);o.set(i,l)}function l(){return n(i,arguments,t(this).constructor)}return l.prototype=Object.create(i.prototype,{constructor:{value:l,enumerable:!1,writable:!0,configurable:!0}}),e(l,i)})(i)}function o(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}customElements.define("joomla-field-module-order",function(t){var i,n;function r(){var e;return(e=t.call(this)||this).linkedFieldSelector="",e.linkedFieldElement="",e.originalPosition="",e.writeDynaList.bind(o(e)),e.getNewOrder.bind(o(e)),e}n=t,(i=r).prototype=Object.create(n.prototype),i.prototype.constructor=i,e(i,n);var l=r.prototype;return l.connectedCallback=function(){if(this.linkedFieldSelector=this.getAttribute("data-linked-field")||"jform_position",!this.linkedFieldSelector)throw new Error("No linked field defined!");if(this.linkedFieldElement=document.getElementById(this.linkedFieldSelector),!this.linkedFieldElement)throw new Error("No linked field defined!");var t=this;this.originalPosition=this.linkedFieldElement.value,this.getNewOrder(this.originalPosition),this.linkedFieldElement.addEventListener("change",(function(){t.originalPosition=t.linkedFieldElement.value,t.getNewOrder(t.linkedFieldElement.value)}))},l.writeDynaList=function(t,e,i,n){var r=0,o=document.createElement("select");for(var l in this.hasAttribute("disabled")&&o.setAttribute("disabled",""),this.getAttribute("onchange")&&o.setAttribute("onchange",this.getAttribute("onchange")),this.getAttribute("size")&&o.setAttribute("size",this.getAttribute("size")),o.classList.add(t.itemClass),o.setAttribute("name",t.name),o.id=t.id,e)if(e.hasOwnProperty(l)){var a=document.createElement("option"),s=e[l];a.value=s[1],a.innerHTML=Joomla.sanitizeHtml(s[2]),(i&&n===s[1]||!i&&0===r)&&a.setAttribute("selected","selected"),o.appendChild(a),r+=1}this.innerHTML="",this.appendChild(o)},l.getNewOrder=function(t){var e=this.getAttribute("data-url"),i=this.getAttribute("data-client-id"),n=this.getAttribute("data-ordering"),r=this.getAttribute("data-name"),o=this.getAttribute("data-client-attr")?this.getAttribute("data-client-attr"):"form-select",l=""+this.getAttribute("data-id"),a=""+this.getAttribute("data-module-id"),s=[],u=this;Joomla.request({url:e+"&client_id="+i+"&position="+t+"&module_id="+a,method:"GET",perform:!0,headers:{"Content-Type":"application/x-www-form-urlencoded"},onSuccess:function(t){if(t){var e;try{e=JSON.parse(t)}catch(t){console.error(t)}if(e.data.length>0){for(var i=0;i<e.data.length;i+=1)s[i]=e.data[i].split(",");u.writeDynaList({name:r,id:l,itemClass:o},s,u.originalPosition,n)}}"object"==typeof t.messages&&null!==t.messages&&Joomla.renderMessages(t.messages)}})},r}(r(HTMLElement)))}();