/*! * artDialog 5.0.4 * Date: 2013-07-31 * 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(a,b){function f(a,b,c){b=b||document,c=c||"*";for(var d=0,e=0,f=[],g=b.getElementsByTagName(c),h=g.length,i=new RegExp("(^|\\s)"+a+"(\\s|$)");h>d;d++)i.test(g[d].className)&&(f[e]=g[d],e++);return f}function g(d){var e=c.expando,f=d===a?0:d[e];return f===b&&(d[e]=f=++c.uuid),f}function h(a){return c.isWindow(a)?a:9===a.nodeType?a.defaultView||a.parentWindow:!1}var c=a.art=function(a,b){return new c.fn.constructor(a,b)},d=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,e=/[\n\t]/g;return a.$===b&&(a.$=c),c.fn=c.prototype={constructor:function(a,b){var c,e;return b=b||document,a?a.nodeType?(this[0]=a,this):"string"==typeof a&&(c=d.exec(a),c&&c[2])?(e=b.getElementById(c[2]),e&&e.parentNode&&(this[0]=e),this):(this[0]=a,this):this},hasClass:function(a){var b=" "+a+" ";return(" "+this[0].className+" ").replace(e," ").indexOf(b)>-1?!0:!1},addClass:function(a){return this.hasClass(a)||(this[0].className+=" "+a),this},removeClass:function(a){var b=this[0];return a?this.hasClass(a)&&(b.className=b.className.replace(a," ")):b.className="",this},css:function(a,d){var e,f=this[0],g=arguments[0];if("string"==typeof a){if(d===b)return c.css(f,a);f.style[a]=d}else for(e in g)f.style[e]=g[e];return this},show:function(){return this.css("display","block")},hide:function(){return this.css("display","none")},offset:function(){var a=this[0],b=a.getBoundingClientRect(),c=a.ownerDocument,d=c.body,e=c.documentElement,f=e.clientTop||d.clientTop||0,g=e.clientLeft||d.clientLeft||0,h=b.top+(self.pageYOffset||e.scrollTop)-f,i=b.left+(self.pageXOffset||e.scrollLeft)-g;return{left:i,top:h}},html:function(a){var d=this[0];return a===b?d.innerHTML:(c.cleanData(d.getElementsByTagName("*")),d.innerHTML=a,this)},remove:function(){var a=this[0];return c.cleanData(a.getElementsByTagName("*")),c.cleanData([a]),a.parentNode.removeChild(a),this},bind:function(a,b){return c.event.add(this[0],a,b),this},unbind:function(a,b){return c.event.remove(this[0],a,b),this}},c.fn.constructor.prototype=c.fn,c.isWindow=function(a){return a&&"object"==typeof a&&"setInterval"in a},c.fn.find=function(a){var b,d=this[0],e=a.split(".")[1];return b=e?document.getElementsByClassName?d.getElementsByClassName(e):f(e,d):d.getElementsByTagName(a),c(b[0])},c.each=function(a,c){var d,e=0,f=a.length,g=f===b;if(g){for(d in a)if(c.call(a[d],d,a[d])===!1)break}else for(var h=a[0];f>e&&c.call(h,e,h)!==!1;h=a[++e]);return a},c.data=function(a,d,e){var f=c.cache,h=g(a);return d===b?f[h]:(f[h]||(f[h]={}),e!==b&&(f[h][d]=e),f[h][d])},c.removeData=function(a,b){var d=!0,e=c.expando,f=c.cache,h=g(a),i=h&&f[h];if(i)if(b){delete i[b];for(var j in i)d=!1;d&&delete c.cache[h]}else delete f[h],a.removeAttribute?a.removeAttribute(e):a[e]=null},c.uuid=0,c.cache={},c.expando="@cache"+ +new Date,c.event={add:function(a,b,d){var e,f,g=c.event,h=c.data(a,"@events")||c.data(a,"@events",{});e=h[b]=h[b]||{},f=e.listeners=e.listeners||[],f.push(d),e.handler||(e.elem=a,e.handler=g.handler(e),a.addEventListener?a.addEventListener(b,e.handler,!1):a.attachEvent("on"+b,e.handler))},remove:function(a,b,d){var e,f,g,h=c.event,i=!0,j=c.data(a,"@events");if(j)if(b){if(f=j[b]){if(g=f.listeners,d)for(e=0;eb;b++)d=a[b],f(d),g(d)},c.css="defaultView"in document&&"getComputedStyle"in document.defaultView?function(a,b){return document.defaultView.getComputedStyle(a,!1)[b]}:function(a,b){return a.currentStyle[b]||""},c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(){var c,b=this[0];return c=h(b),c?"pageXOffset"in c?c[a?"pageYOffset":"pageXOffset"]:c.document.documentElement[d]||c.document.body[d]:b[d]}}),c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn[d]=function(a){var d=this[0];return d?c.isWindow(d)?d.document.documentElement["client"+b]||d.document.body["client"+b]:9===d.nodeType?Math.max(d.documentElement["client"+b],d.body["scroll"+b],d.documentElement["scroll"+b],d.body["offset"+b],d.documentElement["offset"+b]):null:null==a?null:this}}),c}(window),function(a,b,c){function n(a){var b=m.focus;b&&b._isLock&&!b.dom.wrap[0].contains(a.target)&&(a.stopPropagation(),b.dom.outer[0].focus())}if("BackCompat"===document.compatMode)throw new Error("artDialog: Document types require more than xhtml1.0");var d,e=0,g=(a(document.getElementsByTagName("html")[0]),"artDialog"+ +new Date),h=b.VBArray&&!b.XMLHttpRequest,i="createTouch"in document&&!("onmousemove"in document)||/(iPhone|iPad|iPod)/i.test(navigator.userAgent),j=!h&&!i,k=function(){try{return document.activeElement}catch(a){}},l=k(),m=function(a,b,f){a=a||{},("string"==typeof a||1===a.nodeType)&&(a={content:a,fixed:!i});var h,k=m.defaults,l=a.follow=1===this.nodeType&&this||a.follow;for(var n in k)a[n]===c&&(a[n]=k[n]);return a.id=l&&l[g+"follow"]||a.id||g+e,(h=m.list[a.id])?(l&&h.follow(l),h.zIndex().focus(),h):(j||(a.fixed=!1),a.button&&a.button.push||(a.button=[]),b!==c&&(a.ok=b),a.ok&&a.button.push({id:"ok",value:a.okValue,callback:a.ok,focus:!0}),f!==c&&(a.cancel=f),a.cancel&&a.button.push({id:"cancel",value:a.cancelValue,callback:a.cancel}),m.defaults.zIndex=a.zIndex,e++,m.list[a.id]=d?d._create(a):new m.fn._create(a))};m.version="5.0.4",m.fn=m.prototype={_create:function(a){var b;return this.closed=!1,this.config=a,this.dom=b=this.dom||this._innerHTML(a),a.skin&&b.wrap.addClass(a.skin),b.wrap.css("position",a.fixed?"fixed":"absolute"),b.close[a.cancel===!1?"hide":"show"](),b.content.css("padding",a.padding),this.button.apply(this,a.button),this.title(a.title).content(a.content).size(a.width,a.height).time(a.time),this._reset(),this.zIndex(),a.lock&&this.lock(),this._addEvent(),this[a.visible?"visible":"hidden"]().focus(),d=null,a.initialize&&a.initialize.call(this),this},content:function(b){var c,d,e,f,g=this,h=this.dom.content,i=h[0];return this._elemBack&&(this._elemBack(),delete this._elemBack),"string"==typeof b?h.html(b):b&&1===b.nodeType&&(f=b.style.display,c=b.previousSibling,d=b.nextSibling,e=b.parentNode,this._elemBack=function(){c&&c.parentNode?c.parentNode.insertBefore(b,c.nextSibling):d&&d.parentNode?d.parentNode.insertBefore(b,d):e&&e.appendChild(b),b.style.display=f,g._elemBack=null},h.html(""),i.appendChild(b),a(b).show()),this._reset(),this},title:function(a){var b=this.dom,c=b.outer,d=b.title,e="d-state-noTitle";return a===!1?(d.hide().html(""),c.addClass(e)):(d.show().html(a),c.removeClass(e)),this},position:function(){var a=this.dom,b=a.wrap[0],c=a.window,d=a.document,e=this.config.fixed,f=e?0:d.scrollLeft(),h=e?0:d.scrollTop(),i=c.width(),j=c.height(),k=b.offsetWidth,l=b.offsetHeight,m=(i-k)/2+f,n=382*(j-l)/1e3+h,o=b.style;return o.left=Math.max(parseInt(m),f)+"px",o.top=Math.max(parseInt(n),h)+"px",this._follow&&(this._follow.removeAttribute(g+"follow"),this._follow=null),this},size:function(a,b){var c=this.dom.main[0].style;return"number"==typeof a&&(a+="px"),"number"==typeof b&&(b+="px"),c.width=a,c.height=b,this},follow:function(b){var c=a(b),d=this.config;if(!b||!b.offsetWidth&&!b.offsetHeight)return this.position(this._left,this._top);var e=d.fixed,f=g+"follow",h=this.dom,i=h.window,j=h.document,k=i.width(),l=i.height(),m=j.scrollLeft(),n=j.scrollTop(),o=c.offset(),p=b.offsetWidth,q=b.offsetHeight,r=e?o.left-m:o.left,s=e?o.top-n:o.top,t=this.dom.wrap[0],u=t.style,v=t.offsetWidth,w=t.offsetHeight,x=r-(v-p)/2,y=s+q,z=e?0:m,A=e?0:n;return x=z>x?r:x+v>k&&r-v>z?r-v+p:x,y=y+w>l+A&&s-w>A?s-w:y,u.left=parseInt(x)+"px",u.top=parseInt(y)+"px",this._follow&&this._follow.removeAttribute(f),this._follow=b,b[f]=d.id,this},button:function(){for(var j,k,l,m,n,b=this.dom,c=b.buttons,d=c[0],e="d-state-highlight",f=this._listeners=this._listeners||{},h=[].slice.call(arguments),i=0;ig;g++)f=i[g].className.split("d-")[1],f&&(h[f]=a(i[g]));return h.window=a(b),h.document=a(document),h.wrap=a(e),h},_click:function(a){var b=this._listeners[a]&&this._listeners[a].callback;return"function"!=typeof b||b.call(this)!==!1?this.close():this},_reset:function(){var a=this.config.follow||this._follow;a?this.follow(a):this.position()},_addEvent:function(){var a=this,b=this.dom;b.wrap.bind("click",function(c){var e,d=c.target;return d.disabled?!1:d===b.close[0]?(a._click("cancel"),!1):(e=d[g+"callback"],e&&a._click(e),void 0)}).bind("mousedown",function(){a.zIndex()})},_removeEvent:function(){this.dom.wrap.unbind()}},m.fn._create.prototype=m.fn,a.fn.dialog=a.fn.artDialog=function(){var a=arguments;return this[this.live?"live":"bind"]("click",function(){return m.apply(this,a),!1}),this},m.focus=null,m.get=function(a){return a===c?m.list:m.list[a]},m.list={},a(document).bind("keydown",function(a){var b=a.target,c=b.nodeName,d=/^input|textarea$/i,e=m.focus,f=a.keyCode;!e||d.test(c)&&"button"!==b.type||27===f&&e._click("cancel")}),a.fn.live?a("body").live("focus",n):document.addEventListener?document.addEventListener("focus",n,!0):a(document).bind("focusin",n),a(b).bind("resize",function(){var a=m.list;for(var b in a)a[b]._reset()}),m._templates='',m.defaults={content:'
loading..
',title:"message",button:null,ok:null,cancel:null,initialize:null,beforeunload:null,okValue:"ok",cancelValue:"cancel",width:"auto",height:"auto",padding:"20px 25px",skin:null,time:null,visible:!0,follow:null,lock:!1,fixed:!1,zIndex:1987},this.artDialog=a.dialog=a.artDialog=m}(this.art||this.jQuery,this);