1 Star 0 Fork 444

川歌/LayX

forked from 百小僧/Layx 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
layx.min.js 46.19 KB
一键复制 编辑 原始数据 按行查看 历史
百小僧 提交于 2018-05-22 15:03 . v2.1.1
"use strict";!function(n,t){var r={version:"2.1.1",defaults:{id:"",icon:!0,title:"",width:800,height:600,minWidth:100,minHeight:100,position:"ct",storeStatus:!0,control:!0,style:"",controlStyle:"",bgColor:"#fff",shadow:!0,border:"1px solid #3baced",type:"html",frames:[],frameIndex:0,content:"",cloneElementContent:!0,url:"",useFrameTitle:!1,opacity:1,shadable:!1,loaddingText:"内容正在加载中,请稍后",stickMenu:!1,stickable:!0,minMenu:!0,minable:!0,maxMenu:!0,maxable:!0,closeMenu:!0,closable:!0,restorable:!0,resizable:!0,autodestroy:!1,autodestroyText:'<div style="padding: 0 8px; ">此窗口将在 <strong>{second}<\/strong> 秒内自动关闭.<\/div>',resizeLimit:{t:!1,r:!1,b:!1,l:!1,lt:!1,rt:!1,lb:!1,rb:!1},buttons:[],isPrompt:!1,movable:!0,moveLimit:{vertical:!1,horizontal:!1,leftOut:!0,rightOut:!0,topOut:!0,bottomOut:!0},focusable:!0,alwaysOnTop:!1,allowControlDbclick:!0,statusBar:!1,statusBarStyle:"",event:{onload:{before:function(){},after:function(){}},onmin:{before:function(){},after:function(){}},onmax:{before:function(){},after:function(){}},onrestore:{before:function(){},after:function(){}},ondestroy:{before:function(){},after:function(){}},onmove:{before:function(){},progress:function(){},after:function(){}},onresize:{before:function(){},progress:function(){},after:function(){}}}},defaultButtons:{label:"确定",callback:function(){}},defaultFrames:{id:"",title:"",type:"html",url:"",content:"",useFrameTitle:!1,cloneElementContent:!0},zIndex:1e7,windows:{},stickZIndex:2e7,create:function(n){var r=this,t=layxDeepClone({},r.defaults,n||{}),e={},ct,ft,nt,o,bt,kt,b,k,lt,at,hi,et,d,ot,vt,h,dt,tt,gt,st,ni,it,c,v,y,g,p,w,yt,vi,ht,yi,s,a,rt,ci,l,ti,ii,ri,ui,fi,ei,oi,si,ut,li,pt,wt,ai;if(!t.id){console.error("窗口id不能为空且唯一");return}if(ct=r.windows[t.id],ct)return ct.status==="min"&&r.restore(ct.id),r.flicker(t.id),ct;if(i.isArray(t.frames))for(s=0;s<t.frames.length;s++)if(t.frames[s]=layxDeepClone({},r.defaultFrames,t.frames[s]),!t.frames[s].id){console.error("窗口组窗口id不能为空且窗口组内唯一");return}if(i.isArray(t.buttons))for(s=0;s<t.buttons.length;s++)t.buttons[s]=layxDeepClone({},r.defaultButtons,t.buttons[s]);if(t.shadable===!0&&(ft=document.createElement("div"),ft.setAttribute("id","layx-"+t.id+"-shade"),ft.classList.add("layx-shade"),ft.style.zIndex=t.alwaysOnTop===!0?++r.stickZIndex:++r.zIndex,document.body.appendChild(ft),ft.onclick=function(n){n=n||window.event;r.flicker(t.id);n.stopPropagation()}),t.style&&(nt=document.getElementById("layx-style"),nt?nt.innerHTML+=t.style:(nt=document.createElement("style"),nt.setAttribute("id","layx-style"),nt.type="text/css",nt.innerHTML=t.style,document.getElementsByTagName("HEAD").item(0).appendChild(nt))),o=document.createElement("div"),o.setAttribute("id","layx-"+t.id),o.classList.add("layx-window"),o.classList.add("layx-flexbox"),t.shadow===!0&&(o.style.setProperty("box-shadow","1px 1px 24px rgba(0, 0, 0, .3)"),o.style.setProperty("-moz-box-shadow","1px 1px 24px rgba(0, 0, 0, .3)"),o.style.setProperty("-webkit-box-shadow","1px 1px 24px rgba(0, 0, 0, .3)")),bt=i.compileLayxWidthOrHeight("width",t.minWidth,r.defaults.minWidth),kt=i.compileLayxWidthOrHeight("height",t.minHeight,r.defaults.minHeight),b=i.compileLayxWidthOrHeight("width",t.width,r.defaults.width),k=i.compileLayxWidthOrHeight("height",t.height,r.defaults.height),hi=i.compileLayxPosition(b,k,t.position),lt=hi.top,at=hi.left,b=Math.max(b,bt),k=Math.max(k,kt),t.storeStatus===!0?(et=r.getStoreWindowAreaInfo(t.id),et?(b=et.width,k=et.height,lt=et.top,at=et.left):r.storeWindowAreaInfo(t.id,{width:b,height:k,top:lt,left:at})):r.removeStoreWindowAreaInfo(t.id),o.style.zIndex=t.alwaysOnTop===!0?++r.stickZIndex:++r.zIndex,o.style.width=b+"px",o.style.height=k+"px",o.style.minWidth=bt+"px",o.style.minHeight=kt+"px",o.style.top=lt+"px",o.style.left=at+"px",t.border!==!1&&o.style.setProperty("border",t.border===!0?"1px solid #3baced":t.border),o.style.backgroundColor=t.bgColor,o.style.opacity=i.isNumber(t.opacity)?t.opacity:1,(t.type==="html"||t.type==="group")&&(o.onclick=function(n){n=n||window.event;r.updateZIndex(t.id);n.stopPropagation()}),document.body.appendChild(o),e.id=t.id,e.title=t.title,e.windowId=o.getAttribute("id"),e.window=o,e.createDate=new Date,e.status="normal",e.type=t.type,e.buttons=t.buttons,e.frames=t.frames,e.useFrameTitle=t.useFrameTitle,e.cloneElementContent=t.cloneElementContent,e.storeStatus=t.storeStatus,e.groupCurrentId=i.isArray(t.frames)&&t.frames.length>0&&t.frames[t.frameIndex]?t.frames[t.frameIndex].id:null,e.area={width:b,height:k,minWidth:bt,minHeight:kt,top:lt,left:at},e.loaddingText=t.loaddingText,e.focusable=t.focusable,e.isStick=t.alwaysOnTop===!0,e.zIndex=t.alwaysOnTop===!0?r.stickZIndex:r.zIndex,e.movable=t.movable,e.moveLimit=t.moveLimit,e.resizable=t.resizable,e.resizeLimit=t.resizeLimit,e.stickable=t.stickable,e.minable=t.minable,e.maxable=t.maxable,e.restorable=t.restorable,e.closable=t.closable,e.event=t.event,t.control===!0){if(d=document.createElement("div"),d.classList.add("layx-control-bar"),d.classList.add("layx-flexbox"),t.controlStyle&&d.setAttribute("style",t.controlStyle),t.type==="group"&&d.classList.add("layx-type-group"),o.appendChild(d),t.icon!==!1&&(ot=document.createElement("div"),ot.classList.add("layx-left-bar"),ot.classList.add("layx-flexbox"),ot.classList.add("layx-flex-vertical"),d.appendChild(ot),vt=document.createElement("div"),vt.classList.add("layx-icon"),vt.classList.add("layx-window-icon"),vt.innerHTML=t.icon===!0?'<svg class="layx-iconfont" aria-hidden="true"><use xlink:href="#layx-icon-default-icon"><\/use><\/svg>':t.icon,ot.appendChild(vt)),h=document.createElement("div"),h.classList.add("layx-title"),h.classList.add("layx-flexauto"),h.classList.add("layx-flexbox"),t.type==="group"&&h.classList.add("layx-type-group"),t.allowControlDbclick===!0&&(h.ondblclick=function(n){n=n||window.event;t.restorable===!0&&r.restore(t.id);n.stopPropagation()}),t.movable===!0&&new f(h),d.appendChild(h),t.type!=="group")dt=document.createElement("label"),dt.innerHTML=t.title,h.setAttribute("title",dt.innerText),h.appendChild(dt);else if(i.isArray(t.frames))for(s=0;s<t.frames.length;s++)a=layxDeepClone({},r.defaultFrames,t.frames[s]),tt=document.createElement("div"),tt.setAttribute("data-frameId",a.id),tt.classList.add("layx-group-title"),s===t.frameIndex&&tt.setAttribute("data-enable","1"),tt.onclick=function(n){n=n||window.event;var i=o.querySelector(".layx-group-title[data-enable='1']");i!==this&&(i.removeAttribute("data-enable"),this.setAttribute("data-enable","1"),r._setGroupIndex(t.id,this));n.stopPropagation()},h.appendChild(tt),gt=document.createElement("label"),gt.innerHTML=a.title,tt.setAttribute("title",gt.innerText),tt.appendChild(gt);st=document.createElement("div");st.classList.add("layx-right-bar");st.classList.add("layx-flexbox");d.appendChild(st);ni=document.createElement("div");ni.classList.add("layx-custom-menus");ni.classList.add("layx-flexbox");st.appendChild(ni);(t.stickMenu===!0||t.minMenu===!0||t.maxMenu===!0||t.closeMenu===!0)&&(it=document.createElement("div"),it.classList.add("layx-inlay-menus"),it.classList.add("layx-flexbox"),st.appendChild(it),(t.stickMenu===!0||t.alwaysOnTop===!0&&t.stickMenu)&&(c=document.createElement("div"),c.classList.add("layx-icon"),c.classList.add("layx-flexbox"),c.classList.add("layx-flex-center"),c.classList.add("layx-stick-menu"),t.alwaysOnTop===!0?c.setAttribute("title","取消置顶"):c.setAttribute("title","置顶"),t.alwaysOnTop===!0&&c.setAttribute("data-enable","1"),c.innerHTML='<svg class="layx-iconfont" aria-hidden="true"><use xlink:href="#layx-icon-stick"><\/use><\/svg>',t.stickable===!0&&(c.onclick=function(n){n=n||window.event;r.stickToggle(t.id);n.stopPropagation()}),it.appendChild(c)),t.minMenu===!0&&(v=document.createElement("div"),v.classList.add("layx-icon"),v.classList.add("layx-flexbox"),v.classList.add("layx-flex-center"),v.classList.add("layx-min-menu"),v.setAttribute("title","最小化"),v.setAttribute("data-menu","min"),v.innerHTML='<svg class="layx-iconfont" aria-hidden="true"><use xlink:href="#layx-icon-min"><\/use><\/svg>',v.onclick=function(n){n=n||window.event;this.classList.contains("layx-restore-menu")?t.restorable===!0&&r.restore(t.id):t.minable===!0&&r.min(t.id);n.stopPropagation()},it.appendChild(v)),t.maxMenu===!0&&(y=document.createElement("div"),y.classList.add("layx-icon"),y.classList.add("layx-flexbox"),y.classList.add("layx-flex-center"),y.classList.add("layx-max-menu"),y.setAttribute("title","最大化"),y.setAttribute("data-menu","max"),y.innerHTML='<svg class="layx-iconfont" aria-hidden="true"><use xlink:href="#layx-icon-max"><\/use><\/svg>',y.onclick=function(n){n=n||window.event;this.classList.contains("layx-restore-menu")?t.restorable===!0&&r.restore(t.id):t.maxable===!0&&r.max(t.id);n.stopPropagation()},it.appendChild(y)),t.closeMenu===!0&&(g=document.createElement("div"),g.classList.add("layx-icon"),g.classList.add("layx-flexbox"),g.classList.add("layx-flex-center"),g.classList.add("layx-destroy-menu"),g.setAttribute("title","关闭"),g.innerHTML='<svg class="layx-iconfont" aria-hidden="true"><use xlink:href="#layx-icon-destroy"><\/use><\/svg>',g.onclick=function(n){n=n||window.event;t.closable===!0&&r.destroy(t.id);n.stopPropagation()},it.appendChild(g)))}p=document.createElement("div");p.classList.add("layx-main");p.classList.add("layx-flexauto");o.appendChild(p);w=document.createElement("div");w.classList.add("layx-content-shade");w.classList.add("layx-flexbox");w.classList.add("layx-flex-center");t.loaddingText!==!1&&(i.isDom(t.loaddingText)?w.appendChild(t.loaddingText):(w.innerHTML=t.loaddingText,yt=0,vi=setInterval(function(){var n,i;for(yt===5&&(yt=0),++yt,n="",i=0;i<yt;i++)n+=".";w.innerHTML=t.loaddingText+n},200)));p.appendChild(w);switch(t.type){case"html":default:if(i.isFunction(t.event.onload.before)&&(ht=t.event.onload.before(o,e),ht===!1))return;r.createHtmlBody(p,t,t.content);p.removeChild(w);i.isFunction(t.event.onload.after)&&t.event.onload.after(o,e);break;case"url":if(i.isFunction(t.event.onload.before)&&(ht=t.event.onload.before(o,e),ht===!1))return;r.createFrameBody(p,t,o,e);break;case"group":if(i.isArray(t.frames)){if(i.isFunction(t.event.onload.before)&&(ht=t.event.onload.before(o,e),ht===!1))return;for(yi=0,s=0;s<t.frames.length;s++)a=layxDeepClone({},r.defaultFrames,t.frames[s]),rt=document.createElement("div"),rt.classList.add("layx-group-main"),rt.setAttribute("data-frameId",a.id),s===t.frameIndex&&rt.setAttribute("data-enable","1"),p.appendChild(rt),a.type==="html"?(r.createHtmlBody(rt,t,a.content,"group",a),rt.setAttribute("data-complete","1"),ci=o.querySelectorAll(".layx-group-main[data-complete='1']"),ci.length===t.frames.length&&(p.removeChild(w),i.isFunction(t.event.onload.after)&&t.event.onload.after(o,e))):a.type==="url"&&r.createFrameBody(rt,t,o,e,"group",a)}}return t.resizable===!0&&(l=document.createElement("div"),l.classList.add("layx-resizes"),o.appendChild(l),t.resizeLimit.t===!1&&(ti=document.createElement("div"),ti.classList.add("layx-resize-top"),new u(ti,!0,!1,!0,!1),l.appendChild(ti)),t.resizeLimit.r===!1&&(ii=document.createElement("div"),ii.classList.add("layx-resize-right"),new u(ii,!1,!1,!1,!0),l.appendChild(ii)),t.resizeLimit.b===!1&&(ri=document.createElement("div"),ri.classList.add("layx-resize-bottom"),new u(ri,!1,!1,!0,!1),l.appendChild(ri)),t.resizeLimit.l===!1&&(ui=document.createElement("div"),ui.classList.add("layx-resize-left"),new u(ui,!1,!0,!1,!0),l.appendChild(ui)),t.resizeLimit.lt===!1&&(fi=document.createElement("div"),fi.classList.add("layx-resize-left-top"),new u(fi,!0,!0,!1,!1),l.appendChild(fi)),t.resizeLimit.rt===!1&&(ei=document.createElement("div"),ei.classList.add("layx-resize-right-top"),new u(ei,!0,!1,!1,!1),l.appendChild(ei)),t.resizeLimit.lb===!1&&(oi=document.createElement("div"),oi.classList.add("layx-resize-left-bottom"),new u(oi,!1,!0,!1,!1),l.appendChild(oi)),t.resizeLimit.rb===!1&&(si=document.createElement("div"),si.classList.add("layx-resize-right-bottom"),new u(si,!1,!1,!1,!1),l.appendChild(si))),t.statusBar&&(ut=document.createElement("div"),ut.classList.add("layx-statu-bar"),t.statusBarStyle&&ut.setAttribute("style",t.statusBarStyle),t.statusBar===!0&&i.isArray(t.buttons)?(li=r.createLayxButtons(t.buttons,t.id,t.isPrompt),ut.appendChild(li)):i.isDom(t.statusBar)?ut.appendChild(t.statusBar):ut.innerHTML=t.statusBar,o.appendChild(ut)),/(^[1-9]\d*$)/.test(t.autodestroy)&&(pt=t.autodestroy/1e3,t.autodestroyText!==!1&&(wt=document.createElement("div"),wt.classList.add("layx-auto-destroy-tip"),wt.innerHTML=t.autodestroyText.replace("{second}",pt),o.appendChild(wt)),ai=setInterval(function(){--pt;t.autodestroyText!==!1&&(wt.innerHTML=t.autodestroyText.replace("{second}",pt));pt<=0&&(clearInterval(ai),r.destroy(t.id))},1e3)),r.windows[t.id]=e,(b>window.innerWidth||k>window.innerHeight)&&r.max(t.id),e},removeStoreWindowAreaInfo:function(n){var r=this,t="layx-"+n,i=sessionStorage.getItem(t);i&&sessionStorage.removeItem(t)},storeWindowAreaInfo:function(n,t){var r=this,i="layx-"+n;sessionStorage.setItem(i,JSON.stringify(t))},getStoreWindowAreaInfo:function(n){var r=this,i="layx-"+n,t=sessionStorage.getItem(i);return t?JSON.parse(t):null},_setGroupIndex:function(n,t){var o=this,s="layx-"+n,i=document.getElementById(s),r=o.windows[n];if(i&&r&&r.type==="group"){var u=t.getAttribute("data-frameId"),f=i.querySelector(".layx-group-main[data-enable='1']"),e=i.querySelector(".layx-group-main[data-frameId='"+u+"']");e!==f&&(f.removeAttribute("data-enable"),e.setAttribute("data-enable","1"),r.groupCurrentId=u)}},setGroupIndex:function(n,t){var u=this,f="layx-"+n,i=document.getElementById(f),e=u.windows[n],r;i&&e&&(r=i.querySelector(".layx-group-title[data-frameId='"+t+"']"),r.click())},createHtmlBody:function(n,t,r,u,f){var e=document.createElement("div");e.classList.add("layx-html");e.setAttribute("id","layx-"+t.id+(u==="group"?"-"+f.id+"-":"-")+"html");i.isDom(r)?e.appendChild((u==="group"?f:t).cloneElementContent===!0?r.cloneNode(!0):r):e.innerHTML=r;n.appendChild(e)},createFrameBody:function(t,r,u,f,e,o){var c=this,s=document.createElement("iframe"),h;s.setAttribute("id","layx-"+r.id+(e==="group"?"-"+o.id+"-":"-")+"iframe");s.classList.add("layx-iframe");s.classList.add("layx-flexbox");s.setAttribute("allowtransparency","true");s.setAttribute("frameborder","0");s.setAttribute("scrolling","auto");s.setAttribute("allowfullscreen","");s.setAttribute("mozallowfullscreen","");s.setAttribute("webkitallowfullscreen","");s.src=(e==="group"?o.url:r.url)||"about:blank";h=r.title;s.attachEvent?s.attachEvent("onreadystatechange",function(){var l,a;if(s.readyState==="complete"||s.readyState=="loaded"){s.detachEvent("onreadystatechange",arguments.callee);try{e==="group"?o.useFrameTitle===!0&&(h=s.contentWindow.document.querySelector("title").innerText,c.setGroupTitle(r.id,o.id,h)):r.useFrameTitle===!0&&(h=s.contentWindow.document.querySelector("title").innerText,c.setTitle(r.id,h));r.focusable===!0&&(s.contentWindow.onclick=function(t){var r=this.self,u,f;t=t||s.contentWindow.event;r!==n&&r.frameElement&&r.frameElement.tagName==="IFRAME"&&(u=i.getNodeByClassName(r.frameElement,"layx-window",r),f=u.getAttribute("id").substr(5),c.updateZIndex(f));t.stopPropagation()})}catch(v){console.warn(v)}l=(e==="group"?this.parentNode.parentNode:this.parentNode).querySelector(".layx-content-shade");l&&(e==="group"?(t.setAttribute("data-complete","1"),a=u.querySelectorAll(".layx-group-main[data-complete='1']"),r.frames.length===a.length&&(l.parentNode.removeChild(l),i.isFunction(r.event.onload.after)&&r.event.onload.after(u,f))):(l.parentNode.removeChild(l),i.isFunction(r.event.onload.after)&&r.event.onload.after(u,f)))}}):s.addEventListener("load",function(){var l,a;this.removeEventListener("load",arguments.call,!1);try{e==="group"?o.useFrameTitle===!0&&(h=s.contentWindow.document.querySelector("title").innerText,c.setGroupTitle(r.id,o.id,h)):r.useFrameTitle===!0&&(h=s.contentWindow.document.querySelector("title").innerText,c.setTitle(r.id,h));r.focusable===!0&&(s.contentWindow.onclick=function(t){var r=this.self,u,f;t=t||s.contentWindow.event;r!==n&&r.frameElement&&r.frameElement.tagName==="IFRAME"&&(u=i.getNodeByClassName(r.frameElement,"layx-window",r),f=u.getAttribute("id").substr(5),c.updateZIndex(f));t.stopPropagation()})}catch(v){console.warn(v)}l=(e==="group"?this.parentNode.parentNode:this.parentNode).querySelector(".layx-content-shade");l&&(e==="group"?(t.setAttribute("data-complete","1"),a=u.querySelectorAll(".layx-group-main[data-complete='1']"),r.frames.length===a.length&&(l.parentNode.removeChild(l),i.isFunction(r.event.onload.after)&&r.event.onload.after(u,f))):(l.parentNode.removeChild(l),i.isFunction(r.event.onload.after)&&r.event.onload.after(u,f)))},!1);t.appendChild(s)},setContent:function(n,t){var o=this,s="layx-"+n,e=document.getElementById(s),f=o.windows[n],r,u;e&&f&&f.type==="html"&&(r=e.querySelector("#layx-"+n+"-html"),r&&(u=document.createElement("div"),u.classList.add("layx-content-shade"),u.classList.add("layx-flexbox"),u.classList.add("layx-flex-center"),r.parentNode.appendChild(u),i.isDom(t)?r.appendChild(f.cloneElementContent===!0?t.cloneNode(!0):t):r.innerHTML=t,r.parentNode.removeChild(u)))},getGroupFrame:function(n,t){for(var r={},i=0;i<n.length;i++)if(n[i].id===t){r=n[i];break}return r},reloadGroupFrame:function(n,t){var i=this,s="layx-"+n,f=document.getElementById(s),r=i.windows[n],e,u,o;f&&r&&r.type==="group"&&(e=i.getGroupFrame(r.frames,t),e.type==="url"&&(u=f.querySelector("#layx-"+n+"-"+t+"-iframe"),u&&(o=u.getAttribute("src"),i.setGroupUrl(n,t,o))))},setGroupContent:function(n,t,r){var s=this,c="layx-"+n,h=document.getElementById(c),o=s.windows[n],e,u,f;h&&o&&o.type==="group"&&(e=s.getGroupFrame(o.frames,t),e.type==="html"&&(u=h.querySelector("#layx-"+n+"-"+t+"-html"),u&&(f=document.createElement("div"),f.classList.add("layx-content-shade"),f.classList.add("layx-flexbox"),f.classList.add("layx-flex-center"),u.parentNode.parentNode.appendChild(f),i.isDom(r)?u.appendChild(e.cloneElementContent===!0?r.cloneNode(!0):r):u.innerHTML=r,e.content=r,u.parentNode.parentNode.removeChild(f))))},setUrl:function(n,t){var e,r,f,c;t=t||"about:blank";var s=this,h="layx-"+n,o=document.getElementById(h),u=s.windows[n];o&&u&&u.type==="url"&&(e=o.querySelector("#layx-"+n+"-iframe"),e&&(r=document.createElement("div"),r.classList.add("layx-content-shade"),r.classList.add("layx-flexbox"),r.classList.add("layx-flex-center"),u.loaddingText!==!1&&(i.isDom(u.loaddingText)?r.appendChild(u.loaddingText):(r.innerHTML=u.loaddingText,f=0,c=setInterval(function(){var n,t;for(f===5&&(f=0),++f,n="",t=0;t<f;t++)n+=".";r.innerHTML=u.loaddingText+n},200))),e.parentNode.appendChild(r),e.setAttribute("src",t)))},setGroupUrl:function(n,t,r){var c,e,f,o,a;r=r||"about:blank";var s=this,l="layx-"+n,h=document.getElementById(l),u=s.windows[n];h&&u&&u.type==="group"&&(c=s.getGroupFrame(u.frames,t),c.type==="url"&&(e=h.querySelector("#layx-"+n+"-"+t+"-iframe"),e&&(e.parentNode.removeAttribute("data-complete"),f=document.createElement("div"),f.classList.add("layx-content-shade"),f.classList.add("layx-flexbox"),f.classList.add("layx-flex-center"),u.loaddingText!==!1&&(i.isDom(u.loaddingText)?f.appendChild(u.loaddingText):(f.innerHTML=u.loaddingText,o=0,a=setInterval(function(){var n,t;for(o===5&&(o=0),++o,n="",t=0;t<o;t++)n+=".";f.innerHTML=u.loaddingText+n},200))),e.parentNode.parentNode.appendChild(f),e.setAttribute("src",r))))},setGroupTitle:function(n,t,i,r){var h=this,l="layx-"+n,e=document.getElementById(l),o=h.windows[n],u,s,c,f;if(e&&o&&o.type==="group"&&(u=e.querySelector(".layx-group-title[data-frameId='"+t+"']"),u)){if(s=h.getGroupFrame(o.frames,t),r===!0&&s.type==="url"){c=e.querySelector("#layx-"+n+"-"+t+"-iframe");try{i=c.contentDocument.querySelector("title").innerText}catch(a){}}f=u.querySelector("label");f&&(f.innerHTML=i,u.setAttribute("title",f.innerHTML),s.title=i)}},setTitle:function(n,t,i){var s=this,h="layx-"+n,f=document.getElementById(h),e=s.windows[n],r,o,u;if(f&&e&&(r=f.querySelector(".layx-title"),r)){if(i===!0&&e.type==="url"){o=f.querySelector("#layx-"+n+"-iframe");try{t=o.contentDocument.querySelector("title").innerText}catch(c){}}u=r.querySelector("label");u&&(u.innerHTML=t,r.setAttribute("title",u.innerHTML),e.title=t)}},stickToggle:function(n){var r=this,f="layx-"+n,u=document.getElementById(f),t=r.windows[n],i;u&&t&&(r.updateZIndex(n),t.isStick=!t.isStick,i=u.querySelector(".layx-stick-menu"),i&&(i.setAttribute("data-enable",t.isStick?"1":"0"),t.isStick?i.setAttribute("title","取消置顶"):i.setAttribute("title","置顶")),r.updateZIndex(n))},reloadFrame:function(n){var i=this,e="layx-"+n,r=document.getElementById(e),u=i.windows[n],t,f;r&&u&&u.type==="url"&&(t=r.querySelector("#layx-"+n+"-iframe"),t&&(f=t.getAttribute("src"),i.setUrl(n,f)))},restore:function(n){var e=this,c="layx-"+n,t=document.getElementById(c),r=e.windows[n],s,f,u,o,h;if(t&&r){if(r.restorable!==!0)return;if(e.updateZIndex(n),i.isFunction(r.event.onrestore.before)&&(s=r.event.onrestore.before(t,r),s===!1))return;f=r.area;r.status==="normal"?e.max(n):r.status==="max"&&(document.body.classList.contains("layx-body")&&document.body.classList.remove("layx-body"),t.style.top=f.top+"px",t.style.left=f.left+"px",t.style.width=f.width+"px",t.style.height=f.height+"px",r.status="normal",u=t.querySelector(".layx-restore-menu[data-menu='max']"),u&&(u.classList.remove("layx-restore-menu"),u.classList.add("layx-max-menu"),u.setAttribute("title","最大化"),u.innerHTML='<svg class="layx-iconfont" aria-hidden="true"><use xlink:href="#layx-icon-max"><\/use><\/svg>'),o=t.querySelector(".layx-resizes"),o&&o.removeAttribute("data-enable"));r.status==="min"&&(r.minBefore==="normal"?(t.style.top=f.top+"px",t.style.left=f.left+"px",t.style.width=f.width+"px",t.style.height=f.height+"px",r.status="normal",u=t.querySelector(".layx-restore-menu[data-menu='min']"),u&&(u.classList.remove("layx-restore-menu"),u.classList.add("layx-min-menu"),u.setAttribute("title","最小化"),u.innerHTML='<svg class="layx-iconfont" aria-hidden="true"><use xlink:href="#layx-icon-min"><\/use><\/svg>'),o=t.querySelector(".layx-resizes"),o&&o.removeAttribute("data-enable")):r.minBefore==="max"&&e.max(n),e.updateMinLayout());h=layxDeepClone({},r);delete e.windows[n];e.windows[n]=h;e.updateMinLayout();t.classList.contains("layx-min-statu")&&t.classList.remove("layx-min-statu");i.isFunction(r.event.onrestore.after)&&r.event.onrestore.after(t,r)}},min:function(n){var e=this,c="layx-"+n,r=document.getElementById(c),t=e.windows[n],l=i.innerArea(),s,u,o,f,h;if(r&&t){if(t.minable!==!0||t.status==="min")return;if(e.updateZIndex(n),i.isFunction(t.event.onmin.before)&&(s=t.event.onmin.before(r,t),s===!1))return;t.minBefore=t.status;t.status="min";u=r.querySelector(".layx-min-menu");u&&(u.classList.remove("layx-max-menu"),u.classList.add("layx-restore-menu"),u.setAttribute("title","恢复"),u.innerHTML='<svg class="layx-iconfont" aria-hidden="true"><use xlink:href="#layx-icon-restore"><\/use><\/svg>');o=r.querySelector(".layx-resizes");o&&o.setAttribute("data-enable","0");f=r.querySelector(".layx-restore-menu[data-menu='max']");f&&(f.classList.remove("layx-restore-menu"),f.classList.add("layx-max-menu"),f.setAttribute("title","最大化"),f.innerHTML='<svg class="layx-iconfont" aria-hidden="true"><use xlink:href="#layx-icon-max"><\/use><\/svg>');h=layxDeepClone({},t);delete e.windows[n];e.windows[n]=h;e.updateMinLayout();i.isFunction(t.event.onmin.after)&&t.event.onmin.after(r,t)}},updateZIndex:function(n){var t=this,f="layx-"+n,u=document.getElementById(f),i=t.windows[n],r;u&&i&&(r=document.getElementById("layx-"+n+"-shade"),r&&(r.style.zIndex=i.isStick===!0?++t.stickZIndex:++t.zIndex),i.zIndex=i.isStick===!0?++t.stickZIndex+1:++t.zIndex+1,u.style.zIndex=i.zIndex)},updateMinLayout:function(){var a=this,s=a.windows,h=i.innerArea(),t=10,r=240,u=0,c=Math.floor(h.width/(r+t)),f,l,n,e,o;for(f in s)l=s[f],n=document.getElementById("layx-"+f),n&&l.status==="min"&&(e=n.querySelector(".layx-control-bar"),e&&(o=e.offsetHeight,n.classList.add("layx-min-statu"),n.style.width=r+"px",n.style.height=o+"px",n.style.top=h.height-(Math.floor(u/c)+1)*(o+10)+"px",n.style.left=u%c*(r+t)+t+"px",u++))},max:function(n){var e=this,l="layx-"+n,t=document.getElementById(l),r=e.windows[n],s=i.innerArea(),h,u,o,f,c;if(t&&r){if(r.maxable!==!0||r.status==="max")return;if(e.updateZIndex(n),i.isFunction(r.event.onmax.before)&&(h=r.event.onmax.before(t,r),h===!1))return;document.body.classList.add("layx-body");t.style.top=0;t.style.left=0;t.style.width=s.width+"px";t.style.height=s.height+"px";r.status="max";u=t.querySelector(".layx-max-menu");u&&(u.classList.remove("layx-max-menu"),u.classList.add("layx-restore-menu"),u.setAttribute("title","恢复"),u.innerHTML='<svg class="layx-iconfont" aria-hidden="true"><use xlink:href="#layx-icon-restore"><\/use><\/svg>');o=t.querySelector(".layx-resizes");o&&o.setAttribute("data-enable","0");f=t.querySelector(".layx-restore-menu[data-menu='min']");f&&(f.classList.remove("layx-restore-menu"),f.classList.add("layx-min-menu"),f.setAttribute("title","最小化"),f.innerHTML='<svg class="layx-iconfont" aria-hidden="true"><use xlink:href="#layx-icon-min"><\/use><\/svg>');c=layxDeepClone({},r);delete e.windows[n];e.windows[n]=c;e.updateMinLayout();t.classList.contains("layx-min-statu")&&t.classList.remove("layx-min-statu");i.isFunction(r.event.onmax.after)&&r.event.onmax.after(t,r)}},destroy:function(n){var r=this,e="layx-"+n,u=document.getElementById(e),f=document.getElementById(e+"-shade"),t=r.windows[n],o,s;if(u&&t){if(r.updateZIndex(n),i.isFunction(t.event.ondestroy.before)&&(o=t.event.ondestroy.before(u,t),o===!1))return;if(t.closable!==!0)return;delete r.windows[n];u.parentNode.removeChild(u);f&&f.parentNode.removeChild(f);r.updateMinLayout();i.isFunction(t.event.ondestroy.after)&&t.event.ondestroy.after();for(s in t)delete t[s];t=undefined}},destroyAll:function(){var n=this;for(var t in r.windows)n.destroy(t)},flicker:function(n){var i=this,r,u="layx-"+n,t=document.getElementById(u),f=i.windows[n];t&&f&&(i.updateZIndex(n),t.classList.contains("layx-flicker")&&t.classList.remove("layx-flicker"),t.classList.add("layx-flicker"),r=setTimeout(function(){t.classList.remove("layx-flicker");clearTimeout(r)},960))},setPosition:function(n,t){var e=this,o="layx-"+n,f=document.getElementById(o),r=e.windows[n],u;f&&r&&(u=i.compileLayxPosition(r.area.width,r.area.height,t),r.area.left=u.left,r.area.top=u.top,f.style.left=u.left+"px",f.style.top=u.top+"px")},getFrameContext:function(n){var f=this,e="layx-"+n,i=document.getElementById(e),r=f.windows[n],u=null,t;if(i&&r&&r.type==="url"&&(t=i.querySelector(".layx-iframe"),t))try{u=t.contentWindow}catch(o){}return u},getParentContext:function(n){var i=this,t=i.getFrameContext(n);return t?t.parent:null},getGroupFrameContext:function(n,t){var u=this,s="layx-"+n,f=document.getElementById(s),i=u.windows[n],e=null,o,r;if(f&&i&&i.type==="group"&&(o=u.getGroupFrame(i.frames,t),o.type==="url"&&(r=f.querySelector("#layx-"+n+"-"+t+"-iframe"),r)))try{e=r.contentWindow}catch(h){}return e},createLayxButtons:function(n,t,r){var o=this,e=document.createElement("div"),f,u,s;for(e.classList.add("layx-buttons"),f=0;f<n.length;f++)u=document.createElement("button"),s=layxDeepClone({},o.defaultButtons,n[f]),u.classList.add("layx-button-item"),u.innerText=s.label,u.callback=n[f].callback,u.onclick=function(){if(i.isFunction(this.callback))if(r===!0){var n=o.getPromptTextArea(t);this.callback(t,(n?n.value:"").replace(/(^\s*)|(\s*$)/g,""),n)}else this.callback(t)},e.appendChild(u);return e},msg:function(n,t){var r=this;return r.create(layxDeepClone({},{id:"layx-msg-"+i.rndNum(8),type:"html",control:!1,content:"<div class='layx-msg layx-flexbox layx-flex-center' style='height:83px;width:100%;'>"+n+"<\/div>",autodestroy:5e3,width:320,height:85,minHeight:85,stickMenu:!1,minMenu:!1,maxMenu:!1,closeMenu:!1,alwaysOnTop:!0,resizable:!1,movable:!1,allowControlDbclick:!1,position:[10,"tc"],autodestroyText:!1,loaddingText:!1},t))},alert:function(n,t,u,f){var e=this;return e.create(layxDeepClone({},{id:"layx-alert-"+i.rndNum(8),title:n||"提示消息",icon:!1,type:"html",content:"<div class='layx-alert'>"+t+"<\/div>",width:352,height:157,minHeight:157,stickMenu:!1,minMenu:!1,minable:!1,maxMenu:!1,maxable:!1,alwaysOnTop:!0,resizable:!1,allowControlDbclick:!1,shadable:!0,statusBar:!0,buttons:[{label:"确定",callback:function(n){i.isFunction(u)?u(n):r.destroy(n)}}],position:"ct",loaddingText:!1},f))},confirm:function(n,t,u,f){var e=this;return e.create(layxDeepClone({},{id:"layx-confirm-"+i.rndNum(8),title:n||"询问消息",icon:!1,type:"html",content:"<div class='layx-confirm'>"+t+"<\/div>",width:352,height:157,minHeight:157,stickMenu:!1,minMenu:!1,minable:!1,maxMenu:!1,maxable:!1,alwaysOnTop:!0,resizable:!1,allowControlDbclick:!1,shadable:!0,buttons:[{label:"确定",callback:function(n){i.isFunction(u)&&u(n)}},{label:"取消",callback:function(n){r.destroy(n)}}],statusBar:!0,position:"ct",loaddingText:!1},f))},getPromptTextArea:function(n){var f=this,e="layx-"+n,r=document.getElementById(e),u=f.windows[n],t,i;return r&&u&&u.type==="html"&&(t=r.querySelector(".layx-prompt"),t&&(i=t.querySelector(".layx-textarea"),i))?i:null},prompt:function(n,t,u,f){var e=this;return e.create(layxDeepClone({},{id:"layx-prompt-"+i.rndNum(8),title:n||"请输入信息",icon:!1,type:"html",content:"<div class='layx-prompt'><label>"+t+"<\/label><textarea class='layx-textarea'><\/textarea><\/div>",width:352,height:200,minHeight:200,stickMenu:!1,minMenu:!1,minable:!1,maxMenu:!1,maxable:!1,alwaysOnTop:!0,resizable:!1,allowControlDbclick:!1,shadable:!0,statusBar:!0,isPrompt:!0,buttons:[{label:"确定",callback:function(n,t,r){r&&t.length===0?r.focus():i.isFunction(u)&&u(n,t,r)}},{label:"取消",callback:function(n){r.destroy(n)}}],position:"ct",loaddingText:!1},f))},load:function(n,t,r){var e=this,u=document.createElement("div");u.classList.add("layx-load");u.classList.add("layx-flexbox");u.classList.add("layx-flex-center");u.style.height="83px";u.style.width="100%";u.innerHTML=t;var f=0,o=setInterval(function(){var n,i;for(f===5&&(f=0),++f,n="",i=0;i<f;i++)n+=".";u.innerHTML=t+n},200);return e.create(layxDeepClone({},{id:n?n:"layx-load-"+i.rndNum(8),type:"html",control:!1,shadable:!0,content:u,cloneElementContent:!1,width:320,height:85,minHeight:85,stickMenu:!1,minMenu:!1,maxMenu:!1,closeMenu:!1,alwaysOnTop:!0,resizable:!1,movable:!1,allowControlDbclick:!1,position:"ct",loaddingText:!1},r))}},i={isBoolean:function(n){return typeof n=="boolean"},isString:function(n){return typeof n=="string"},isNumber:function(n){return typeof n=="number"},isArray:function(n){return Object.prototype.toString.call(n)=="[object Array]"},isFunction:function(n){return n&&Object.prototype.toString.call(n)==="[object Function]"},isDom:function(n){return!!(n&&typeof window!="undefined"&&(n===window||n.nodeType))},innerArea:function(){return{width:window.innerWidth,height:window.innerHeight}},compileLayxPosition:function(n,t,i){var f=this,u=f.innerArea(),r={top:0,left:0};if(f.isArray(i)&&i.length===2)r.top=f.isNumber(i[0])?i[0]:f.compileLayxPosition(n,t,i[0]).top,r.left=f.isNumber(i[1])?i[1]:f.compileLayxPosition(n,t,i[1]).left;else{i=["ct","lt","rt","lb","rb","lc","tc","rc","bc"].indexOf(i.toString())>-1?i.toString():"ct";switch(i){case"ct":r.top=(u.height-t)/2;r.left=(u.width-n)/2;break;case"lt":r.top=0;r.left=0;break;case"rt":r.top=0;r.left=u.width-n;break;case"lb":r.top=u.height-t;r.left=0;break;case"rb":r.top=u.height-t;r.left=u.width-n;break;case"lc":r.left=0;r.top=(u.height-t)/2;break;case"tc":r.top=0;r.left=(u.width-n)/2;break;case"rc":r.left=u.width-n;r.top=(u.height-t)/2;break;case"bc":r.top=u.height-t;r.left=(u.width-n)/2}}return r},rndNum:function(n){for(var t="",i=0;i<n;i++)t+=Math.floor(Math.random()*10);return t},compileLayxWidthOrHeight:function(n,t,i){var f=this,u=f.innerArea(),r;if(/(^[1-9]\d*$)/.test(t))return Number(t);if(/^(100|[1-9]?\d(\.\d\d?)?)%$/.test(t)){if(r=Number(t.toString().replace("%","")),n==="width")return u.width*(r/100);if(n==="height")return u.height*(r/100)}return i},getNodeByClassName:function(n,i,r){var u,f;return(r=r||t,u=this,n===r.document.body)?null:(f=n.classList,f.contains(i)?n:u.getNodeByClassName(n.parentNode,i))},getMousePosition:function(n){n=n||window.event;var t=document.documentElement.scrollLeft||document.body.scrollLeft,i=document.documentElement.scrollTop||document.body.scrollTop,r=n.pageX||n.clientX+t,u=n.pageY||n.clientY+i;return{x:r,y:u}}},u=function(n,f,e,o,s){u.isResizing=!1;u.isFirstResizing=!0;var h=function(t){var y,w;if(t=t||window.event,y=t.button||t.which,y==1&&t.shiftKey==!1){t.preventDefault();var p=i.getMousePosition(t),a=p.x-n.mouseStartCoord.x,v=p.y-n.mouseStartCoord.y,r=n.winform.area.top+v,h=n.winform.area.left+a,c=f?n.winform.area.height-v:n.winform.area.height+v,l=e?n.winform.area.width-a:n.winform.area.width+a;if(a!==0||v!==0){if(u.isResizing=!0,document.body.classList.add("layx-body"),u.isFirstResizing===!0&&(u.isFirstResizing=!1,i.isFunction(n.winform.event.onresize.before)&&(w=n.winform.event.onresize.before(n.layxWindow,n.winform),w===!1))){u.isResizing=!1;u.isFirstResizing=!0;document.onmouseup=null;document.onmousemove=null;return}l=Math.max(l,n.winform.area.minWidth);e?(h=Math.min(h,n.winform.area.left+n.winform.area.width-n.winform.area.minWidth),h=Math.max(0,h),l=Math.min(l,n.winform.area.left+n.winform.area.width)):(h=Math.min(h,n.winform.area.left),h=Math.max(n.winform.area.left,h),l=Math.min(l,n.innerArea.width-n.winform.area.left));c=Math.max(c,n.winform.area.minHeight);f?(r=Math.min(r,n.winform.area.top+n.winform.area.height-n.winform.area.minHeight),r=Math.max(0,r),c=Math.min(c,n.winform.area.top+n.winform.area.height)):(r=Math.min(r,n.winform.area.top),r=Math.max(n.winform.area.top,r),c=Math.min(c,n.innerArea.height-n.winform.area.top));s&&(n.layxWindow.style.width=l+"px",n.layxWindow.style.left=h+"px");o&&(n.layxWindow.style.top=r+"px",n.layxWindow.style.height=c+"px");s===!1&&o===!1&&(n.layxWindow.style.width=l+"px",n.layxWindow.style.left=h+"px",n.layxWindow.style.top=r+"px",n.layxWindow.style.height=c+"px");i.isFunction(n.winform.event.onresize.progress)&&n.winform.event.onresize.progress(n.layxWindow,n.winform)}}},c=function(t){var f,e;t=t||window.event;document.onmouseup=null;document.onmousemove=null;f=n.layxWindow.querySelector(".layx-mouse-preventDefault");f&&f.parentNode.removeChild(f);e=document.getElementById("layx-window-move");e&&e.parentNode.removeChild(e);u.isResizing===!0&&(u.isResizing=!1,u.isFirstResizing=!0,n.winform.area.top=n.layxWindow.offsetTop,n.winform.area.left=n.layxWindow.offsetLeft,n.winform.area.width=n.layxWindow.offsetWidth,n.winform.area.height=n.layxWindow.offsetHeight,r.storeWindowAreaInfo(n.winform.id,{top:n.winform.area.top,left:n.winform.area.left,width:n.winform.area.width,height:n.winform.area.height}),document.body.classList.contains("layx-body")&&document.body.classList.remove("layx-body"),i.isFunction(n.winform.event.onresize.after)&&n.winform.event.onresize.after(n.layxWindow,n.winform))},l=function(u){var f,l,e,o,v,s,a;return u=u||window.event,f=i.getNodeByClassName(n,"layx-window",t),f&&(l=f.getAttribute("id").substr(5),e=r.windows[l],e&&(e.status!=="min"&&e.resizable===!0?(o=document.getElementById("layx-window-move"),o||(o=document.createElement("div"),o.setAttribute("id","layx-window-move"),document.body.appendChild(o)),r.updateZIndex(l),o.style.zIndex=e.zIndex-1,v=i.getMousePosition(u),n.mouseStartCoord=v,n.layxWindow=f,n.winform=e,n.innerArea=i.innerArea(),s=f.querySelector(".layx-mouse-preventDefault"),s||(s=document.createElement("div"),s.classList.add("layx-mouse-preventDefault"),a=f.querySelector(".layx-main"),a&&a.appendChild(s)),document.onmouseup=c,document.onmousemove=h):r.restore(l))),!1};n.onmousedown=l},f=function(n){f.isMoveing=!1;f.isFirstMoveing=!0;var u=function(t){var s,l,u,o;if(t=t||window.event,s=t.button||t.which,s==1&&t.shiftKey==!1){t.preventDefault();var e=i.getMousePosition(t),h=e.x-n.mouseStartCoord.x,c=e.y-n.mouseStartCoord.y;if(h!==0||c!==0){if(f.isMoveing=!0,document.body.classList.add("layx-body"),f.isFirstMoveing===!0&&(f.isFirstMoveing=!1,i.isFunction(n.winform.event.onmove.before)&&(l=n.winform.event.onmove.before(n.layxWindow,n.winform),l===!1))){f.isMoveing=!1;f.isFirstMoveing=!0;document.onmouseup=null;document.onmousemove=null;return}u=n.winform.area.left+h;o=n.winform.area.top+c;n.winform.status==="max"&&n.winform.resizable===!0&&(e.x<n.winform.area.width/2?u=0:e.x>n.winform.area.width/2&&e.x<n.innerArea.width-n.winform.area.width?u=e.x-n.winform.area.width/2:n.innerArea.width-e.x<n.winform.area.width/2?u=n.innerArea.width-n.winform.area.width:n.innerArea.width-e.x>n.winform.area.width/2&&e.x>=n.innerArea.width-n.winform.area.width&&(u=e.x-n.winform.area.width/2),o=0,n.winform.area.top=0,n.winform.area.left=u,r.restore(n.winform.id));n.winform.moveLimit.horizontal===!0&&(u=n.winform.area.left);n.winform.moveLimit.vertical===!0&&(o=n.winform.area.top);n.winform.moveLimit.leftOut===!1&&(u=Math.max(u,0));n.winform.moveLimit.rightOut===!1&&(u=Math.min(u,n.innerArea.width-n.winform.area.width));n.winform.moveLimit.bottomOut===!1&&(o=Math.min(o,n.innerArea.height-n.winform.area.height));o=Math.max(o,0);o=Math.min(n.innerArea.height-15,o);n.layxWindow.style.left=u+"px";n.layxWindow.style.top=o+"px";i.isFunction(n.winform.event.onmove.progress)&&n.winform.event.onmove.progress(n.layxWindow,n.winform)}}},e=function(t){var u,e;t=t||window.event;document.onmouseup=null;document.onmousemove=null;u=n.layxWindow.querySelector(".layx-mouse-preventDefault");u&&u.parentNode.removeChild(u);e=document.getElementById("layx-window-move");e&&e.parentNode.removeChild(e);f.isMoveing===!0&&(f.isMoveing=!1,f.isFirstMoveing=!0,n.winform.area.top=n.layxWindow.offsetTop,n.winform.area.left=n.layxWindow.offsetLeft,r.storeWindowAreaInfo(n.winform.id,{top:n.winform.area.top,left:n.winform.area.left,width:n.winform.area.width,height:n.winform.area.height}),document.body.classList.contains("layx-body")&&document.body.classList.remove("layx-body"),n.winform.area.top===0&&n.winform.status==="normal"&&n.winform.maxable===!0&&n.winform.resizable===!0&&(n.winform.area.top=n.defaultArea.top,n.winform.area.left=n.defaultArea.left,r.storeWindowAreaInfo(n.winform.id,{top:n.winform.area.top,left:n.winform.area.left,width:n.winform.area.width,height:n.winform.area.height}),r.max(n.winform.id)),i.isFunction(n.winform.event.onmove.after)&&n.winform.event.onmove.after(n.layxWindow,n.winform))},o=function(f){var s,l,o,h,v,c,a;return f=f||window.event,s=i.getNodeByClassName(n,"layx-window",t),s&&(l=s.getAttribute("id").substr(5),o=r.windows[l],o&&(o.status!=="min"&&o.movable===!0?(h=document.getElementById("layx-window-move"),h||(h=document.createElement("div"),h.setAttribute("id","layx-window-move"),document.body.appendChild(h)),r.updateZIndex(l),h.style.zIndex=o.zIndex-1,v=i.getMousePosition(f),n.mouseStartCoord=v,n.layxWindow=s,n.winform=o,n.innerArea=i.innerArea(),n.defaultArea=layxDeepClone({},o.area),c=s.querySelector(".layx-mouse-preventDefault"),c||(c=document.createElement("div"),c.classList.add("layx-mouse-preventDefault"),a=s.querySelector(".layx-main"),a&&a.appendChild(c)),document.onmouseup=e,document.onmousemove=u):r.restore(l))),!1};n.onmousedown=o};t.layx={v:function(){return r.version}(),open:function(n){return r.create(n)},html:function(n,t,i,u){return r.create(layxDeepClone({},{id:n,title:t,type:"html",content:i},u||{}))},iframe:function(n,t,i,u){return r.create(layxDeepClone({},{id:n,title:t,type:"url",url:i},u||{}))},group:function(n,t,i,u){return r.create(layxDeepClone({},{id:n,type:"group",frames:t,frameIndex:typeof i=="number"?i>t.length?0:i:0},u||{}))},windows:function(){return r.windows},getWindow:function(n){return r.windows[n]},destroy:function(n){r.destroy(n)},min:function(n){r.min(n)},max:function(n){r.max(n)},setTitle:function(n,t,i){r.setTitle(n,t,i)},flicker:function(n){r.flicker(n)},restore:function(n){r.restore(n)},updateZIndex:function(n){r.updateZIndex(n)},updateMinLayout:function(){r.updateMinLayout()},stickToggle:function(n){r.stickToggle(n)},setPosition:function(n,t){r.setPosition(n,t)},getFrameContext:function(n){return r.getFrameContext(n)},getParentContext:function(n){return r.getParentContext(n)},setContent:function(n,t){r.setContent(n,t)},setUrl:function(n,t){r.setUrl(n,t)},setGroupContent:function(n,t,i){r.setGroupContent(n,t,i)},setGroupTitle:function(n,t,i,u){r.setGroupTitle(n,t,i,u)},setGroupUrl:function(n,t,i){r.setGroupUrl(n,t,i)},setGroupIndex:function(n,t){r.setGroupIndex(n,t)},getGroupFrameContext:function(n,t){return r.getGroupFrameContext(n,t)},destroyAll:function(){r.destroyAll()},msg:function(n,t){return r.msg(n,t)},alert:function(n,t,i,u){return r.alert(n,t,i,u)},confirm:function(n,t,i,u){return r.confirm(n,t,i,u)},getPromptTextArea:function(n){return r.getPromptTextArea(n)},prompt:function(n,t,i,u){return r.prompt(n,t,i,u)},load:function(n,t,i){return r.load(n,t,i)},multiLine:function(n){return n.toString().replace(/^[^\/]+\/\*!?\s?/,"").replace(/\*\/[^\/]+$/,"")},reloadFrame:function(n){r.reloadFrame(n)},reloadGroupFrame:function(n,t){r.reloadGroupFrame(n,t)}}}(top,window,self);!function(n){var i,r,t;t=function(n){return Object.prototype.toString.call(n)==="[object Object]"};r=function u(n,i){for(var r in n)if(n.hasOwnProperty(r))if(t(n[r])&&t(i[r])&&u(n[r],i[r]),i.hasOwnProperty(r))continue;else i[r]=n[r]};i=function(){var n=arguments,u={},i;if(!n.length)return{};for(i=n.length-1;i>=0;i--)t(n[i])&&r(n[i],u);return n[0]=u,u};n.layxDeepClone=i}(window);!function(n){function o(){var i,n;i=document.createElement("div");i.innerHTML=t;t=null;n=i.getElementsByTagName("svg")[0];n&&(n.setAttribute("aria-hidden","true"),n.style.position="absolute",n.style.width=0,n.style.height=0,n.style.overflow="hidden",e(n,document.body))}var t='<svg><symbol id="layx-icon-restore" viewBox="0 0 1157 1024"><path d="M1016.52185234 724.44050175L833.87364805 724.44050175 833.87364805 898.52098643 833.87364805 960.05279112 833.87364805 961.2211168 772.34184336 961.2211168 772.34184336 960.05279112 124.31068789 960.05279112 124.31068789 961.2211168 62.7788832 961.2211168 62.7788832 960.05279112 62.7788832 898.52098643 62.7788832 360.31241885 62.7788832 298.78061416 124.31068789 298.78061416 298.78061416 298.78061416 298.78061416 62.7788832 303.06447442 62.7788832 360.31241885 62.7788832 1016.52185234 62.7788832 1074.15923838 62.7788832 1078.05365615 62.7788832 1078.05365615 662.90869795 1078.05365615 724.44050175 1016.52185234 724.44050175ZM124.31068789 898.52098643L772.34184336 898.52098643 772.34184336 724.44050175 772.34184336 662.90869795 772.34184336 360.31241885 124.31068789 360.31241885 124.31068789 898.52098643ZM1016.52185234 124.31068789L360.31241885 124.31068789 360.31241885 298.78061416 772.34184336 298.78061416 833.87364805 298.78061416 833.87364805 360.31241885 833.87364805 662.90869795 1016.52185234 662.90869795 1016.52185234 124.31068789Z" ><\/path><\/symbol><symbol id="layx-icon-default-icon" viewBox="0 0 1024 1024"><path d="M891.88743395 61.93952995L132.11256605 61.93952995c-38.92547129 0-70.60411733 31.65534435-70.60411734 70.5924665L61.50844871 891.46800355c0 38.91382045 31.67864605 70.59246649 70.60411734 70.5924665l759.7748679 0c38.92547129 0 70.60411733-31.67864605 70.60411734-70.5924665L962.49155129 132.53199645C962.49155129 93.59487431 930.81290525 61.93952995 891.88743395 61.93952995zM844.02576498 142.29540409c16.71896178 0 30.25724302 13.54993209 30.25724302 30.26889386 0 16.70731093-13.53828125 30.25724302-30.25724302 30.25724303s-30.25724302-13.54993209-30.25724303-30.25724303C813.76852195 155.84533618 827.3068032 142.29540409 844.02576498 142.29540409zM735.60300658 142.29540409c16.71896178 0 30.25724302 13.54993209 30.25724302 30.26889386 0 16.70731093-13.53828125 30.25724302-30.25724302 30.25724303s-30.25724302-13.54993209-30.25724303-30.25724303C705.34576355 155.84533618 718.8840448 142.29540409 735.60300658 142.29540409zM881.80945351 881.37837227L142.19054649 881.37837227 142.19054649 277.92288427l739.60725618 0L881.79780267 881.37837227zM758.85809209 638.26020125l-0.01165084-180.19196018 90.09598008 90.09598008L758.85809209 638.26020125zM265.15355875 638.26020125l-90.09598008-90.0959801 90.08432924-90.08432924L265.15355875 638.26020125z" ><\/path><\/symbol><symbol id="layx-icon-min" viewBox="0 0 1024 1024"><path d="M65.23884 456.152041 958.760137 456.152041l0 111.695918L65.23884 567.847959 65.23884 456.152041z" ><\/path><\/symbol><symbol id="layx-icon-max" viewBox="0 0 1024 1024"><path d="M75.74912227 948.24738475L75.74912227 75.75145131l872.50059037 0 0 872.49593344L75.74912227 948.24738475zM839.18786674 184.81446115L184.81213326 184.81446115l0 654.37573462 654.37573461 0L839.18786674 184.81446115z" ><\/path><\/symbol><symbol id="layx-icon-destroy" viewBox="0 0 1024 1024"><path d="M933.89254819 139.71606348L884.23129279 90.08990363 511.96490363 462.39138834 140.40044113 90.82692583 90.84447403 140.34779656 462.40893653 511.91225907 90.10745181 884.2137446 139.73361166 933.875 512.03509637 561.53841892 883.59955887 933.10288141 933.15552597 883.58201068 561.59106347 512.01754819Z" ><\/path><\/symbol><symbol id="layx-icon-stick" viewBox="0 0 1024 1024"><path d="M863.92416068 184.3484319H160.07583932a50.27488011 50.27488011 0 0 1 0-100.5497602h703.84832136a50.27488011 50.27488011 0 0 1 0 100.5497602z m-50.27488007 804.39808157a50.22460522 50.22460522 0 0 1-35.69516489-14.57971521L512 708.21268254l-265.95411572 265.95411572A50.27488011 50.27488011 0 0 1 160.07583932 938.47163339V335.1730722a50.27488011 50.27488011 0 0 1 50.27488007-50.27488013h603.29856122a50.27488011 50.27488011 0 0 1 50.27488007 50.27488013v603.29856119a50.27488011 50.27488011 0 0 1-50.27488007 50.27488008z m-301.64928061-402.19904078a50.22460522 50.22460522 0 0 1 35.69516487 14.57971522L763.37440051 816.80642355V385.44795228H260.62559949v431.86122007l215.67923564-215.67923564A50.27488011 50.27488011 0 0 1 512 586.54747269z" ><\/path><\/symbol><\/svg>',i=function(){var n=document.getElementsByTagName("script");return n[n.length-1]}(),r=i.getAttribute("data-injectcss"),u=function(t){function r(n,t){var i=n.document,r=!1,u=function(){r||(r=!0,t())},f=function(){try{i.documentElement.doScroll("left")}catch(n){setTimeout(f,50);return}u()};f();i.onreadystatechange=function(){i.readyState=="complete"&&(i.onreadystatechange=null,u())}}if(document.addEventListener)if(~["complete","loaded","interactive"].indexOf(document.readyState))setTimeout(t,0);else{var i=function(){document.removeEventListener("DOMContentLoaded",i,!1);t()};document.addEventListener("DOMContentLoaded",i,!1)}else document.attachEvent&&r(n,t)},f=function(n,t){t.parentNode.insertBefore(n,t)},e=function(n,t){t.firstChild?f(n,t.firstChild):t.appendChild(n)};if(r&&!n.__iconfont__svg__cssinject__){n.__iconfont__svg__cssinject__=!0;try{document.write("<style>.svgfont {display: inline-block;width: 1em;height: 1em;fill: currentColor;vertical-align: -0.1em;font-size:16px;}<\/style>")}catch(s){console&&console.log(s)}}u(o)}(window);
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/chuange/LayX.git
git@gitee.com:chuange/LayX.git
chuange
LayX
LayX
master

搜索帮助