shaarli_themes/morgan/js/pluginsadmin.min.js

1 line
1.7 KiB
JavaScript
Raw Normal View History

2025-01-26 11:52:28 +01:00
(()=>{function t(t){return function(t){if(Array.isArray(t))return r(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return r(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=Array(r);e<r;e++)n[e]=t[e];return n}function e(t,r){var e=t.getAttribute("data-line");t.setAttribute("data-order",r),document.querySelector('[name="order_'.concat(e,'"]')).setAttribute("value",r)}function n(t,r){var n=parseInt(t,10)+r,a=document.querySelectorAll('[data-order="'.concat(t,'"]')),o=document.querySelectorAll('[data-order="'.concat(n,'"]'));r>0&&(a=[].slice.call(a).reverse());for(var i=0;i<a.length;i+=1){var c=o[0].parentNode;e(a[i],n),e(o[i],parseInt(t,10));var u=r<0?o[0]:o[o.length-1].nextSibling;c.insertBefore(a[i],u)}}t(document.querySelectorAll(".order")).forEach((function(t){t.addEventListener("click",(function(t){var r;t.preventDefault(),t.target.classList.contains("order-up")?0!==(r=parseInt(t.target.parentNode.parentNode.getAttribute("data-order"),10))&&n(r,-1):t.target.classList.contains("order-down")&&function(t){t!==parseInt(document.querySelector("[data-order]:last-child").getAttribute("data-order"),10)&&n(t,1)}(parseInt(t.target.parentNode.parentNode.getAttribute("data-order"),10))}))}))})();