bkjxxxw/WebContent/static/simpleboot3/public/source/jquery.artDialog.min.js

10 lines
9.1 KiB
JavaScript
Raw Normal View History

2024-03-18 10:04:33 +08:00
/*!
* artDialog 5.0.3
* Date: 2013-02-20
* https://github.com/aui/artDialog
* (c) 2009-2013 TangBin, http://www.planeArt.cn
*
* This is licensed under the GNU LGPL, version 2.1 or later.
* For details, see: http://creativecommons.org/licenses/LGPL/2.1/
*/
(function(e,t,n){function h(e){var t=c.focus;t&&t._isLock&&!t.dom.wrap[0].contains(e.target)&&(e.stopPropagation(),t.focus())}if(document.compatMode==="BackCompat")throw new Error("artDialog: Document types require more than xhtml1.0");var r,i=0,s=document.activeElement,o=e(document.getElementsByTagName("html")[0]),u="artDialog"+ +(new Date),a=t.VBArray&&!t.XMLHttpRequest,f="createTouch"in document&&!("onmousemove"in document)||/(iPhone|iPad|iPod)/i.test(navigator.userAgent),l=!a&&!f,c=function(e,t,o){e=e||{};if(typeof e=="string"||e.nodeType===1)e={content:e,fixed:!f};var a,h=c.defaults,p=e.follow=this.nodeType===1&&this||e.follow;for(var d in h)e[d]===n&&(e[d]=h[d]);e.id=p&&p[u+"follow"]||e.id||u+i,a=c.list[e.id];if(a)return p&&a.follow(p),a.zIndex().focus(),s=document.activeElement,a;l||(e.fixed=!1);if(!e.button||!e.button.push)e.button=[];return t!==n&&(e.ok=t),e.ok&&e.button.push({id:"ok",value:e.okValue,callback:e.ok,focus:!0}),o!==n&&(e.cancel=o),e.cancel&&e.button.push({id:"cancel",value:e.cancelValue,callback:e.cancel}),c.defaults.zIndex=e.zIndex,i++,c.list[e.id]=r?r.constructor(e):new c.fn.constructor(e)};c.version="5.0.3",c.fn=c.prototype={constructor:function(e){var t;return s=document.activeElement,this.closed=!1,this.config=e,this.dom=t=this.dom||this._innerHTML(e),e.skin&&t.wrap.addClass(e.skin),t.wrap.css("position",e.fixed?"fixed":"absolute"),t.close[e.cancel===!1?"hide":"show"](),t.content.css("padding",e.padding),this.button.apply(this,e.button),this.title(e.title).content(e.content).size(e.width,e.height).time(e.time),this._reset(),this.zIndex(),e.lock&&this.lock(),this._addEvent(),this[e.visible?"visible":"hidden"]().focus(),r=null,e.initialize&&e.initialize.call(this),this},content:function(t){var n,r,i,s,o=this,u=this.dom.content,a=u[0];return this._elemBack&&(this._elemBack(),delete this._elemBack),typeof t=="string"?u.html(t):t&&t.nodeType===1&&(s=t.style.display,n=t.previousSibling,r=t.nextSibling,i=t.parentNode,this._elemBack=function(){n&&n.parentNode?n.parentNode.insertBefore(t,n.nextSibling):r&&r.parentNode?r.parentNode.insertBefore(t,r):i&&i.appendChild(t),t.style.display=s,o._elemBack=null},u.html(""),a.appendChild(t),e(t).show()),this._reset(),this},title:function(e){var t=this.dom,n=t.outer,r=t.title,i="d-state-noTitle";return e===!1?(r.hide().html(""),n.addClass(i)):(r.show().html(e),n.removeClass(i)),this},position:function(){var e=this.dom,t=e.wrap[0],n=e.window,r=e.document,i=this.config.fixed,s=i?0:r.scrollLeft(),o=i?0:r.scrollTop(),a=n.width(),f=n.height(),l=t.offsetWidth,c=t.offsetHeight,h=(a-l)/2+s,p=(f-c)*382/1e3+o,d=t.style;return d.left=Math.max(parseInt(h),s)+"px",d.top=Math.max(parseInt(p),o)+"px",this._follow&&(this._follow.removeAttribute(u+"follow"),this._follow=null),this},size:function(e,t){var n=this.dom.main[0].style;return typeof e=="number"&&(e+="px"),typeof t=="number"&&(t+="px"),n.width=e,n.height=t,this},follow:function(t){var n=e(t),r=this.config;if(!t||!t.offsetWidth&&!t.offsetHeight)return this.position(this._left,this._top);var i=r.fixed,s=u+"follow",o=this.dom,a=o.window,f=o.document,l=a.width(),c=a.height(),h=f.scrollLeft(),p=f.scrollTop(),d=n.offset(),v=t.offsetWidth,m=t.offsetHeight,g=i?d.left-h:d.left,y=i?d.top-p:d.top,b=this.dom.wrap[0],w=b.style,E=b.offsetWidth,S=b.offsetHeight,x=g-(E-v)/2,T=y+m,N=i?0:h,C=i?0:p;return x=x<N?g:x+E>l&&g-E>N?g-E+v:x,T=T+S>c+C&&y-S>C?y-S:T,w.left=parseInt(x)+"px",w.top=parseInt(T)+"px",this._follow&&this._follow.removeAttribute(s),this._follow=t,t[s]=r.id,this},button:function(){var t=this.dom,n=t.buttons,r=n[0],i="d-state-highlight",s=this._listeners=this._listeners||{},o=[].slice.call(arguments),a=0,f,l,c,h,p;for(;a<o.length;a++)f=o[a],l=f.value,c=f.id||l,h=!s[c],p=h?document.createElement("input"):s[c].elem,p.type="button",p.className="d-button",s[c]||(s[c]={}),l&&(p.value=l),f.width&&(p.style.width=f.width),f.callback&&(s[c].callback=f.callback),f.focus&&(this._focus&&this._focus.removeClass(i),this._focus=e(p).addClass(i),this.focus()),p[u+"callback"]=c,p.disabled=!!f.disabled,h&&(s[c].elem=p,r.appendChild(p));return