From c1ed3d64bc62d61de58a92b77f486178032fb0f2 Mon Sep 17 00:00:00 2001 From: Thomas Wilkerling Date: Thu, 29 Jun 2023 16:15:28 +0200 Subject: [PATCH] fix event cancellation on passive listeners --- dist/js/winbox.min.js | 24 ++++++++++++------------ dist/winbox.bundle.min.js | 26 +++++++++++++------------- package.json | 2 +- src/js/helper.js | 2 +- src/js/winbox.js | 2 +- 5 files changed, 28 insertions(+), 28 deletions(-) diff --git a/dist/js/winbox.min.js b/dist/js/winbox.min.js index 53751db..17af292 100644 --- a/dist/js/winbox.min.js +++ b/dist/js/winbox.min.js @@ -1,24 +1,24 @@ /** - * WinBox.js v0.2.71 + * WinBox.js v0.2.72 * Copyright 2022 Nextapps GmbH * Author: Thomas Wilkerling * Licence: Apache-2.0 * https://github.com/nextapps-de/winbox */ -(function(){'use strict';var e,aa=document.createElement("div");aa.innerHTML="
";function h(a,b,c,f){a&&a.addEventListener(b,c,f||!1)}function k(a,b,c){var f=window;f&&f.removeEventListener(a,b,c||!1)}function l(a){a.stopPropagation();a.cancelable&&a.preventDefault()}function r(a,b,c){c=""+c;a["_s_"+b]!==c&&(a.style.setProperty(b,c),a["_s_"+b]=c)};/* +(function(){'use strict';var e,aa=document.createElement("div");aa.innerHTML="
";function h(a,b,c,f){a&&a.addEventListener(b,c,f||!1)}function l(a,b,c){var f=window;f&&f.removeEventListener(a,b,c||!1)}function m(a,b){a.stopPropagation();b&&a.preventDefault()}function r(a,b,c){c=""+c;a["_s_"+b]!==c&&(a.style.setProperty(b,c),a["_s_"+b]=c)};/* self.max &&*/ var v=[],w=[],x={capture:!0,passive:!0},A,da=0,B=10,E,I,ea,J,O; -function P(a,b){if(!(this instanceof P))return new P(a);A||fa();if(a){if(b){var c=a;a=b}if("string"===typeof a)c=a;else{var f=a.id;var d=a.index;var m=a.root;var n=a.template;c=c||a.title;var t=a.icon;var K=a.mount;var Q=a.html;var g=a.url;var p=a.width;var q=a.height;var u=a.minwidth;var C=a.minheight;var y=a.maxwidth;var z=a.maxheight;var ba=a.autosize;var D=a.overflow;var F=a.min;var G=a.max;var H=a.hidden;var ca=a.modal;var W=a.x||(ca?"center":0);var X=a.y||(ca?"center":0);var L=a.top;var M=a.left; -var R=a.bottom;var S=a.right;var ha=a.background;var N=a.border;var T=a.header;var Y=a["class"];var ia=a.oncreate;var ma=a.onclose;var na=a.onfocus;var oa=a.onblur;var pa=a.onmove;var qa=a.onresize;var ra=a.onfullscreen;var sa=a.onmaximize;var ta=a.onminimize;var ua=a.onrestore;var va=a.onhide;var wa=a.onshow;var xa=a.onload}}this.g=(n||aa).cloneNode(!0);this.g.id=this.id=f||"winbox-"+ ++da;this.g.className="winbox"+(Y?" "+("string"===typeof Y?Y:Y.join(" ")):"")+(ca?" modal":"");this.g.winbox=this; +function P(a,b){if(!(this instanceof P))return new P(a);A||fa();if(a){if(b){var c=a;a=b}if("string"===typeof a)c=a;else{var f=a.id;var d=a.index;var n=a.root;var k=a.template;c=c||a.title;var t=a.icon;var K=a.mount;var Q=a.html;var g=a.url;var p=a.width;var q=a.height;var u=a.minwidth;var C=a.minheight;var y=a.maxwidth;var z=a.maxheight;var ba=a.autosize;var D=a.overflow;var F=a.min;var G=a.max;var H=a.hidden;var ca=a.modal;var W=a.x||(ca?"center":0);var X=a.y||(ca?"center":0);var L=a.top;var M=a.left; +var R=a.bottom;var S=a.right;var ha=a.background;var N=a.border;var T=a.header;var Y=a["class"];var ia=a.oncreate;var ma=a.onclose;var na=a.onfocus;var oa=a.onblur;var pa=a.onmove;var qa=a.onresize;var ra=a.onfullscreen;var sa=a.onmaximize;var ta=a.onminimize;var ua=a.onrestore;var va=a.onhide;var wa=a.onshow;var xa=a.onload}}this.g=(k||aa).cloneNode(!0);this.g.id=this.id=f||"winbox-"+ ++da;this.g.className="winbox"+(Y?" "+("string"===typeof Y?Y:Y.join(" ")):"")+(ca?" modal":"");this.g.winbox=this; this.window=this.g;this.body=this.g.getElementsByClassName("wb-body")[0];this.h=T||35;w.push(this);ha&&this.setBackground(ha);N?r(this.body,"margin",N+(isNaN(N)?"":"px")):N=0;T&&(b=this.g.getElementsByClassName("wb-header")[0],r(b,"height",T+"px"),r(b,"line-height",T+"px"),r(this.body,"top",T+"px"));c&&this.setTitle(c);t&&this.setIcon(t);K?this.mount(K):Q?this.body.innerHTML=Q:g&&this.setUrl(g,xa);L=L?U(L,O):0;R=R?U(R,O):0;M=M?U(M,J):0;S=S?U(S,J):0;c=J-M-S;t=O-L-R;y=y?U(y,c):c;z=z?U(z,t):t;u=u?U(u, -y):150;C=C?U(C,z):this.h;ba?((m||A).appendChild(this.body),p=Math.max(Math.min(this.body.clientWidth+2*N+1,y),u),q=Math.max(Math.min(this.body.clientHeight+this.h+N+1,z),C),this.g.appendChild(this.body)):(p=p?U(p,y):Math.max(y/2,u)|0,q=q?U(q,z):Math.max(z/2,C)|0);W=W?U(W,c,p):M;X=X?U(X,t,q):L;this.x=W;this.y=X;this.width=p;this.height=q;this.s=u;this.o=C;this.m=y;this.l=z;this.top=L;this.right=S;this.bottom=R;this.left=M;this.index=d;this.j=D;this.focused=this.hidden=this.full=this.max=this.min=!1; -this.onclose=ma;this.onfocus=na;this.onblur=oa;this.onmove=pa;this.onresize=qa;this.onfullscreen=ra;this.onmaximize=sa;this.onminimize=ta;this.onrestore=ua;this.onhide=va;this.onshow=wa;G?this.maximize():F?this.minimize():this.resize().move();if(H)this.hide();else if(this.focus(),d||0===d)this.index=d,r(this.g,"z-index",d),d>B&&(B=d);ja(this);(m||A).appendChild(this.g);ia&&ia.call(this,a)}P["new"]=function(a){return new P(a)};P.stack=function(){return w}; +y):150;C=C?U(C,z):this.h;ba?((n||A).appendChild(this.body),p=Math.max(Math.min(this.body.clientWidth+2*N+1,y),u),q=Math.max(Math.min(this.body.clientHeight+this.h+N+1,z),C),this.g.appendChild(this.body)):(p=p?U(p,y):Math.max(y/2,u)|0,q=q?U(q,z):Math.max(z/2,C)|0);W=W?U(W,c,p):M;X=X?U(X,t,q):L;this.x=W;this.y=X;this.width=p;this.height=q;this.s=u;this.o=C;this.m=y;this.l=z;this.top=L;this.right=S;this.bottom=R;this.left=M;this.index=d;this.j=D;this.focused=this.hidden=this.full=this.max=this.min=!1; +this.onclose=ma;this.onfocus=na;this.onblur=oa;this.onmove=pa;this.onresize=qa;this.onfullscreen=ra;this.onmaximize=sa;this.onminimize=ta;this.onrestore=ua;this.onhide=va;this.onshow=wa;G?this.maximize():F?this.minimize():this.resize().move();if(H)this.hide();else if(this.focus(),d||0===d)this.index=d,r(this.g,"z-index",d),d>B&&(B=d);ja(this);(n||A).appendChild(this.g);ia&&ia.call(this,a)}P["new"]=function(a){return new P(a)};P.stack=function(){return w}; function U(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|0:c));return a}function fa(){A=document.body;A[I="requestFullscreen"]||A[I="msRequestFullscreen"]||A[I="webkitRequestFullscreen"]||A[I="mozRequestFullscreen"]||(I="");ea=I&&I.replace("request","exit").replace("mozRequest","mozCancel").replace("Request","Exit");h(window,"resize",function(){ka();la()});ka()} -function ja(a){V(a,"drag");V(a,"n");V(a,"s");V(a,"w");V(a,"e");V(a,"nw");V(a,"ne");V(a,"se");V(a,"sw");h(a.g.getElementsByClassName("wb-min")[0],"click",function(b){l(b);a.min?a.restore().focus():a.minimize()});h(a.g.getElementsByClassName("wb-max")[0],"click",function(){a.max?a.restore().focus():a.maximize().focus()});I?h(a.g.getElementsByClassName("wb-full")[0],"click",function(){a.fullscreen()}):a.addClass("no-full");h(a.g.getElementsByClassName("wb-close")[0],"click",function(b){l(b);a.close()|| -(a=null)});h(a.g,"click",function(){a.focus()})}function Z(a){v.splice(v.indexOf(a),1);la();a.removeClass("min");a.min=!1;a.g.title=""}function la(){for(var a=v.length,b={},c={},f=0,d;fq){a.max?a.restore():a.maximize();return}}a.min||(A.classList.add("wb-lock"),(n=g.touches)&&(n=n[0])?(g=n,h(window,"touchmove",f,x),h(window,"touchend",d,x)):(h(window,"mousemove",f),h(window,"mouseup",d)),t=g.pageX,K=g.pageY)}function f(g){l(g);n&&(g=g.touches[0]);var p=g.pageX;g=g.pageY;var q=p-t,u=g-K,C=a.width,y=a.height,z=a.x,ba=a.y,D;if("drag"===b){a.x+=q;a.y+=u;var F=D= -1}else{if("e"===b||"se"===b||"ne"===b){a.width+=q;var G=1}else if("w"===b||"sw"===b||"nw"===b)a.x+=q,a.width-=q,F=G=1;if("s"===b||"se"===b||"sw"===b){a.height+=u;var H=1}else if("n"===b||"ne"===b||"nw"===b)a.y+=u,a.height-=u,D=H=1}G&&(a.width=Math.max(Math.min(a.width,a.m,J-a.x-a.right),a.s),G=a.width!==C);H&&(a.height=Math.max(Math.min(a.height,a.l,O-a.y-a.bottom),a.o),H=a.height!==y);(G||H)&&a.resize();F&&(a.max&&(a.x=(pJ/3*2?J-a.width-a.right:J/2-a.width/2)+q),a.x=Math.max(Math.min(a.x, -a.j?J-30:J-a.width-a.right),a.j?30-a.width:a.left),F=a.x!==z);D&&(a.max&&(a.y=a.top+u),a.y=Math.max(Math.min(a.y,a.j?O-a.h:O-a.height-a.bottom),a.top),D=a.y!==ba);if(F||D)a.max&&a.restore(),a.move();if(G||F)t=p;if(H||D)K=g}function d(g){l(g);A.classList.remove("wb-lock");n?(k("touchmove",f,x),k("touchend",d,x)):(k("mousemove",f),k("mouseup",d))}var m=a.g.getElementsByClassName("wb-"+b)[0];if(m){var n,t,K,Q=0;h(m,"mousedown",c);h(m,"touchstart",c,x)}} +function ja(a){V(a,"drag");V(a,"n");V(a,"s");V(a,"w");V(a,"e");V(a,"nw");V(a,"ne");V(a,"se");V(a,"sw");h(a.g.getElementsByClassName("wb-min")[0],"click",function(b){m(b);a.min?a.restore().focus():a.minimize()});h(a.g.getElementsByClassName("wb-max")[0],"click",function(){a.max?a.restore().focus():a.maximize().focus()});I?h(a.g.getElementsByClassName("wb-full")[0],"click",function(){a.fullscreen()}):a.addClass("no-full");h(a.g.getElementsByClassName("wb-close")[0],"click",function(b){m(b);a.close()|| +(a=null)});h(a.g,"click",function(){a.focus()})}function Z(a){v.splice(v.indexOf(a),1);la();a.removeClass("min");a.min=!1;a.g.title=""}function la(){for(var a=v.length,b={},c={},f=0,d;fq){a.max?a.restore():a.maximize();return}}a.min||(A.classList.add("wb-lock"),(k=g.touches)&&(k=k[0])?(g=k,h(window,"touchmove",f,x),h(window,"touchend",d,x)):(h(window,"mousemove",f),h(window,"mouseup",d)),t=g.pageX,K=g.pageY)}function f(g){m(g,!k);k&&(g=g.touches[0]);var p=g.pageX;g=g.pageY;var q=p-t,u=g-K,C=a.width,y=a.height,z=a.x,ba=a.y,D;if("drag"===b){a.x+=q;a.y+=u;var F= +D=1}else{if("e"===b||"se"===b||"ne"===b){a.width+=q;var G=1}else if("w"===b||"sw"===b||"nw"===b)a.x+=q,a.width-=q,F=G=1;if("s"===b||"se"===b||"sw"===b){a.height+=u;var H=1}else if("n"===b||"ne"===b||"nw"===b)a.y+=u,a.height-=u,D=H=1}G&&(a.width=Math.max(Math.min(a.width,a.m,J-a.x-a.right),a.s),G=a.width!==C);H&&(a.height=Math.max(Math.min(a.height,a.l,O-a.y-a.bottom),a.o),H=a.height!==y);(G||H)&&a.resize();F&&(a.max&&(a.x=(pJ/3*2?J-a.width-a.right:J/2-a.width/2)+q),a.x=Math.max(Math.min(a.x, +a.j?J-30:J-a.width-a.right),a.j?30-a.width:a.left),F=a.x!==z);D&&(a.max&&(a.y=a.top+u),a.y=Math.max(Math.min(a.y,a.j?O-a.h:O-a.height-a.bottom),a.top),D=a.y!==ba);if(F||D)a.max&&a.restore(),a.move();if(G||F)t=p;if(H||D)K=g}function d(g){m(g);A.classList.remove("wb-lock");k?(l("touchmove",f,x),l("touchend",d,x)):(l("mousemove",f),l("mouseup",d))}var n=a.g.getElementsByClassName("wb-"+b)[0];if(n){var k,t,K,Q=0;h(n,"mousedown",c);h(n,"touchstart",c,x)}} function ka(){var a=document.documentElement;J=a.clientWidth;O=a.clientHeight}e=P.prototype;e.mount=function(a){this.unmount();a.i||(a.i=a.parentNode);this.body.textContent="";this.body.appendChild(a);return this};e.unmount=function(a){var b=this.body.firstChild;if(b){var c=a||b.i;c&&c.appendChild(b);b.i=a}return this};e.setTitle=function(a){var b=this.g.getElementsByClassName("wb-title")[0];a=this.title=a;var c=b.firstChild;c?c.nodeValue=a:b.textContent=a;return this}; e.setIcon=function(a){var b=this.g.getElementsByClassName("wb-icon")[0];r(b,"background-image","url("+a+")");r(b,"display","inline-block");return this};e.setBackground=function(a){r(this.g,"background",a);return this};e.setUrl=function(a,b){var c=this.body.firstChild;c&&"iframe"===c.tagName.toLowerCase()?c.src=a:(this.body.innerHTML='',b&&(this.body.firstChild.onload=b));return this}; e.focus=function(a){if(!1===a)return this.blur();if(!this.focused){a=w.length;if(1.wb-body{position:relative;display:inline-block;visibility:hidden;contain:none}.wb-drag{height:100%;padding-left:10px;cursor:move}.wb-title{font-family:Arial,sans-serif;font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.wb-icon{display:none;width:20px;height:100%;margin:-1px 8px 0-3px;float:left;background-size:100%;background-position:center}.wb-e,.wb-w{width:10px;top:0}.wb-n,.wb-s{left:0;height:10px;position:absolute}.wb-n{top:-5px;right:0;cursor:n-resize;z-index:2}.wb-e{position:absolute;right:-5px;bottom:0;cursor:w-resize;z-index:2}.wb-s{bottom:-5px;right:0;cursor:n-resize;z-index:2}.wb-nw,.wb-sw,.wb-w{left:-5px}.wb-w{position:absolute;bottom:0;cursor:w-resize;z-index:2}.wb-ne,.wb-nw,.wb-sw{width:15px;height:15px;z-index:2;position:absolute}.wb-nw{top:-5px;cursor:nw-resize}.wb-ne,.wb-sw{cursor:ne-resize}.wb-ne{top:-5px;right:-5px}.wb-se,.wb-sw{bottom:-5px}.wb-se{position:absolute;right:-5px;width:15px;height:15px;cursor:nw-resize;z-index:2}.wb-control{float:right;height:100%;max-width:100%;text-align:center}.wb-control *{display:inline-block;width:30px;height:100%;max-width:100%;background-position:center;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,.wb-body .wb-hide,.wb-show,.winbox.hide,.winbox.min .wb-body>*,.winbox.min .wb-full,.winbox.min .wb-min,.winbox.modal .wb-full,.winbox.modal .wb-max,.winbox.modal .wb-min{display:none}.winbox.max .wb-drag,.winbox.min .wb-drag{cursor:default}.wb-min{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNiAyIj48cGF0aCBmaWxsPSIjZmZmIiBkPSJNOCAwaDdhMSAxIDAgMCAxIDAgMkgxYTEgMSAwIDAgMSAwLTJoN3oiLz48L3N2Zz4=);background-size:14px auto;background-position:center calc(50% + 6px)}.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;background-position:5px center}.wb-full{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHN0cm9rZT0iI2ZmZiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2Utd2lkdGg9IjIuNSIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNOCAzSDVhMiAyIDAgMCAwLTIgMnYzbTE4IDBWNWEyIDIgMCAwIDAtMi0yaC0zbTAgMThoM2EyIDIgMCAwIDAgMi0ydi0zTTMgMTZ2M2EyIDIgMCAwIDAgMiAyaDMiLz48L3N2Zz4=);background-size:16px auto}.winbox.max .wb-body~div,.winbox.min .wb-body~div,.winbox.modal .wb-body~div,.winbox.modal .wb-drag,body.wb-lock iframe{pointer-events:none}.winbox.max{box-shadow:none}.winbox.max .wb-body{margin:0!important}.winbox iframe{position:absolute;width:100%;height:100%;border:0}body.wb-lock .winbox{will-change:left,top,width,height;transition:none}.winbox.modal:before{content:'';position:absolute;top:0;left:0;right:0;bottom:0;background:inherit;border-radius:inherit}.winbox.modal:after{content:'';position:absolute;top:-50vh;left:-50vw;right:-50vw;bottom:-50vh;background:#0d1117;animation:wb-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}.wb-body .wb-show{display:revert}"; -var h=document.getElementsByTagName("head")[0];h.firstChild?h.insertBefore(aa,h.firstChild):h.appendChild(aa);var ba=document.createElement("div");ba.innerHTML="
";function k(a,b,c,f){a&&a.addEventListener(b,c,f||!1)}function l(a,b,c){var f=window;f&&f.removeEventListener(a,b,c||!1)}function r(a){a.stopPropagation();a.cancelable&&a.preventDefault()}function v(a,b,c){c=""+c;a["_s_"+b]!==c&&(a.style.setProperty(b,c),a["_s_"+b]=c)};/* +var h=document.getElementsByTagName("head")[0];h.firstChild?h.insertBefore(aa,h.firstChild):h.appendChild(aa);var ba=document.createElement("div");ba.innerHTML="
";function l(a,b,c,f){a&&a.addEventListener(b,c,f||!1)}function m(a,b,c){var f=window;f&&f.removeEventListener(a,b,c||!1)}function r(a,b){a.stopPropagation();b&&a.preventDefault()}function v(a,b,c){c=""+c;a["_s_"+b]!==c&&(a.style.setProperty(b,c),a["_s_"+b]=c)};/* self.max &&*/ var w=[],x=[],A={capture:!0,passive:!0},B,ca=0,E=10,I,J,fa,O,P; -function U(a,b){if(!(this instanceof U))return new U(a);B||ha();if(a){if(b){var c=a;a=b}if("string"===typeof a)c=a;else{var f=a.id;var d=a.index;var m=a.root;var n=a.template;c=c||a.title;var t=a.icon;var K=a.mount;var Q=a.html;var g=a.url;var p=a.width;var q=a.height;var u=a.minwidth;var C=a.minheight;var y=a.maxwidth;var z=a.maxheight;var da=a.autosize;var D=a.overflow;var F=a.min;var G=a.max;var H=a.hidden;var ea=a.modal;var X=a.x||(ea?"center":0);var Y=a.y||(ea?"center":0);var L=a.top;var M=a.left; -var R=a.bottom;var S=a.right;var ja=a.background;var N=a.border;var T=a.header;var Z=a["class"];var ka=a.oncreate;var oa=a.onclose;var pa=a.onfocus;var qa=a.onblur;var ra=a.onmove;var sa=a.onresize;var ta=a.onfullscreen;var ua=a.onmaximize;var va=a.onminimize;var wa=a.onrestore;var xa=a.onhide;var ya=a.onshow;var za=a.onload}}this.g=(n||ba).cloneNode(!0);this.g.id=this.id=f||"winbox-"+ ++ca;this.g.className="winbox"+(Z?" "+("string"===typeof Z?Z:Z.join(" ")):"")+(ea?" modal":"");this.g.winbox=this; +function U(a,b){if(!(this instanceof U))return new U(a);B||ha();if(a){if(b){var c=a;a=b}if("string"===typeof a)c=a;else{var f=a.id;var d=a.index;var n=a.root;var k=a.template;c=c||a.title;var t=a.icon;var K=a.mount;var Q=a.html;var g=a.url;var p=a.width;var q=a.height;var u=a.minwidth;var C=a.minheight;var y=a.maxwidth;var z=a.maxheight;var da=a.autosize;var D=a.overflow;var F=a.min;var G=a.max;var H=a.hidden;var ea=a.modal;var X=a.x||(ea?"center":0);var Y=a.y||(ea?"center":0);var L=a.top;var M=a.left; +var R=a.bottom;var S=a.right;var ja=a.background;var N=a.border;var T=a.header;var Z=a["class"];var ka=a.oncreate;var oa=a.onclose;var pa=a.onfocus;var qa=a.onblur;var ra=a.onmove;var sa=a.onresize;var ta=a.onfullscreen;var ua=a.onmaximize;var va=a.onminimize;var wa=a.onrestore;var xa=a.onhide;var ya=a.onshow;var za=a.onload}}this.g=(k||ba).cloneNode(!0);this.g.id=this.id=f||"winbox-"+ ++ca;this.g.className="winbox"+(Z?" "+("string"===typeof Z?Z:Z.join(" ")):"")+(ea?" modal":"");this.g.winbox=this; this.window=this.g;this.body=this.g.getElementsByClassName("wb-body")[0];this.h=T||35;x.push(this);ja&&this.setBackground(ja);N?v(this.body,"margin",N+(isNaN(N)?"":"px")):N=0;T&&(b=this.g.getElementsByClassName("wb-header")[0],v(b,"height",T+"px"),v(b,"line-height",T+"px"),v(this.body,"top",T+"px"));c&&this.setTitle(c);t&&this.setIcon(t);K?this.mount(K):Q?this.body.innerHTML=Q:g&&this.setUrl(g,za);L=L?V(L,P):0;R=R?V(R,P):0;M=M?V(M,O):0;S=S?V(S,O):0;c=O-M-S;t=P-L-R;y=y?V(y,c):c;z=z?V(z,t):t;u=u?V(u, -y):150;C=C?V(C,z):this.h;da?((m||B).appendChild(this.body),p=Math.max(Math.min(this.body.clientWidth+2*N+1,y),u),q=Math.max(Math.min(this.body.clientHeight+this.h+N+1,z),C),this.g.appendChild(this.body)):(p=p?V(p,y):Math.max(y/2,u)|0,q=q?V(q,z):Math.max(z/2,C)|0);X=X?V(X,c,p):M;Y=Y?V(Y,t,q):L;this.x=X;this.y=Y;this.width=p;this.height=q;this.s=u;this.o=C;this.m=y;this.l=z;this.top=L;this.right=S;this.bottom=R;this.left=M;this.index=d;this.j=D;this.focused=this.hidden=this.full=this.max=this.min=!1; -this.onclose=oa;this.onfocus=pa;this.onblur=qa;this.onmove=ra;this.onresize=sa;this.onfullscreen=ta;this.onmaximize=ua;this.onminimize=va;this.onrestore=wa;this.onhide=xa;this.onshow=ya;G?this.maximize():F?this.minimize():this.resize().move();if(H)this.hide();else if(this.focus(),d||0===d)this.index=d,v(this.g,"z-index",d),d>E&&(E=d);ia(this);(m||B).appendChild(this.g);ka&&ka.call(this,a)}U["new"]=function(a){return new U(a)};U.stack=function(){return x}; -function V(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|0:c));return a}function ha(){B=document.body;B[J="requestFullscreen"]||B[J="msRequestFullscreen"]||B[J="webkitRequestFullscreen"]||B[J="mozRequestFullscreen"]||(J="");fa=J&&J.replace("request","exit").replace("mozRequest","mozCancel").replace("Request","Exit");k(window,"resize",function(){la();ma()});la()} -function ia(a){W(a,"drag");W(a,"n");W(a,"s");W(a,"w");W(a,"e");W(a,"nw");W(a,"ne");W(a,"se");W(a,"sw");k(a.g.getElementsByClassName("wb-min")[0],"click",function(b){r(b);a.min?a.restore().focus():a.minimize()});k(a.g.getElementsByClassName("wb-max")[0],"click",function(){a.max?a.restore().focus():a.maximize().focus()});J?k(a.g.getElementsByClassName("wb-full")[0],"click",function(){a.fullscreen()}):a.addClass("no-full");k(a.g.getElementsByClassName("wb-close")[0],"click",function(b){r(b);a.close()|| -(a=null)});k(a.g,"click",function(){a.focus()})}function na(a){w.splice(w.indexOf(a),1);ma();a.removeClass("min");a.min=!1;a.g.title=""}function ma(){for(var a=w.length,b={},c={},f=0,d;fq){a.max?a.restore():a.maximize();return}}a.min||(B.classList.add("wb-lock"),(n=g.touches)&&(n=n[0])?(g=n,k(window,"touchmove",f,A),k(window,"touchend",d,A)):(k(window,"mousemove",f),k(window,"mouseup",d)),t=g.pageX,K=g.pageY)}function f(g){r(g);n&&(g=g.touches[0]);var p=g.pageX;g=g.pageY;var q=p-t,u=g-K,C=a.width,y=a.height,z=a.x,da=a.y,D;if("drag"===b){a.x+=q;a.y+=u;var F=D= -1}else{if("e"===b||"se"===b||"ne"===b){a.width+=q;var G=1}else if("w"===b||"sw"===b||"nw"===b)a.x+=q,a.width-=q,F=G=1;if("s"===b||"se"===b||"sw"===b){a.height+=u;var H=1}else if("n"===b||"ne"===b||"nw"===b)a.y+=u,a.height-=u,D=H=1}G&&(a.width=Math.max(Math.min(a.width,a.m,O-a.x-a.right),a.s),G=a.width!==C);H&&(a.height=Math.max(Math.min(a.height,a.l,P-a.y-a.bottom),a.o),H=a.height!==y);(G||H)&&a.resize();F&&(a.max&&(a.x=(pO/3*2?O-a.width-a.right:O/2-a.width/2)+q),a.x=Math.max(Math.min(a.x, -a.j?O-30:O-a.width-a.right),a.j?30-a.width:a.left),F=a.x!==z);D&&(a.max&&(a.y=a.top+u),a.y=Math.max(Math.min(a.y,a.j?P-a.h:P-a.height-a.bottom),a.top),D=a.y!==da);if(F||D)a.max&&a.restore(),a.move();if(G||F)t=p;if(H||D)K=g}function d(g){r(g);B.classList.remove("wb-lock");n?(l("touchmove",f,A),l("touchend",d,A)):(l("mousemove",f),l("mouseup",d))}var m=a.g.getElementsByClassName("wb-"+b)[0];if(m){var n,t,K,Q=0;k(m,"mousedown",c);k(m,"touchstart",c,A)}} +y):150;C=C?V(C,z):this.h;da?((n||B).appendChild(this.body),p=Math.max(Math.min(this.body.clientWidth+2*N+1,y),u),q=Math.max(Math.min(this.body.clientHeight+this.h+N+1,z),C),this.g.appendChild(this.body)):(p=p?V(p,y):Math.max(y/2,u)|0,q=q?V(q,z):Math.max(z/2,C)|0);X=X?V(X,c,p):M;Y=Y?V(Y,t,q):L;this.x=X;this.y=Y;this.width=p;this.height=q;this.s=u;this.o=C;this.m=y;this.l=z;this.top=L;this.right=S;this.bottom=R;this.left=M;this.index=d;this.j=D;this.focused=this.hidden=this.full=this.max=this.min=!1; +this.onclose=oa;this.onfocus=pa;this.onblur=qa;this.onmove=ra;this.onresize=sa;this.onfullscreen=ta;this.onmaximize=ua;this.onminimize=va;this.onrestore=wa;this.onhide=xa;this.onshow=ya;G?this.maximize():F?this.minimize():this.resize().move();if(H)this.hide();else if(this.focus(),d||0===d)this.index=d,v(this.g,"z-index",d),d>E&&(E=d);ia(this);(n||B).appendChild(this.g);ka&&ka.call(this,a)}U["new"]=function(a){return new U(a)};U.stack=function(){return x}; +function V(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|0:c));return a}function ha(){B=document.body;B[J="requestFullscreen"]||B[J="msRequestFullscreen"]||B[J="webkitRequestFullscreen"]||B[J="mozRequestFullscreen"]||(J="");fa=J&&J.replace("request","exit").replace("mozRequest","mozCancel").replace("Request","Exit");l(window,"resize",function(){la();ma()});la()} +function ia(a){W(a,"drag");W(a,"n");W(a,"s");W(a,"w");W(a,"e");W(a,"nw");W(a,"ne");W(a,"se");W(a,"sw");l(a.g.getElementsByClassName("wb-min")[0],"click",function(b){r(b);a.min?a.restore().focus():a.minimize()});l(a.g.getElementsByClassName("wb-max")[0],"click",function(){a.max?a.restore().focus():a.maximize().focus()});J?l(a.g.getElementsByClassName("wb-full")[0],"click",function(){a.fullscreen()}):a.addClass("no-full");l(a.g.getElementsByClassName("wb-close")[0],"click",function(b){r(b);a.close()|| +(a=null)});l(a.g,"click",function(){a.focus()})}function na(a){w.splice(w.indexOf(a),1);ma();a.removeClass("min");a.min=!1;a.g.title=""}function ma(){for(var a=w.length,b={},c={},f=0,d;fq){a.max?a.restore():a.maximize();return}}a.min||(B.classList.add("wb-lock"),(k=g.touches)&&(k=k[0])?(g=k,l(window,"touchmove",f,A),l(window,"touchend",d,A)):(l(window,"mousemove",f),l(window,"mouseup",d)),t=g.pageX,K=g.pageY)}function f(g){r(g,!k);k&&(g=g.touches[0]);var p=g.pageX;g=g.pageY;var q=p-t,u=g-K,C=a.width,y=a.height,z=a.x,da=a.y,D;if("drag"===b){a.x+=q;a.y+=u;var F= +D=1}else{if("e"===b||"se"===b||"ne"===b){a.width+=q;var G=1}else if("w"===b||"sw"===b||"nw"===b)a.x+=q,a.width-=q,F=G=1;if("s"===b||"se"===b||"sw"===b){a.height+=u;var H=1}else if("n"===b||"ne"===b||"nw"===b)a.y+=u,a.height-=u,D=H=1}G&&(a.width=Math.max(Math.min(a.width,a.m,O-a.x-a.right),a.s),G=a.width!==C);H&&(a.height=Math.max(Math.min(a.height,a.l,P-a.y-a.bottom),a.o),H=a.height!==y);(G||H)&&a.resize();F&&(a.max&&(a.x=(pO/3*2?O-a.width-a.right:O/2-a.width/2)+q),a.x=Math.max(Math.min(a.x, +a.j?O-30:O-a.width-a.right),a.j?30-a.width:a.left),F=a.x!==z);D&&(a.max&&(a.y=a.top+u),a.y=Math.max(Math.min(a.y,a.j?P-a.h:P-a.height-a.bottom),a.top),D=a.y!==da);if(F||D)a.max&&a.restore(),a.move();if(G||F)t=p;if(H||D)K=g}function d(g){r(g);B.classList.remove("wb-lock");k?(m("touchmove",f,A),m("touchend",d,A)):(m("mousemove",f),m("mouseup",d))}var n=a.g.getElementsByClassName("wb-"+b)[0];if(n){var k,t,K,Q=0;l(n,"mousedown",c);l(n,"touchstart",c,A)}} function la(){var a=document.documentElement;O=a.clientWidth;P=a.clientHeight}e=U.prototype;e.mount=function(a){this.unmount();a.i||(a.i=a.parentNode);this.body.textContent="";this.body.appendChild(a);return this};e.unmount=function(a){var b=this.body.firstChild;if(b){var c=a||b.i;c&&c.appendChild(b);b.i=a}return this};e.setTitle=function(a){var b=this.g.getElementsByClassName("wb-title")[0];a=this.title=a;var c=b.firstChild;c?c.nodeValue=a:b.textContent=a;return this}; e.setIcon=function(a){var b=this.g.getElementsByClassName("wb-icon")[0];v(b,"background-image","url("+a+")");v(b,"display","inline-block");return this};e.setBackground=function(a){v(this.g,"background",a);return this};e.setUrl=function(a,b){var c=this.body.firstChild;c&&"iframe"===c.tagName.toLowerCase()?c.src=a:(this.body.innerHTML='',b&&(this.body.firstChild.onload=b));return this}; e.focus=function(a){if(!1===a)return this.blur();if(!this.focused){a=x.length;if(1