text: "use strict";!function(){function t(t){if(this.option=t,this.setting={modalsheet:!1,modalname:"#window-tool",startposition:"boxcenter",starttop:"middle",startleft:"center",drag:!0,modalresize:!0,clickhide:!1},Object.assign(this.setting,this.option),this.btn=document.querySelector(""+this.setting.btnname),this.resetsheet(),!0===this.setting.modalsheet||"true"===this.setting.modalsheet){this.oBox=document.querySelector(""+this.setting.modalname);try{this.oBox.style.position="absolute",this.oBox.style.display="none",this.oBox.success="success",console.log(this.oBox.success)}catch(t){this.resetsheet(),document.body.appendChild(this.oBox),this.oBox=document.querySelector("#window-tool")}}else document.body.appendChild(this.oBox),this.oBox=document.querySelector("#window-tool");this.init()}t.prototype.init=function(){var e=this;this.btn.onclick=function(t){(t=t||window.event).stopPropagation?t.stopPropagation():t.cancelBubble=!0,e.oBox.style.display="block",e.showbox()},0!=this.setting.modalresize&&"false"!=this.setting.modalresize&&(window.onresize=function(){e.showbox()}),this.oBox.onclick=function(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0},!0!==this.setting.clickhide&&"true"!==this.setting.clickhide||(document.onclick=function(){e.hidebox()}),this.oBox.onmouseover=function(){e.oBox.style.cursor="move"},"false"===this.setting.drag||!1===this.setting.drag||(this.oBox.onmousedown=function(t){t=t||window.event;e.mousedown(t),document.onmousemove=function(t){t=t||window.event;e.mousemove(t)}},document.onmouseup=function(){e.mouseup()})},t.prototype.resetsheet=function(){this.oBox=document.createElement("div"),this.oBox.id="window-tool",this.oBox.style.cssText="\n            max-width:1000px;\n            max-height:500px;\n            position:absolute;\n            background:#eee;\n            border:1px solid #ccc;\n            padding:40px;\n            display:none",this.resetcontent()},t.prototype.resetcontent=function(){this.bigbox=document.createElement("div"),this.title=document.createElement("p"),this.contentbox=document.createElement("div"),this.oBox.appendChild(this.bigbox),this.bigbox.appendChild(this.title),this.bigbox.appendChild(this.contentbox),this.title.style.cssText="\n                width:300px;\n                height:30px;\n                font-size:20px;\n                font-weight:900;\n                text-align:center;\n                line-height:30px;\n            ",this.title.innerHTML="标题",this.contentbox.innerHTML='\n                <p><label style="width:80px;display:inline-block;">用户名：</label><input type="text" name="username"></p>\n                <p><label style="width:80px;display:inline-block;">密码：</label><input type="password" name="password"></p>\n                <p style="display:inline-block;">\n                    <input style="width:149px;height:30px;font-size:16px;font-weight:900;line-height:30px;" type="button" value="登陆">\n                </p>\n                <p style="display:inline-block;">\n                    <input style="width:149px;height:30px;font-size:16px;font-weight:900;line-height:30px;" type="button" value="注册">\n                </p>\n            ',this.bigbox.onmousedown=function(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0},this.bigbox.onmouseover=function(t){this.style.cursor="auto",t.stopPropagation?t.stopPropagation():t.cancelBubble=!0}},t.prototype.showbox=function(){if(this.aligncenter=(document.documentElement.clientWidth-this.oBox.offsetWidth)/2+"px",this.alignright=document.documentElement.clientWidth-this.oBox.offsetWidth+"px",this.verticalmiddle=(document.documentElement.clientHeight-this.oBox.offsetHeight)/2+"px",this.verticalbottom=document.documentElement.clientHeight-this.oBox.offsetHeight+"px",this.setting.startleft||this.setting.starttop){if(isNaN(parseFloat(this.setting.starttop)))try{switch(this.setting.starttop){case"top":this.oBox.style.top=0;break;case"middle":this.oBox.style.top=this.verticalmiddle;break;case"bottom":this.oBox.style.top=this.verticalbottom;break;default:throw new Error("starttop's value is undefine")}}catch(t){console.log(t),this.oBox.style.top=this.verticalmiddle}else this.oBox.style.top=parseFloat(this.setting.starttop)+"px";if(isNaN(parseFloat(this.setting.startleft)))try{switch(this.setting.startleft){case"left":this.oBox.style.left=0;break;case"center":this.oBox.style.left=this.aligncenter;break;case"right":this.oBox.style.left=this.alignright;break;default:throw new Error("startleft's value is undefine")}}catch(t){console.log(t),this.oBox.style.left=this.aligncenter}else this.oBox.style.left=parseFloat(this.setting.startleft)+"px"}else"boxcenter"!==this.startposition&&this.setting.startleft&&this.setting.starttop||(this.oBox.style.top=this.verticalmiddle,this.oBox.style.left=this.aligncenter)},t.prototype.hidebox=function(){this.oBox.style.display="none"},t.prototype.mousedown=function(t){this.shortx=t.offsetX,this.shorty=t.offsetY},t.prototype.mousemove=function(t){this.oBox.style.top=t.clientY-this.shorty+"px",this.oBox.style.left=t.clientX-this.shortx+"px",this.oBox.offsetTop>=document.documentElement.clientHeight-this.oBox.offsetHeight?this.oBox.style.top=document.documentElement.clientHeight-this.oBox.offsetHeight+"px":this.oBox.offsetTop<=0&&(this.oBox.style.top=0),this.oBox.offsetLeft>=document.documentElement.clientWidth-this.oBox.offsetWidth?this.oBox.style.left=document.documentElement.clientWidth-this.oBox.offsetWidth+"px":this.oBox.offsetLeft<=0&&(this.oBox.style.left=0)},t.prototype.mouseup=function(){document.onmousemove=null,this.oBox.style.cursor="auto"},window.Modal=t}();