1 line
No EOL
4 KiB
JavaScript
1 line
No EOL
4 KiB
JavaScript
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=5)}({5:function(e,t){function n(e){return function(e){if(Array.isArray(e))return r(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r(e,t)}(e)||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(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var o=function(e,t){var r=t.querySelectorAll('input[type="text"], textarea, input[type="checkbox"], input[type="hidden"]'),o=new FormData;return n(r).forEach((function(e){"checkbox"===e.getAttribute("type")?o.append(e.getAttribute("name"),e.checked):o.append(e.getAttribute("name"),e.value)})),new Promise((function(n,r){var c=new XMLHttpRequest;c.open("POST","".concat(e,"/admin/shaare")),c.onload=function(){200!==c.status?(alert("An error occurred. Return code: ".concat(c.status)),r()):(t.closest(".edit-link-container").remove(),n())},c.send(o)}))},c=function(e,t,n){null!=t&&0!==t.length||(window.location.href="".concat(e).concat(n))};!function(){var e=document.querySelector('input[name="js_base_path"]').value,t=function(){return document.querySelectorAll('form[name="linkform"]')},r=document.querySelectorAll('[name="cancel-batch-link"]');null!=r&&n(r).forEach((function(n){n.addEventListener("click",(function(n){n.preventDefault(),n.target.closest('form[name="linkform"]').remove(),c(e,t(),"/admin/add-shaare")}))}));var u=document.querySelectorAll('[name="save_edit"]');null!=u&&n(u).forEach((function(n){n.addEventListener("click",(function(n){n.preventDefault();var r=n.target.closest('form[name="linkform"]');o(e,r).then((function(){return c(e,t(),"/")}))}))}));var a=document.querySelectorAll('[name="save_edit_batch"]');null!=a&&n(a).forEach((function(r){r.addEventListener("click",(function(r){r.preventDefault();var c=n(t()),u=c.length,a=0,i=document.querySelector(".progressbar > div"),l=document.querySelector(".progressbar-current");document.querySelector(".dark-layer").style.display="block",document.querySelector(".progressbar-max").innerHTML=u,l.innerHTML=a;var f=[];c.forEach((function(t){f.push(o(e,t).then((function(){a+=1,i.style.width="".concat(100*a/u,"%"),l.innerHTML=a})))})),Promise.all(f).then((function(){window.location.href="".concat(e,"/")}))}))}));var i=document.querySelectorAll('[name="delete_link"]');null!=i&&n(i).forEach((function(n){n.addEventListener("click",(function(n){n.preventDefault();var r=n.target.closest('form[name="linkform"]');(function(e,t){return new Promise((function(n,r){var o=new XMLHttpRequest;o.open("GET","".concat(e.href,"&source=batch")),o.onload=function(){204!==o.status?(alert("An error occurred. Return code: ".concat(o.status)),r()):(t.closest(".edit-link-container").remove(),n())},o.send()}))})(n.target,r).then((function(){return c(e,t(),"/")}))}))}))}()}}); |