/*! * artdialog 4.1.6 * date: 2012-07-16 22:57 * http://code.google.com/p/artdialog/ * (c) 2009-2012 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(h,e,l){h.noop=h.noop||function(){};var o,p,s,v,z=0,q=h(e),j=h(document),m=h("html");s=document.documentelement;var r=e.vbarray&&!e.xmlhttprequest,t="createtouch"in document&&!("onmousemove"in s)||/(iphone|ipad|ipod)/i.test(navigator.useragent),w="artdialog"+ +new date,g=function(a,b,c){a=a||{};if("string"===typeof a||1===a.nodetype)a={content:a,fixed:!t};var d;d=g.defaults;var f=a.follow=1===this.nodetype&&this||a.follow,i;for(i in d)a[i]===l&&(a[i]=d[i]);h.each({ok:"yesfn",cancel:"nofn",close:"closefn",init:"initfn",okval:"yestext",cancelval:"notext"},function(b,d){a[b]=a[b]!==l?a[b]:a[d]});"string"===typeof f&&(f=h(f)[0]);a.id=f&&f[w+"follow"]||a.id||w+z;d=g.list[a.id];if(f&&d)return d.follow(f).zindex().focus();if(d)return d.zindex().focus();if(t)a.fixed=!1;if(!h.isarray(a.button))a.button=a.button?[a.button]:[];if(b!==l)a.ok=b;if(c!==l)a.cancel=c;a.ok&&a.button.push({name:a.okval,callback:a.ok,focus:!0});a.cancel&&a.button.push({name:a.cancelval,callback:a.cancel});g.defaults.zindex=a.zindex;z++;return g.list[a.id]=o?o._init(a):new g.fn._init(a)};g.fn=g.prototype={version:"4.1.6",closed:!0,_init:function(a){var b,c=a.icon,d=c&&(r?{png:"icons/"+c+".png"}:{backgroundimage:"url('"+a.path+"/skins/icons/"+c+".png')"});this.closed=!1;this.config=a;this.dom=b=this.dom||this._getdom();b.wrap.addclass(a.skin);b.close[!1===a.cancel?"hide":"show"]();b.icon[0].style.display=c?"":"none";b.iconbg.css(d||{background:"none"});b.se.css("cursor",a.resize?"se-resize":"auto");b.title.css("cursor",a.drag?"move":"auto");b.content.css("padding",a.padding);this[a.show?"show":"hide"](!0);this.button(a.button).title(a.title).content(a.content,!0).size(a.width,a.height).time(a.time);a.follow?this.follow(a.follow):this.position(a.left,a.top);this.zindex().focus();a.lock&&this.lock();this._addevent();this._ie6pngfix();o=null;a.init&&a.init.call(this,e);return this},content:function(a,b){var c,d,f,i,k=this,u=k.dom,n=u.wrap[0],g=n.offsetwidth,j=n.offsetheight,h=parseint(n.style.left),e=parseint(n.style.top),r=n.style.width,u=u.content,m=u[0];k._elemback&&k._elemback();n.style.width="auto";if(a===l)return m;if("string"===typeof a)u.html(a);else if(a&&1===a.nodetype)i=a.style.display,c=a.previoussibling,d=a.nextsibling,f=a.parentnode,k._elemback=function(){c&&c.parentnode?c.parentnode.insertbefore(a,c.nextsibling):d&&d.parentnode?d.parentnode.insertbefore(a,d):f&&f.appendchild(a);a.style.display=i;k._elemback=null},u.html(""),m.appendchild(a),a.style.display="block";if(!b){k.config.follow?k.follow(k.config.follow):(g=n.offsetwidth-g,j=n.offsetheight-j,e-=j/2,n.style.left=math.max(h-g/2,0)+"px",n.style.top=math.max(e,0)+"px");if(r&&"auto"!==r)n.style.width=n.offsetwidth+"px";k._autopositiontype()}k._ie6selectfix();k._runscript(m);return k},title:function(a){var b=this.dom,c=b.wrap,b=b.title;if(a===l)return b[0];!1===a?(b.hide().html(""),c.addclass("aui_state_notitle")):(b.show().html(a||""),c.removeclass("aui_state_notitle"));return this},position:function(a,b){var c=this.config,d=this.dom.wrap[0],f=r?!1:c.fixed,c=r&&this.config.fixed,i=j.scrollleft(),k=j.scrolltop(),u=f?0:i,f=f?0:k,n=q.width(),g=q.height(),h=d.offsetwidth,e=d.offsetheight,d=d.style;if(a||0===a)if(this._left=-1!==a.tostring().indexof("%")?a:null,a=this._tonumber(a,n-h),"number"===typeof a)a=c?a+=i:a+u,d.left=math.max(a,u)+"px";else if("string"===typeof a)d.left=a;if(b||0===b)if(this._top=-1!==b.tostring().indexof("%")?b:null,b=this._tonumber(b,g-e),"number"===typeof b)b=c?b+=k:b+f,d.top=math.max(b,f)+"px";else if("string"===typeof b)d.top=b;if(a!==l&&b!==l)this._follow=null,this._autopositiontype();return this},size:function(a,b){var c,d,f=this.dom;d=f.wrap;var i=f.main,k=d[0].style,f=i[0].style;if(a)if(this._width=-1!==a.tostring().indexof("%")?a:null,c=q.width()-d[0].offsetwidth+i[0].offsetwidth,a=c=this._tonumber(a,c),"number"===typeof a)k.width="auto",f.width=math.max(this.config.minwidth,a)+"px",k.width=d[0].offsetwidth+"px";else if("string"===typeof a)f.width=a,"auto"===a&&d.css("width","auto");if(b)if(this._height=-1!==b.tostring().indexof("%")?b:null,d=q.height()-d[0].offsetheight+i[0].offsetheight,b=d=this._tonumber(b,d),"number"===typeof b)f.height=math.max(this.config.minheight,b)+"px";else if("string"===typeof b)f.height=b;this._ie6selectfix();return this},follow:function(a){var b,c=this.config;if("string"===typeof a||a&&1===a.nodetype)b=h(a),a=b[0];if(!a||!a.offsetwidth&&!a.offsetheight)return this.position(this._left,this._top);var d=w+"follow",f=q.width(),i=q.height(),k=j.scrollleft(),g=j.scrolltop(),n=b.offset();b=a.offsetwidth;var e=r?!1:c.fixed,m=e?n.left-k:n.left,n=e?n.top-g:n.top,l=this.dom.wrap[0],p=l.style,o=l.offsetwidth,l=l.offsetheight,t=m-(o-b)/2,s=n+a.offsetheight,k=e?0:k,g=e?0:g;p.left=(tf&&m-o>k?m-o+b:t)+"px";p.top=(s+l>i+g&&n-l>g?n-l:s)+"px";this._follow&&this._follow.removeattribute(d);this._follow=a;a[d]=c.id;this._autopositiontype();return this},button:function(){var a=this,b=arguments,c=a.dom.buttons,d=c[0],f=a._listeners=a._listeners||{},i=h.isarray(b[0])?b[0]:[].slice.call(b);if(b[0]===l)return d;h.each(i,function(b,c){var i=c.name,g=!f[i],j=!g?f[i].elem:document.createelement("button");f[i]||(f[i]={});if(c.callback)f[i].callback=c.callback;if(c.classname)j.classname=c.classname;if(c.focus)a._focus&&a._focus.removeclass("aui_state_highlight"),a._focus=h(j).addclass("aui_state_highlight"),a.focus();j.setattribute("type","button");j[w+"callback"]=i;j.disabled=!!c.disabled;if(g)j.innerhtml=i,f[i].elem=j,d.appendchild(j)});c[0].style.display=i.length?"":"none";a._ie6selectfix();return a},show:function(a){this.dom.wrap.show();!a&&this._lockmaskwrap&&this._lockmaskwrap.show();return this},hide:function(a){this.dom.wrap.hide();!a&&this._lockmaskwrap&&this._lockmaskwrap.hide();return this},close:function(){if(this.closed)return this;var a=this.dom,b=a.wrap,c=g.list,d=this.config.close,f=this.config.follow;this.time();if("function"===typeof d&&!1===d.call(this,e))return this;this.unlock();this._elemback&&this._elemback();b[0].classname=b[0].style.csstext="";a.title.html("");a.content.html("");a.buttons.html("");if(g.focus===this)g.focus=null;f&&f.removeattribute(w+"follow");delete c[this.config.id];this._removeevent();this.hide(!0)._setabsolute();for(var i in this)this.hasownproperty(i)&&"dom"!==i&&delete this[i];o?b.remove():o=this;return this},time:function(a){var b=this,c=b.config.cancelval,d=b._timer;d&&cleartimeout(d);if(a)b._timer=settimeout(function(){b._click(c)},1e3*a);return b},focus:function(){try{var a=this._focus&&this._focus[0]||this.dom.close[0];a&&a.focus()}catch(b){}return this},zindex:function(){var a=this.dom.wrap,b=g.focus,c=g.defaults.zindex++;a.css("zindex",c);this._lockmask&&this._lockmask.css("zindex",c-1);b&&b.dom.wrap.removeclass("aui_state_focus");g.focus=this;a.addclass("aui_state_focus");return this},lock:function(){if(this._lock)return this;var a=this,b=g.defaults.zindex-1,c=a.dom.wrap,d=a.config,f=j.width(),i=j.height(),k=a._lockmaskwrap||h(document.body.appendchild(document.createelement("div"))),e=a._lockmask||h(k[0].appendchild(document.createelement("div"))),f=t?"width:"+f+"px;height:"+i+"px":"width:100%;height:100%",i=r?"position:absolute;left:expression((document).documentelement.scrollleft);top:expression((document).documentelement.scrolltop);width:expression((document).documentelement.clientwidth);height:expression((document).documentelement.clientheight)":"";a.zindex();c.addclass("aui_state_lock");k[0].style.csstext=f+";position:fixed;z-index:"+b+";top:0;left:0;overflow:hidden;"+i;e[0].style.csstext="height:100%;background:"+d.background+";filter:alpha(opacity=0);opacity:0";r&&e.html('');e.stop();e.bind("click",function(){a._reset()}).bind("dblclick",function(){a._click(a.config.cancelval)});0===d.duration?e.css({opacity:d.opacity}):e.animate({opacity:d.opacity},d.duration);a._lockmaskwrap=k;a._lockmask=e;a._lock=!0;return a},unlock:function(){var a=this._lockmaskwrap,b=this._lockmask;if(!this._lock)return this;var c=a[0].style,d=function(){r&&(c.removeexpression("width"),c.removeexpression("height"),c.removeexpression("left"),c.removeexpression("top"));c.csstext="display:none";o&&a.remove()};b.stop().unbind();this.dom.wrap.removeclass("aui_state_lock");this.config.duration?b.animate({opacity:0},this.config.duration,d):d();this._lock=!1;return this},_getdom:function(){var a=document.createelement("div"),b=document.body;a.style.csstext="position:absolute;left:0;top:0";a.innerhtml=g._templates;b.insertbefore(a,b.firstchild);for(var b=0,c={wrap:h(a)},d=a.getelementsbytagname("*"),f=d.length;bc.lastindexof("/")?".":c.substring(0,c.lastindexof("/"))}(document.getelementsbytagname("script"));if(s=p.src.split("skin=")[1]){var x=document.createelement("link");x.rel="stylesheet";x.href=v+"/skins/"+s+".css?"+g.fn.version;p.parentnode.insertbefore(x,p)}q.bind("load",function(){settimeout(function(){z||g({left:"-9999em",time:9,fixed:!1,lock:!1,focus:!1})},150)});try{document.execcommand("backgroundimagecache",!1,!0)}catch(y){}g._templates='';g.defaults={content:'
loading..
',title:"\u6d88\u606f",button:null,ok:null,cancel:null,init:null,close:null,okval:"\u786e\u5b9a",cancelval:"\u53d6\u6d88",width:"auto",height:"auto",minwidth:96,minheight:32,padding:"20px 25px",skin:"",icon:null,time:null,esc:!0,focus:!0,show:!0,follow:null,path:v,lock:!1,background:"#000",opacity:0.7,duration:300,fixed:!1,left:"50%",top:"38.2%",zindex:1987,resize:!0,drag:!0};e.artdialog=h.dialog=h.artdialog=g})(this.art||this.jquery&&(this.art=jquery),this);(function(h){var e,l,o=h(window),p=h(document),s=document.documentelement,v=!("minwidth"in s.style),z="onlosecapture"in s,q="setcapture"in s;artdialog.dragevent=function(){var j=this,e=function(e){var h=j[e];j[e]=function(){return h.apply(j,arguments)}};e("start");e("move");e("end")};artdialog.dragevent.prototype={onstart:h.noop,start:function(e){p.bind("mousemove",this.move).bind("mouseup",this.end);this._sclientx=e.clientx;this._sclienty=e.clienty;this.onstart(e.clientx,e.clienty);return!1},onmove:h.noop,move:function(e){this._mclientx=e.clientx;this._mclienty=e.clienty;this.onmove(e.clientx-this._sclientx,e.clienty-this._sclienty);return!1},onend:h.noop,end:function(e){p.unbind("mousemove",this.move).unbind("mouseup",this.end);this.onend(e.clientx,e.clienty);return!1}};l=function(h){var m,l,t,s,g,x,y=artdialog.focus,a=y.dom,b=a.wrap,c=a.title,d=a.main,f="getselection"in window?function(){window.getselection().removeallranges()}:function(){try{document.selection.empty()}catch(a){}};e.onstart=function(){x?(l=d[0].offsetwidth,t=d[0].offsetheight):(s=b[0].offsetleft,g=b[0].offsettop);p.bind("dblclick",e.end);!v&&z?c.bind("losecapture",e.end):o.bind("blur",e.end);q&&c[0].setcapture();b.addclass("aui_state_drag");y.focus()};e.onmove=function(a,c){if(x){var e=b[0].style,h=d[0].style,j=a+l,o=c+t;e.width="auto";h.width=math.max(0,j)+"px";e.width=b[0].offsetwidth+"px";h.height=math.max(0,o)+"px"}else h=b[0].style,e=math.max(m.minx,math.min(m.maxx,a+s)),j=math.max(m.miny,math.min(m.maxy,c+g)),h.left=e+"px",h.top=j+"px";f();y._ie6selectfix()};e.onend=function(){p.unbind("dblclick",e.end);!v&&z?c.unbind("losecapture",e.end):o.unbind("blur",e.end);q&&c[0].releasecapture();v&&!y.closed&&y._autopositiontype();b.removeclass("aui_state_drag")};x=h.target===a.se[0]?!0:!1;m=function(){var a=y.dom.wrap[0],b="fixed"===a.style.position,c=a.offsetwidth,a=a.offsetheight,d=o.width(),f=o.height(),e=b?0:p.scrollleft(),b=b?0:p.scrolltop();return{minx:e,miny:b,maxx:d-c+e,maxy:f-a+b}}();e.start(h)};p.bind("mousedown",function(h){var m=artdialog.focus;if(m){var o=h.target,p=m.config,m=m.dom;if(!1!==p.drag&&o===m.title[0]||!1!==p.resize&&o===m.se[0])return e=e||new artdialog.dragevent,l(h),!1}})})(this.art||this.jquery&&(this.art=jquery));