ui-todolist.js 10.2 KB
Newer Older
JOE XMG's avatar
update  
JOE XMG committed
1
(()=>{var e={2584:e=>{e.exports=function(e,t){return Array.prototype.slice.call(e,t)}},8514:(e,t,n)=>{"use strict";var r=n(6115);e.exports=function(e,t,n){e&&r((function(){e.apply(n||null,t||[])}))}},5229:(e,t,n)=>{"use strict";var r=n(2584),o=n(8514);e.exports=function(e,t){var n=t||{},i={};return void 0===e&&(e={}),e.on=function(t,n){return i[t]?i[t].push(n):i[t]=[n],e},e.once=function(t,n){return n._once=!0,e.on(t,n),e},e.off=function(t,n){var r=arguments.length;if(1===r)delete i[t];else if(0===r)i={};else{var o=i[t];if(!o)return e;o.splice(o.indexOf(n),1)}return e},e.emit=function(){var t=r(arguments);return e.emitterSnapshot(t.shift()).apply(this,t)},e.emitterSnapshot=function(t){var u=(i[t]||[]).slice(0);return function(){var i=r(arguments),c=this||e;if("error"===t&&!1!==n.throws&&!u.length)throw 1===i.length?i[0]:i;return u.forEach((function(r){n.async?o(r,i,c):r.apply(c,i),r._once&&e.off(t,r)})),e}},e}},1808:(e,t,n)=>{"use strict";var r=n(9638),o=n(4874),i=n.g.document,u=function(e,t,n,r){return e.addEventListener(t,n,r)},c=function(e,t,n,r){return e.removeEventListener(t,n,r)},a=[];function l(e,t,n){var r=function(e,t,n){var r,o;for(r=0;r<a.length;r++)if((o=a[r]).element===e&&o.type===t&&o.fn===n)return r}(e,t,n);if(r){var o=a[r].wrapper;return a.splice(r,1),o}}n.g.addEventListener||(u=function(e,t,r){return e.attachEvent("on"+t,function(e,t,r){var o=l(e,t,r)||function(e,t,r){return function(t){var o=t||n.g.event;o.target=o.target||o.srcElement,o.preventDefault=o.preventDefault||function(){o.returnValue=!1},o.stopPropagation=o.stopPropagation||function(){o.cancelBubble=!0},o.which=o.which||o.keyCode,r.call(e,o)}}(e,0,r);return a.push({wrapper:o,element:e,type:t,fn:r}),o}(e,t,r))},c=function(e,t,n){var r=l(e,t,n);if(r)return e.detachEvent("on"+t,r)}),e.exports={add:u,remove:c,fabricate:function(e,t,n){var u=-1===o.indexOf(t)?new r(t,{detail:n}):function(){var e;i.createEvent?(e=i.createEvent("Event")).initEvent(t,!0,!0):i.createEventObject&&(e=i.createEventObject());return e}();e.dispatchEvent?e.dispatchEvent(u):e.fireEvent("on"+t,u)}}},4874:(e,t,n)=>{"use strict";var r=[],o="",i=/^on/;for(o in n.g)i.test(o)&&r.push(o.slice(2));e.exports=r},9638:(e,t,n)=>{var r=n.g.CustomEvent;e.exports=function(){try{var e=new r("cat",{detail:{foo:"bar"}});return"cat"===e.type&&"bar"===e.detail.foo}catch(e){}return!1}()?r:"undefined"!=typeof document&&"function"==typeof document.createEvent?function(e,t){var n=document.createEvent("CustomEvent");return t?n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail):n.initCustomEvent(e,!1,!1,void 0),n}:function(e,t){var n=document.createEventObject();return n.type=e,t?(n.bubbles=Boolean(t.bubbles),n.cancelable=Boolean(t.cancelable),n.detail=t.detail):(n.bubbles=!1,n.cancelable=!1,n.detail=void 0),n}},9425:e=>{"use strict";var t={};function n(e){var n=t[e];return n?n.lastIndex=0:t[e]=n=new RegExp("(?:^|\\s)"+e+"(?:\\s|$)","g"),n}e.exports={add:function(e,t){var r=e.className;r.length?n(t).test(r)||(e.className+=" "+t):e.className=t},rm:function(e,t){e.className=e.className.replace(n(t)," ").trim()}}},7137:(e,t,n)=>{"use strict";var r=n(5229),o=n(1808),i=n(9425),u=document,c=u.documentElement;function a(e,t,r,i){n.g.navigator.pointerEnabled?o[t](e,{mouseup:"pointerup",mousedown:"pointerdown",mousemove:"pointermove"}[r],i):n.g.navigator.msPointerEnabled?o[t](e,{mouseup:"MSPointerUp",mousedown:"MSPointerDown",mousemove:"MSPointerMove"}[r],i):(o[t](e,{mouseup:"touchend",mousedown:"touchstart",mousemove:"touchmove"}[r],i),o[t](e,r,i))}function l(e){if(void 0!==e.touches)return e.touches.length;if(void 0!==e.which&&0!==e.which)return e.which;if(void 0!==e.buttons)return e.buttons;var t=e.button;return void 0!==t?1&t?1:2&t?3:4&t?2:0:void 0}function f(e){var t=e.getBoundingClientRect();return{left:t.left+s("scrollLeft","pageXOffset"),top:t.top+s("scrollTop","pageYOffset")}}function s(e,t){return void 0!==n.g[t]?n.g[t]:c.clientHeight?c[e]:u.body[e]}function v(e,t,n){var r,o=(e=e||{}).className||"";return e.className+=" gu-hide",r=u.elementFromPoint(t,n),e.className=o,r}function d(){return!1}function m(){return!0}function p(e){return e.width||e.right-e.left}function g(e){return e.height||e.bottom-e.top}function h(e){return e.parentNode===u?null:e.parentNode}function b(e){return"INPUT"===e.tagName||"TEXTAREA"===e.tagName||"SELECT"===e.tagName||y(e)}function y(e){return!!e&&("false"!==e.contentEditable&&("true"===e.contentEditable||y(h(e))))}function E(e){return e.nextElementSibling||function(){var t=e;do{t=t.nextSibling}while(t&&1!==t.nodeType);return t}()}function w(e,t){var n=function(e){return e.targetTouches&&e.targetTouches.length?e.targetTouches[0]:e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:e}(t),r={pageX:"clientX",pageY:"clientY"};return e in r&&!(e in n)&&r[e]in n&&(e=r[e]),n[e]}e.exports=function(e,t){var n,s,y,S,x,C,O,T,N,X,P,Y=arguments.length;1===Y&&!1===Array.isArray(e)&&(t=e,e=[]);var B,I=null,M=t||{};void 0===M.moves&&(M.moves=m),void 0===M.accepts&&(M.accepts=m),void 0===M.invalid&&(M.invalid=$),void 0===M.containers&&(M.containers=e||[]),void 0===M.isContainer&&(M.isContainer=d),void 0===M.copy&&(M.copy=!1),void 0===M.copySortSource&&(M.copySortSource=!1),void 0===M.revertOnSpill&&(M.revertOnSpill=!1),void 0===M.removeOnSpill&&(M.removeOnSpill=!1),void 0===M.direction&&(M.direction="vertical"),void 0===M.ignoreInputTextSelection&&(M.ignoreInputTextSelection=!0),void 0===M.mirrorContainer&&(M.mirrorContainer=u.body);var j=r({containers:M.containers,start:H,end:q,cancel:Z,remove:W,destroy:F,canMove:z,dragging:!1});return!0===M.removeOnSpill&&j.on("over",oe).on("out",ie),L(),j;function D(e){return-1!==j.containers.indexOf(e)||M.isContainer(e)}function L(e){var t=e?"remove":"add";a(c,t,"mousedown",k),a(c,t,"mouseup",J)}function R(e){a(c,e?"remove":"add","mousemove",K)}function A(e){var t=e?"remove":"add";o[t](c,"selectstart",_),o[t](c,"click",_)}function F(){L(!0),J({})}function _(e){B&&e.preventDefault()}function k(e){if(C=e.clientX,O=e.clientY,!(1!==l(e)||e.metaKey||e.ctrlKey)){var t=e.target,n=U(t);n&&(B=n,R(),"mousedown"===e.type&&(b(t)?t.focus():e.preventDefault()))}}function K(e){if(B)if(0!==l(e)){if(!(void 0!==e.clientX&&Math.abs(e.clientX-C)<=(M.slideFactorX||0)&&void 0!==e.clientY&&Math.abs(e.clientY-O)<=(M.slideFactorY||0))){if(M.ignoreInputTextSelection){var t=w("clientX",e)||0,n=w("clientY",e)||0;if(b(u.elementFromPoint(t,n)))return}var r=B;R(!0),A(),q(),V(r);var o=f(y);S=w("pageX",e)-o.left,x=w("pageY",e)-o.top,i.add(X||y,"gu-transit"),ue(),re(e)}}else J({})}function U(e){if(!(j.dragging&&n||D(e))){for(var t=e;h(e)&&!1===D(h(e));){if(M.invalid(e,t))return;if(!(e=h(e)))return}var r=h(e);if(r)if(!M.invalid(e,t))if(M.moves(e,r,t,E(e)))return{item:e,source:r}}}function z(e){return!!U(e)}function H(e){var t=U(e);t&&V(t)}function V(e){fe(e.item,e.source)&&(X=e.item.cloneNode(!0),j.emit("cloned",X,e.item,"copy")),s=e.source,y=e.item,T=N=E(e.item),j.dragging=!0,j.emit("drag",y,s)}function $(){return!1}function q(){if(j.dragging){var e=X||y;Q(e,h(e))}}function G(){B=!1,R(!0),A(!0)}function J(e){if(G(),j.dragging){var t=X||y,r=w("clientX",e)||0,o=w("clientY",e)||0,i=ne(v(n,r,o),r,o);i&&(X&&M.copySortSource||!X||i!==s)?Q(t,i):M.removeOnSpill?W():Z()}}function Q(e,t){var n=h(e);X&&M.copySortSource&&t===s&&n.removeChild(y),te(t)?j.emit("cancel",e,s,s):j.emit("drop",e,t,s,N),ee()}function W(){if(j.dragging){var e=X||y,t=h(e);t&&t.removeChild(e),j.emit(X?"cancel":"remove",e,t,s),ee()}}function Z(e){if(j.dragging){var t=arguments.length>0?e:M.revertOnSpill,n=X||y,r=h(n),o=te(r);!1===o&&t&&(X?r&&r.removeChild(X):s.insertBefore(n,T)),o||t?j.emit("cancel",n,s,s):j.emit("drop",n,r,s,N),ee()}}function ee(){var e=X||y;G(),ce(),e&&i.rm(e,"gu-transit"),P&&clearTimeout(P),j.dragging=!1,I&&j.emit("out",e,I,s),j.emit("dragend",e),s=y=X=T=N=P=I=null}function te(e,t){var r;return r=void 0!==t?t:n?N:E(X||y),e===s&&r===T}function ne(e,t,n){for(var r=e;r&&!o();)r=h(r);return r;function o(){if(!1===D(r))return!1;var o=ae(r,e),i=le(r,o,t,n);return!!te(r,i)||M.accepts(y,r,s,i)}}function re(e){if(n){e.preventDefault();var t=w("clientX",e)||0,r=w("clientY",e)||0,o=t-S,i=r-x;n.style.left=o+"px",n.style.top=i+"px";var u=X||y,c=v(n,t,r),a=ne(c,t,r),l=null!==a&&a!==I;(l||null===a)&&(I&&p("out"),I=a,l&&p("over"));var f=h(u);if(a!==s||!X||M.copySortSource){var d,m=ae(a,c);if(null!==m)d=le(a,m,t,r);else{if(!0!==M.revertOnSpill||X)return void(X&&f&&f.removeChild(u));d=T,a=s}(null===d&&l||d!==u&&d!==E(u))&&(N=d,a.insertBefore(u,d),j.emit("shadow",u,a,s))}else f&&f.removeChild(u)}function p(e){j.emit(e,u,I,s)}}function oe(e){i.rm(e,"gu-hide")}function ie(e){j.dragging&&i.add(e,"gu-hide")}function ue(){if(!n){var e=y.getBoundingClientRect();(n=y.cloneNode(!0)).style.width=p(e)+"px",n.style.height=g(e)+"px",i.rm(n,"gu-transit"),i.add(n,"gu-mirror"),M.mirrorContainer.appendChild(n),a(c,"add","mousemove",re),i.add(M.mirrorContainer,"gu-unselectable"),j.emit("cloned",n,y,"mirror")}}function ce(){n&&(i.rm(M.mirrorContainer,"gu-unselectable"),a(c,"remove","mousemove",re),h(n).removeChild(n),n=null)}function ae(e,t){for(var n=t;n!==e&&h(n)!==e;)n=h(n);return n===c?null:n}function le(e,t,n,r){var o="horizontal"===M.direction;return t!==e?function(){var e=t.getBoundingClientRect();if(o)return i(n>e.left+p(e)/2);return i(r>e.top+g(e)/2)}():function(){var t,i,u,c=e.children.length;for(t=0;t<c;t++){if(i=e.children[t],u=i.getBoundingClientRect(),o&&u.left+u.width/2>n)return i;if(!o&&u.top+u.height/2>r)return i}return null}();function i(e){return e?E(t):t}}function fe(e,t){return"boolean"==typeof M.copy?M.copy:M.copy(e,t)}}},6115:e=>{var t;t="function"==typeof setImmediate?function(e){setImmediate(e)}:function(e){setTimeout(e,0)},e.exports=t}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";var e=n(7137),t=n.n(e);window.dragula=t(),t()([document.getElementById("widget-todo-list")],{moves:function(e,t,n){return n.classList.contains("cursor-move")}})})()})();