diff --git a/dist/js/winbox.min.js b/dist/js/winbox.min.js index 064adf4..27a42fb 100644 --- a/dist/js/winbox.min.js +++ b/dist/js/winbox.min.js @@ -5,19 +5,19 @@ * Licence: Apache-2.0 * https://github.com/nextapps-de/winbox */ -(function(){'use strict';var e,g=document.createElement("div");g.innerHTML="
";function p(a,b,c){a.addEventListener(b,c)}function r(a,b,c){a["_s_"+b]!==c&&(a.style.setProperty(b,c),a["_s_"+b]=c)}function t(a){a.preventDefault();a.stopImmediatePropagation()};var u=document.documentElement,v=[],w=0,x,z,A,B,C,D,K; -function L(a,b){if(!(this instanceof L))return new L(a);x||O();this.g=g.cloneNode(!0);this.body=this.g.getElementsByClassName("wb-body")[0];var c,h;if(a){if(b){var f=a;a=b}if("string"===typeof a)f=a;else{if(h=a.modal)var q=c="center";var E=a.id;var F=a.root;f=f||a.title;var d=a.mount;var G=a.html;var y=a.url;var k=a.width;var l=a.height;q=a.x||q;c=a.y||c;var H=a.max;var m=a.top;var n=a.left;var I=a.bottom;var J=a.right;x=a.index||x;var V=a.onclose;var W=a.onfocus;var X=a.onblur;var Y=a.onmove;var Z= -a.onresize;b=a.background;var N=a.border;var M=a["class"];b&&this.setBackground(b);N&&r(this.body,"margin",N+(isNaN(N)?"":"px"))}}this.setTitle(f||"");a=D;f=K;m=m?P(m,f):0;I=I?P(I,f):0;n=n?P(n,a):0;J=J?P(J,a):0;a-=n+J;f-=m+I;k=k?P(k,a):a/2|0;l=l?P(l,f):f/2|0;q=q?P(q,a,k):n;c=c?P(c,f,l):m;x=x||10;this.g.id=this.id=E||"winbox-"+ ++w;this.g.className="winbox"+(M?" "+("string"===typeof M?M:M.join(" ")):"")+(h?" modal":"");this.x=q;this.y=c;this.width=k;this.height=l;this.top=m;this.right=J;this.bottom= -I;this.left=n;this.max=this.min=!1;this.j=V;this.l=W;this.i=X;this.o=Y;this.m=Z;H?this.maximize().focus():this.move().resize().focus();d?this.mount(d):G?this.body.innerHTML=G:y&&this.setUrl(y);aa(this);(F||document.body).appendChild(this.g)}L["new"]=function(a){return new L(a)};function P(a,b,c){"string"===typeof a&&("center"===a?a=(b-c)/2|0:"right"===a||"bottom"===a?a=b-c:(c=parseFloat(a),a="%"===(""+c!==a&&a.substring((""+c).length))?b/100*c:c));return a} -function O(){var a=document.body;a[B="requestFullscreen"]||a[B="msRequestFullscreen"]||a[B="webkitRequestFullscreen"]||a[B="mozRequestFullscreen"]||(B="");C=B&&B.replace("request","exit").replace("mozRequest","mozCancel").replace("Request","Exit");p(window,"resize",function(){Q();R()});Q()} -function aa(a){S(a,"title");S(a,"n");S(a,"s");S(a,"w");S(a,"e");S(a,"nw");S(a,"ne");S(a,"se");S(a,"sw");p(a.g.getElementsByClassName("wb-min")[0],"click",function(b){Q();a.minimize();t(b)});p(a.g.getElementsByClassName("wb-max")[0],"click",function(b){Q();a.maximize();t(b)});B?p(a.g.getElementsByClassName("wb-full")[0],"click",function(b){a.fullscreen();t(b)}):a.addClass("no-full");p(a.g.getElementsByClassName("wb-close")[0],"click",function(b){a.close();a=null;t(b)});p(a.g,"mousedown",function(){a.focus()})} -function T(a){v.splice(v.indexOf(a),1);R();a.removeClass("min");a.min=!1;a.g.title=""}function R(){for(var a=v.length,b=0,c,h;b
";function p(a,b,c){a.addEventListener(b,c)}function r(a,b,c){a["_s_"+b]!==c&&(a.style.setProperty(b,c),a["_s_"+b]=c)};var t=document.documentElement,u=[],v=0,w,z,A,B,C,D,J; +function K(a,b){if(!(this instanceof K))return new K(a);w||N();this.g=g.cloneNode(!0);this.body=this.g.getElementsByClassName("wb-body")[0];var c,h;if(a){if(b){var f=a;a=b}if("string"===typeof a)f=a;else{if(h=a.modal)var q=c="center";var E=a.id;var F=a.root;f=f||a.title;var d=a.mount;var x=a.html;var y=a.url;var k=a.width;var l=a.height;q=a.x||q;c=a.y||c;var G=a.max;var m=a.top;var n=a.left;var H=a.bottom;var I=a.right;w=a.index||w;var U=a.onclose;var V=a.onfocus;var W=a.onblur;var X=a.onmove;var Y= +a.onresize;b=a.background;var M=a.border;var L=a["class"];b&&this.setBackground(b);M&&r(this.body,"margin",M+(isNaN(M)?"":"px"))}}this.setTitle(f||"");a=D;f=J;m=m?O(m,f):0;H=H?O(H,f):0;n=n?O(n,a):0;I=I?O(I,a):0;a-=n+I;f-=m+H;k=k?O(k,a):a/2|0;l=l?O(l,f):f/2|0;q=q?O(q,a,k):n;c=c?O(c,f,l):m;w=w||10;this.g.id=this.id=E||"winbox-"+ ++v;this.g.className="winbox"+(L?" "+("string"===typeof L?L:L.join(" ")):"")+(h?" modal":"");this.x=q;this.y=c;this.width=k;this.height=l;this.top=m;this.right=I;this.bottom= +H;this.left=n;this.max=this.min=!1;this.j=U;this.l=V;this.i=W;this.o=X;this.m=Y;G?this.maximize().focus():this.move().resize().focus();d?this.mount(d):x?this.body.innerHTML=x:y&&this.setUrl(y);P(this);(F||document.body).appendChild(this.g)}K["new"]=function(a){return new K(a)};function O(a,b,c){"string"===typeof a&&("center"===a?a=(b-c)/2|0:"right"===a||"bottom"===a?a=b-c:(c=parseFloat(a),a="%"===(""+c!==a&&a.substring((""+c).length))?b/100*c:c));return a} +function N(){var a=document.body;a[B="requestFullscreen"]||a[B="msRequestFullscreen"]||a[B="webkitRequestFullscreen"]||a[B="mozRequestFullscreen"]||(B="");C=B&&B.replace("request","exit").replace("mozRequest","mozCancel").replace("Request","Exit");p(window,"resize",function(){Q();R()});Q()} +function P(a){S(a,"title");S(a,"n");S(a,"s");S(a,"w");S(a,"e");S(a,"nw");S(a,"ne");S(a,"se");S(a,"sw");p(a.g.getElementsByClassName("wb-min")[0],"click",function(){Q();a.minimize()});p(a.g.getElementsByClassName("wb-max")[0],"click",function(){Q();a.maximize()});B?p(a.g.getElementsByClassName("wb-full")[0],"click",function(){a.fullscreen()}):a.addClass("no-full");p(a.g.getElementsByClassName("wb-close")[0],"click",function(){a.close();a=null});p(a.g,"mousedown",function(){a.focus()})} +function T(a){u.splice(u.indexOf(a),1);R();a.removeClass("min");a.min=!1;a.g.title=""}function R(){for(var a=u.length,b=0,c,h;b';return this}; -e.focus=function(){A!==this&&(r(this.g,"z-index",x++),this.addClass("focus"),A&&(A.removeClass("focus"),A.i&&A.i()),A=this,this.l&&this.l());return this};e.hide=function(){return this.addClass("hide")};e.show=function(){return this.removeClass("hide")};e.minimize=function(a){z&&U();!a&&this.min?(T(this),this.resize().move()):!1===a||this.min||(v.push(this),R(),this.g.title=this.title,this.addClass("min"),this.min=!0);this.max&&(this.removeClass("max"),this.max=!1);return this}; -e.maximize=function(a){if("undefined"===typeof a||a!==this.max)this.min&&T(this),(this.max=!this.max)?this.addClass("max").resize(D-this.left-this.right,K-this.top-this.bottom-1,!0).move(this.left,this.top,!0):this.resize().move().removeClass("max");return this};e.fullscreen=function(a){if("undefined"===typeof a||a!==z)this.min&&(this.resize().move(),T(this)),z&&U()||(this.body[B](),z=!0);return this}; -function U(){z=!1;if(document.fullscreen||document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement)return document[C](),!0}e.close=function(){this.min&&T(this);this.j&&this.j();this.unmount();this.g.parentNode.removeChild(this.g);A===this&&(A=null)}; -e.move=function(a,b,c){"undefined"===typeof a?(a=this.x,b=this.y):c||(this.x=a?a=P(a,D-this.left-this.right,this.width):0,this.y=b?b=P(b,K-this.top-this.bottom,this.height):0);r(this.g,"transform","translate("+a+"px,"+b+"px)");this.o&&this.o(a,b);return this}; -e.resize=function(a,b,c){"undefined"===typeof a?(a=this.width,b=this.height):c||(this.width=a?a=P(a,D-this.left-this.right):0,this.height=b?b=P(b,K-this.top-this.bottom):0);r(this.g,"width",a+"px");r(this.g,"height",b+"px");this.m&&this.m(a,b);return this};e.addClass=function(a){this.g.classList.add(a);return this};e.removeClass=function(a){this.g.classList.remove(a);return this};window.WinBox=L;}).call(this); +e.focus=function(){A!==this&&(r(this.g,"z-index",w++),this.addClass("focus"),A&&(A.removeClass("focus"),A.i&&A.i()),A=this,this.l&&this.l());return this};e.hide=function(){return this.addClass("hide")};e.show=function(){return this.removeClass("hide")};e.minimize=function(a){z&&Z();!a&&this.min?(T(this),this.resize().move()):!1===a||this.min||(u.push(this),R(),this.g.title=this.title,this.addClass("min"),this.min=!0);this.max&&(this.removeClass("max"),this.max=!1);return this}; +e.maximize=function(a){if("undefined"===typeof a||a!==this.max)this.min&&T(this),(this.max=!this.max)?this.addClass("max").resize(D-this.left-this.right,J-this.top-this.bottom-1,!0).move(this.left,this.top,!0):this.resize().move().removeClass("max");return this};e.fullscreen=function(a){if("undefined"===typeof a||a!==z)this.min&&(this.resize().move(),T(this)),z&&Z()||(this.body[B](),z=!0);return this}; +function Z(){z=!1;if(document.fullscreen||document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement)return document[C](),!0}e.close=function(){this.min&&T(this);this.j&&this.j();this.unmount();this.g.parentNode.removeChild(this.g);A===this&&(A=null)}; +e.move=function(a,b,c){"undefined"===typeof a?(a=this.x,b=this.y):c||(this.x=a?a=O(a,D-this.left-this.right,this.width):0,this.y=b?b=O(b,J-this.top-this.bottom,this.height):0);r(this.g,"transform","translate("+a+"px,"+b+"px)");this.o&&this.o(a,b);return this}; +e.resize=function(a,b,c){"undefined"===typeof a?(a=this.width,b=this.height):c||(this.width=a?a=O(a,D-this.left-this.right):0,this.height=b?b=O(b,J-this.top-this.bottom):0);r(this.g,"width",a+"px");r(this.g,"height",b+"px");this.m&&this.m(a,b);return this};e.addClass=function(a){this.g.classList.add(a);return this};e.removeClass=function(a){this.g.classList.remove(a);return this};window.WinBox=K;}).call(this); diff --git a/dist/winbox.bundle.js b/dist/winbox.bundle.js index 2e3aad1..d90b7d3 100644 --- a/dist/winbox.bundle.js +++ b/dist/winbox.bundle.js @@ -6,19 +6,19 @@ * https://github.com/nextapps-de/winbox */ (function(){'use strict';var e,g=document.createElement("style");g.innerHTML="@keyframes fade-in{0%{opacity:0}to{opacity:.85}}.wb-body,.wb-n{right:0;left:0}.winbox{position:fixed;left:0;top:0;background:#0050ff;box-shadow:0 14px 28px rgba(0,0,0,.25),0 10px 10px rgba(0,0,0,.22);transition:width .3s,height .3s,transform .3s;transition-timing-function:cubic-bezier(.3,1,.3,1);will-change:transform,width,height;contain:strict;text-align:left}.wb-header{position:absolute;left:0;top:0;width:100%;height:35px;color:#fff}.wb-e,.wb-nw,.wb-w{width:10px}.wb-n,.wb-nw,.wb-s,.winbox iframe{position:absolute;height:10px}.wb-body{position:absolute;top:35px;bottom:0;overflow:auto;-webkit-overflow-scrolling:touch;overflow-scrolling:touch;will-change:scroll-position;background:#fff;margin-top:0!important;box-sizing:border-box}.wb-title{font-size:14px;padding-left:10px;cursor:move;line-height:35px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.wb-n{top:-5px;cursor:n-resize}.wb-e{position:absolute;top:0;right:-5px;bottom:0;cursor:w-resize}.wb-s,.wb-se,.wb-sw{bottom:-5px}.wb-s{left:0;right:0;cursor:n-resize}.wb-w,.winbox.modal:before{position:absolute;top:0;bottom:0}.wb-nw,.wb-w{left:-5px;cursor:w-resize}.wb-nw{top:-5px;cursor:nw-resize}.wb-ne,.wb-sw{cursor:ne-resize;width:10px;height:10px;position:absolute}.wb-ne{top:-5px;right:-5px}.wb-sw{left:-5px}.wb-se{position:absolute;right:-5px;width:10px;height:10px;cursor:nw-resize}.wb-icon{float:right;height:35px;max-width:120%;padding:0 2px;text-align:center}.wb-icon *{display:inline-block;width:30px;height:100%;background-position:center;background-repeat:no-repeat;cursor:pointer}.no-close .wb-close,.no-full .wb-full,.no-header .wb-header,.no-max .wb-max,.no-min .wb-min,.no-resize .wb-body~div,.winbox.min .wb-full,.winbox.min .wb-min,.winbox.modal .wb-full,.winbox.modal .wb-max,.winbox.modal .wb-min{display:none}.wb-min{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNiAyIj48cGF0aCBmaWxsPSIjZmZmIiBkPSJNOCAwaDdhMSAxIDAgMCAxIDAgMkgxYTEgMSAwIDAgMSAwLTJoN3oiLz48L3N2Zz4=);background-size:14px auto;background-position:center bottom 11px}.wb-max{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9IiNmZmYiIHZpZXdCb3g9IjAgMCA5NiA5NiI+PHBhdGggZD0iTTIwIDcxLjMxMUMxNS4zNCA2OS42NyAxMiA2NS4yMyAxMiA2MFYyMGMwLTYuNjMgNS4zNy0xMiAxMi0xMmg0MGM1LjIzIDAgOS42NyAzLjM0IDExLjMxMSA4SDI0Yy0yLjIxIDAtNCAxLjc5LTQgNHY1MS4zMTF6Ii8+PHBhdGggZD0iTTkyIDc2VjM2YzAtNi42My01LjM3LTEyLTEyLTEySDQwYy02LjYzIDAtMTIgNS4zNy0xMiAxMnY0MGMwIDYuNjMgNS4zNyAxMiAxMiAxMmg0MGM2LjYzIDAgMTItNS4zNyAxMi0xMnptLTUyIDRjLTIuMjEgMC00LTEuNzktNC00VjM2YzAtMi4yMSAxLjc5LTQgNC00aDQwYzIuMjEgMCA0IDEuNzkgNCA0djQwYzAgMi4yMS0xLjc5IDQtNCA0SDQweiIvPjwvc3ZnPg==);background-size:17px auto}.wb-close{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9Ii0xIC0xIDE4IDE4Ij48cGF0aCBmaWxsPSIjZmZmIiBkPSJtMS42MTMuMjEuMDk0LjA4M0w4IDYuNTg1IDE0LjI5My4yOTNsLjA5NC0uMDgzYTEgMSAwIDAgMSAxLjQwMyAxLjQwM2wtLjA4My4wOTRMOS40MTUgOGw2LjI5MiA2LjI5M2ExIDEgMCAwIDEtMS4zMiAxLjQ5N2wtLjA5NC0uMDgzTDggOS40MTVsLTYuMjkzIDYuMjkyLS4wOTQuMDgzQTEgMSAwIDAgMSAuMjEgMTQuMzg3bC4wODMtLjA5NEw2LjU4NSA4IC4yOTMgMS43MDdBMSAxIDAgMCAxIDEuNjEzLjIxeiIvPjwvc3ZnPg==);background-size:15px auto}.wb-full{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2ZmZiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2Utd2lkdGg9IjIuNSIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNOCAzSDVhMiAyIDAgMCAwLTIgMnYzbTE4IDBWNWEyIDIgMCAwIDAtMi0yaC0zbTAgMThoM2EyIDIgMCAwIDAgMi0ydi0zTTMgMTZ2M2EyIDIgMCAwIDAgMiAyaDMiLz48L3N2Zz4=);background-size:16px auto}.winbox.max .wb-body~div,.winbox.max .wb-title,.winbox.min .wb-body~div,.winbox.modal .wb-body~div,.winbox.modal .wb-title{pointer-events:none}.winbox.min .wb-title{cursor:default}.winbox iframe{width:100%;height:100%;border:0}.winbox.modal{contain:layout size}.winbox.modal:before{content:'';left:0;right:0;background:inherit;border-radius:inherit}.winbox.modal:after{content:'';position:absolute;top:-100vh;left:-100vw;right:-100vw;bottom:-100vh;background:#0d1117;animation:fade-in .2s ease-out forwards;z-index:-1}.no-animation{transition:none}.no-shadow{box-shadow:none}.no-header .wb-body{top:0}.no-move:not(.min) .wb-title{pointer-events:none}"; -var p=document.getElementsByTagName("head")[0];p.firstChild?p.insertBefore(g,p.firstChild):p.appendChild(g);var r=document.createElement("div");r.innerHTML="
";function t(a,b,c){a.addEventListener(b,c)}function u(a,b,c){a["_s_"+b]!==c&&(a.style.setProperty(b,c),a["_s_"+b]=c)}function v(a){a.preventDefault();a.stopImmediatePropagation()};var w=document.documentElement,x=[],z=0,A,B,C,D,K,L,M; -function O(a,b){if(!(this instanceof O))return new O(a);A||Q();this.g=r.cloneNode(!0);this.body=this.g.getElementsByClassName("wb-body")[0];var c,h;if(a){if(b){var f=a;a=b}if("string"===typeof a)f=a;else{if(h=a.modal)var q=c="center";var E=a.id;var F=a.root;f=f||a.title;var d=a.mount;var G=a.html;var y=a.url;var k=a.width;var l=a.height;q=a.x||q;c=a.y||c;var H=a.max;var m=a.top;var n=a.left;var I=a.bottom;var J=a.right;A=a.index||A;var X=a.onclose;var Y=a.onfocus;var Z=a.onblur;var aa=a.onmove;var ba= -a.onresize;b=a.background;var P=a.border;var N=a["class"];b&&this.setBackground(b);P&&u(this.body,"margin",P+(isNaN(P)?"":"px"))}}this.setTitle(f||"");a=L;f=M;m=m?R(m,f):0;I=I?R(I,f):0;n=n?R(n,a):0;J=J?R(J,a):0;a-=n+J;f-=m+I;k=k?R(k,a):a/2|0;l=l?R(l,f):f/2|0;q=q?R(q,a,k):n;c=c?R(c,f,l):m;A=A||10;this.g.id=this.id=E||"winbox-"+ ++z;this.g.className="winbox"+(N?" "+("string"===typeof N?N:N.join(" ")):"")+(h?" modal":"");this.x=q;this.y=c;this.width=k;this.height=l;this.top=m;this.right=J;this.bottom= -I;this.left=n;this.max=this.min=!1;this.j=X;this.l=Y;this.i=Z;this.o=aa;this.m=ba;H?this.maximize().focus():this.move().resize().focus();d?this.mount(d):G?this.body.innerHTML=G:y&&this.setUrl(y);ca(this);(F||document.body).appendChild(this.g)}O["new"]=function(a){return new O(a)};function R(a,b,c){"string"===typeof a&&("center"===a?a=(b-c)/2|0:"right"===a||"bottom"===a?a=b-c:(c=parseFloat(a),a="%"===(""+c!==a&&a.substring((""+c).length))?b/100*c:c));return a} -function Q(){var a=document.body;a[D="requestFullscreen"]||a[D="msRequestFullscreen"]||a[D="webkitRequestFullscreen"]||a[D="mozRequestFullscreen"]||(D="");K=D&&D.replace("request","exit").replace("mozRequest","mozCancel").replace("Request","Exit");t(window,"resize",function(){S();T()});S()} -function ca(a){U(a,"title");U(a,"n");U(a,"s");U(a,"w");U(a,"e");U(a,"nw");U(a,"ne");U(a,"se");U(a,"sw");t(a.g.getElementsByClassName("wb-min")[0],"click",function(b){S();a.minimize();v(b)});t(a.g.getElementsByClassName("wb-max")[0],"click",function(b){S();a.maximize();v(b)});D?t(a.g.getElementsByClassName("wb-full")[0],"click",function(b){a.fullscreen();v(b)}):a.addClass("no-full");t(a.g.getElementsByClassName("wb-close")[0],"click",function(b){a.close();a=null;v(b)});t(a.g,"mousedown",function(){a.focus()})} -function V(a){x.splice(x.indexOf(a),1);T();a.removeClass("min");a.min=!1;a.g.title=""}function T(){for(var a=x.length,b=0,c,h;b
";function t(a,b,c){a.addEventListener(b,c)}function u(a,b,c){a["_s_"+b]!==c&&(a.style.setProperty(b,c),a["_s_"+b]=c)};var v=document.documentElement,w=[],z=0,A,B,C,D,J,K,L; +function N(a,b){if(!(this instanceof N))return new N(a);A||P();this.g=r.cloneNode(!0);this.body=this.g.getElementsByClassName("wb-body")[0];var c,h;if(a){if(b){var f=a;a=b}if("string"===typeof a)f=a;else{if(h=a.modal)var q=c="center";var E=a.id;var F=a.root;f=f||a.title;var d=a.mount;var x=a.html;var y=a.url;var k=a.width;var l=a.height;q=a.x||q;c=a.y||c;var G=a.max;var m=a.top;var n=a.left;var H=a.bottom;var I=a.right;A=a.index||A;var W=a.onclose;var X=a.onfocus;var Y=a.onblur;var Z=a.onmove;var aa= +a.onresize;b=a.background;var O=a.border;var M=a["class"];b&&this.setBackground(b);O&&u(this.body,"margin",O+(isNaN(O)?"":"px"))}}this.setTitle(f||"");a=K;f=L;m=m?Q(m,f):0;H=H?Q(H,f):0;n=n?Q(n,a):0;I=I?Q(I,a):0;a-=n+I;f-=m+H;k=k?Q(k,a):a/2|0;l=l?Q(l,f):f/2|0;q=q?Q(q,a,k):n;c=c?Q(c,f,l):m;A=A||10;this.g.id=this.id=E||"winbox-"+ ++z;this.g.className="winbox"+(M?" "+("string"===typeof M?M:M.join(" ")):"")+(h?" modal":"");this.x=q;this.y=c;this.width=k;this.height=l;this.top=m;this.right=I;this.bottom= +H;this.left=n;this.max=this.min=!1;this.j=W;this.l=X;this.i=Y;this.o=Z;this.m=aa;G?this.maximize().focus():this.move().resize().focus();d?this.mount(d):x?this.body.innerHTML=x:y&&this.setUrl(y);ba(this);(F||document.body).appendChild(this.g)}N["new"]=function(a){return new N(a)};function Q(a,b,c){"string"===typeof a&&("center"===a?a=(b-c)/2|0:"right"===a||"bottom"===a?a=b-c:(c=parseFloat(a),a="%"===(""+c!==a&&a.substring((""+c).length))?b/100*c:c));return a} +function P(){var a=document.body;a[D="requestFullscreen"]||a[D="msRequestFullscreen"]||a[D="webkitRequestFullscreen"]||a[D="mozRequestFullscreen"]||(D="");J=D&&D.replace("request","exit").replace("mozRequest","mozCancel").replace("Request","Exit");t(window,"resize",function(){R();S()});R()} +function ba(a){T(a,"title");T(a,"n");T(a,"s");T(a,"w");T(a,"e");T(a,"nw");T(a,"ne");T(a,"se");T(a,"sw");t(a.g.getElementsByClassName("wb-min")[0],"click",function(){R();a.minimize()});t(a.g.getElementsByClassName("wb-max")[0],"click",function(){R();a.maximize()});D?t(a.g.getElementsByClassName("wb-full")[0],"click",function(){a.fullscreen()}):a.addClass("no-full");t(a.g.getElementsByClassName("wb-close")[0],"click",function(){a.close();a=null});t(a.g,"mousedown",function(){a.focus()})} +function U(a){w.splice(w.indexOf(a),1);S();a.removeClass("min");a.min=!1;a.g.title=""}function S(){for(var a=w.length,b=0,c,h;b';return this}; -e.focus=function(){C!==this&&(u(this.g,"z-index",A++),this.addClass("focus"),C&&(C.removeClass("focus"),C.i&&C.i()),C=this,this.l&&this.l());return this};e.hide=function(){return this.addClass("hide")};e.show=function(){return this.removeClass("hide")};e.minimize=function(a){B&&W();!a&&this.min?(V(this),this.resize().move()):!1===a||this.min||(x.push(this),T(),this.g.title=this.title,this.addClass("min"),this.min=!0);this.max&&(this.removeClass("max"),this.max=!1);return this}; -e.maximize=function(a){if("undefined"===typeof a||a!==this.max)this.min&&V(this),(this.max=!this.max)?this.addClass("max").resize(L-this.left-this.right,M-this.top-this.bottom-1,!0).move(this.left,this.top,!0):this.resize().move().removeClass("max");return this};e.fullscreen=function(a){if("undefined"===typeof a||a!==B)this.min&&(this.resize().move(),V(this)),B&&W()||(this.body[D](),B=!0);return this}; -function W(){B=!1;if(document.fullscreen||document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement)return document[K](),!0}e.close=function(){this.min&&V(this);this.j&&this.j();this.unmount();this.g.parentNode.removeChild(this.g);C===this&&(C=null)}; -e.move=function(a,b,c){"undefined"===typeof a?(a=this.x,b=this.y):c||(this.x=a?a=R(a,L-this.left-this.right,this.width):0,this.y=b?b=R(b,M-this.top-this.bottom,this.height):0);u(this.g,"transform","translate("+a+"px,"+b+"px)");this.o&&this.o(a,b);return this}; -e.resize=function(a,b,c){"undefined"===typeof a?(a=this.width,b=this.height):c||(this.width=a?a=R(a,L-this.left-this.right):0,this.height=b?b=R(b,M-this.top-this.bottom):0);u(this.g,"width",a+"px");u(this.g,"height",b+"px");this.m&&this.m(a,b);return this};e.addClass=function(a){this.g.classList.add(a);return this};e.removeClass=function(a){this.g.classList.remove(a);return this};window.WinBox=O;}).call(this); +e.focus=function(){C!==this&&(u(this.g,"z-index",A++),this.addClass("focus"),C&&(C.removeClass("focus"),C.i&&C.i()),C=this,this.l&&this.l());return this};e.hide=function(){return this.addClass("hide")};e.show=function(){return this.removeClass("hide")};e.minimize=function(a){B&&V();!a&&this.min?(U(this),this.resize().move()):!1===a||this.min||(w.push(this),S(),this.g.title=this.title,this.addClass("min"),this.min=!0);this.max&&(this.removeClass("max"),this.max=!1);return this}; +e.maximize=function(a){if("undefined"===typeof a||a!==this.max)this.min&&U(this),(this.max=!this.max)?this.addClass("max").resize(K-this.left-this.right,L-this.top-this.bottom-1,!0).move(this.left,this.top,!0):this.resize().move().removeClass("max");return this};e.fullscreen=function(a){if("undefined"===typeof a||a!==B)this.min&&(this.resize().move(),U(this)),B&&V()||(this.body[D](),B=!0);return this}; +function V(){B=!1;if(document.fullscreen||document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement)return document[J](),!0}e.close=function(){this.min&&U(this);this.j&&this.j();this.unmount();this.g.parentNode.removeChild(this.g);C===this&&(C=null)}; +e.move=function(a,b,c){"undefined"===typeof a?(a=this.x,b=this.y):c||(this.x=a?a=Q(a,K-this.left-this.right,this.width):0,this.y=b?b=Q(b,L-this.top-this.bottom,this.height):0);u(this.g,"transform","translate("+a+"px,"+b+"px)");this.o&&this.o(a,b);return this}; +e.resize=function(a,b,c){"undefined"===typeof a?(a=this.width,b=this.height):c||(this.width=a?a=Q(a,K-this.left-this.right):0,this.height=b?b=Q(b,L-this.top-this.bottom):0);u(this.g,"width",a+"px");u(this.g,"height",b+"px");this.m&&this.m(a,b);return this};e.addClass=function(a){this.g.classList.add(a);return this};e.removeClass=function(a){this.g.classList.remove(a);return this};window.WinBox=N;}).call(this); diff --git a/src/js/helper.js b/src/js/helper.js index e2ef7b1..d825ede 100644 --- a/src/js/helper.js +++ b/src/js/helper.js @@ -1,8 +1,22 @@ +//const event_options = { "capture": true, "passive": false }; + +/** + * @param {Window|Element} node + * @param {string} event + * @param {Function} fn + */ + export function addListener(node, event, fn){ node.addEventListener(event, fn); } +/** + * @param {Window|Element} node + * @param {string} event + * @param {Function} fn + */ + export function removeListener(node, event, fn){ node.removeEventListener(event, fn); @@ -30,7 +44,8 @@ export function setText(node, value){ export function preventEvent(event){ event.preventDefault(); - event.stopImmediatePropagation(); + event.stopPropagation(); + //event.stopImmediatePropagation(); //event.returnValue = false; } diff --git a/src/js/winbox.js b/src/js/winbox.js index ecec98a..3385e77 100644 --- a/src/js/winbox.js +++ b/src/js/winbox.js @@ -286,14 +286,14 @@ function register(self){ init(); self.minimize(); - preventEvent(event); + //preventEvent(event); }); addListener(getByClass(self.dom, "wb-max"), "click", function(event){ init(); self.maximize(); - preventEvent(event); + //preventEvent(event); }); if(prefix_request){ @@ -301,7 +301,7 @@ function register(self){ addListener(getByClass(self.dom, "wb-full"), "click", function(event){ self.fullscreen(); - preventEvent(event); + //preventEvent(event); }); } else{ @@ -314,7 +314,7 @@ function register(self){ self.close(); self = null; - preventEvent(event); + //preventEvent(event); }); addListener(self.dom, "mousedown", function(event){ @@ -417,14 +417,12 @@ function addWindowListener(self, dir){ function handler_mousemove(event){ + //preventEvent(event); + if(event.touches){ event = event.touches[0] || event; } - else{ - - preventEvent(event); - } const pageX = event.pageX; const pageY = event.pageY; @@ -511,7 +509,7 @@ function addWindowListener(self, dir){ removeListener(window, "touchmove", handler_mousemove); removeListener(window, "touchend", handler_mouseup); - preventEvent(event); + //preventEvent(event); } }