| 123456 |
- /*!
- * lhgcore Dialog Plugin v3.3.1
- * Date : 2011-04-12 11:16:11
- * Copyright (c) 2009 - 2011 By Li Hui Gang
- */
- (function(a){var b=window,c,e,f,g=!1,h=a.browser.msie&&a.browser.version<7?!0:!1,i=h?'<iframe hideFocus="true" frameborder="0" src="about:blank" style="position:absolute;z-index:-1;width:100%;height:100%;top:0px;left:0px;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0)"></iframe>':"",j=function(a){d=a||document;return d.compatMode=="CSS1Compat"?d.documentElement:d.body},k=function(){f||(f=9999);return++f},l=function(c){if(a.browser.msie)try{return window.event||b.event||c.event}catch(d){return null}var e=l.caller;while(e!=null){var f=e.arguments[0];if(f&&(f+"").indexOf("Event")>=0)return f;e=e.caller}return null},m=function(){if("pageXOffset"in b)return{x:b.pageXOffset||0,y:b.pageYOffset||0};var a=j(c);return{x:a.scrollLeft||0,y:a.scrollTop||0}},n=function(){var a=j(c);return{w:a.clientWidth||0,h:a.clientHeight||0}},o=function(){var b=j(c);a(e).css({width:Math.max(b.scrollWidth,b.clientWidth||0)-1+"px",height:Math.max(b.scrollHeight,b.clientHeight||0)-1+"px"})},p=function(){var b=a("script"),c="",d=0,e=b.length,f=/lhgdialog(?:\.min)?\.js/i;for(;d<e;d++)if(f.test(b[d].src)){c=!document.querySelector?b[d].getAttribute("src",4):b[d].src;break}return c.substr(0,c.lastIndexOf("/")+1)};while(b.parent&&b.parent!=b){try{if(b.parent.document.domain!=document.domain)break}catch(q){break}b=b.parent}b.document.getElementsByTagName("frameset").length>0&&(b=window),c=b.document,a.fn.fixie6png=function(){var b=a("*",this),c,d;for(var e=0,f=b.length;e<f;e++)d=a(b[e]).css("backgroundImage"),d.indexOf(".png")!==-1&&(c=d.replace(/url\(|"|\)/g,""),b[e].style.backgroundImage="none",b[e].runtimeStyle.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+c+"',sizingMethod='scale')")},a.fn.dialog=function(b){var c=!1;this[0]&&(c=new a.dialog(b,this[0]));return c},a.dialog=function(d,q){var r=this,s,t,u,v,w,x,y,z,A=r.opt=a.extend({title:"lhgdialog 弹出窗口",cover:!1,titleBar:!0,btnBar:!0,xButton:!0,cancelBtn:!0,width:400,height:300,id:"lhgdgId",SetTopWindow:null,link:!1,html:null,page:null,parent:null,dgOnLoad:null,onXclick:null,onCancel:null,fixed:!1,top:"center",left:"center",drag:!0,resize:!0,autoSize:!1,rang:!1,iconTitle:!0,loadingText:"窗口内容加载中,请稍等..."},d||{});A.SetTopWindow&&(b=A.SetTopWindow,c=b.document);if(!g){try{c.execCommand("BackgroundImageCache",!1,!0)}catch(B){}h&&a("body",c).css("backgroundAttachment")!=="fixed"&&a("html",c).css({backgroundImage:"url(about:blank)",backgroundAttachment:"fixed"}),a("head",c).append('<link href="'+p()+'lhgdialog.css" rel="stylesheet" type="text/css"/>'),g=!0}var C=function(a){var b=a.style,d=j(c),e=parseInt(b.left)-d.scrollLeft,f=parseInt(b.top)-d.scrollTop;b.removeExpression("left"),b.removeExpression("top"),b.setExpression("left","this.ownerDocument.documentElement.scrollLeft"+e),b.setExpression("top","this.ownerDocument.documentElement.scrollTop + "+f)},D=function(){var a,b;A.html?typeof A.html=="string"?a='<div id="lhgdg_inbox_'+A.id+'" class="lhgdg_inbox" style="display:none">'+A.html+"</div>":a='<div id="lhgdg_inbox_'+A.id+'" class="lhgdg_inbox" style="display:none"></div>':A.page&&(a='<iframe id="lhgfrm_'+A.id+'" frameborder="0" src="'+A.page+'" '+'scrolling="auto" style="display:none;width:100%;height:100%;"></iframe>'),b=['<div id="',A.id,'" class="lhgdialog" style="width:',A.width,"px;height:",A.height,'px;">','<table border="0" cellspacing="0" cellpadding="0" width="100%">',"<tr>",'<td class="lhgdg_leftTop"></td>','<td id="lhgdg_drag_',A.id,'" class="lhgdg_top">',A.titleBar?'<div class="lhgdg_title_icon">'+(A.iconTitle?'<div class="lhgdg_icon"></div>':"")+'<div class="lhgdg_title">'+A.title+"</div>"+(A.xButton?'<a class="lhgdg_xbtn" id="lhgdg_xbtn_'+A.id+'" href="###"></a>':"")+"</div>":"","</td>",'<td class="lhgdg_rightTop"></td>',"</tr>","<tr>",'<td class="lhgdg_left"></td>',"<td>",'<table border="0" cellspacing="0" cellpadding="0" width="100%">',"<tr>",'<td id="lhgdg_content_',A.id,'" style="background-color:#fff">',a,'<div id="lhgdg_load_',A.id,'" class="lhgdg_load"><span>',A.loadingText,"</span></div>","</td>","</tr>",A.btnBar?'<tr><td id="lhgdg_btnBar_'+A.id+'" class="lhgdg_btnBar"></td></tr>':"","</table>","</td>",'<td class="lhgdg_right"></td>',"</tr>","<tr>",'<td class="lhgdg_leftBottom"></td>','<td class="lhgdg_bottom"></td>','<td id="lhgdg_drop_',A.id,'" class="lhgdg_rightBottom"></td>',"</tr>","</table>",i,"</div>"].join("");return b},E=function(){e=a("#lhgdgCover",c)[0];if(!e){var d='<div id="lhgdgCover" style="position:absolute;top:0px;left:0px;background-color:#fff;">'+i+"</div>";e=a(d,c).css("opacity",.5).appendTo(c.body)[0]}a(b).bind("resize",o),o(),a(e).css({display:"",zIndex:k()})},F=function(b,c,d,e){var f=n(),g=m(),i=b.offsetWidth,j=b.offsetHeight,k,l,o,p,q,r,s,t;e?(o=h?g.x:0,p=h?f.w+g.x-i:f.w-i,q=h?(p+g.x-20)/2:(p-20)/2,r=h?g.y:0,s=h?f.h+g.y-j:f.h-j,t=h?(s+g.y-20)/2:(s-20)/2):(o=g.x,q=g.x+(f.w-i-20)/2,p=g.x+f.w-i,r=g.y,t=g.y+(f.h-j-20)/2,s=g.y+f.h-j);switch(d){case"center":k=q;break;case"left":k=o;break;case"right":k=p;break;default:e&&h&&(d=d+g.x),k=d}switch(c){case"center":l=t;break;case"top":l=r;break;case"bottom":l=s;break;default:e&&h&&(c=c+g.y),l=c}a(b).css({top:l+"px",left:k+"px"}),e&&h&&C(b)},G=function(d){r.topWin=b,r.topDoc=c,r.curWin=window,r.curDoc=document,a(d).bind("contextmenu",function(a){a.preventDefault()}).bind("mousedown",r.SetIndex),A.html&&A.html.nodeType&&a(t).append(A.html),z=[window],b!=window&&z.push(b),A.page&&(r.dgFrm=a("#lhgfrm_"+A.id,c)[0],A.link||(r.dgWin=r.dgFrm.contentWindow,r.dgFrm.lhgDG=r),a(r.dgFrm).bind("load",function(){this.style.display="block";if(!A.link){var b=a.browser.msie?r.dgWin.document:r.dgWin;a(b).bind("mousedown",r.SetIndex),z.push(r.dgWin),r.dgDoc=r.dgWin.document,A.autoSize&&I(),a.isFunction(A.dgOnLoad)&&A.dgOnLoad.call(r)}s.style.display="none"})),A.xButton&&A.titleBar&&a(u).hover(function(){a(this).addClass("lhgdg_xbtnover")},function(){a(this).removeClass("lhgdg_xbtnover")}).bind("click",A.onXclick)},H=function(a){var b=v.offsetHeight,c=w.offsetHeight,d=A.btnBar?x.offsetHeight:0,e=parseInt(a.style.height,10)-b-c-d;s.style.lineHeight=e+"px",y.style.height=e+"px"},I=function(){var a=v.offsetHeight,b=w.offsetHeight,c=A.btnBar?x.offsetHeight:0,d=w.offsetWidth*2,e,f,g;if(A.html)e=Math.max(t.scrollHeight,t.clientHeight||0),f=Math.max(t.scrollWidth,t.clientWidth||0);else if(A.page&&!A.link){if(!r.dgDoc)return;g=j(r.dgDoc),e=Math.max(g.scrollHeight,g.clientHeight||0),f=Math.max(g.scrollWidth,g.clientWidth||0)}e=e+a+b+c,f=f+d,r.reDialogSize(f,e)},K=function(b){function o(d){for(var e=0,f=i.length;e<f;e++)a(i[e].document).unbind("mousemove",l),a(i[e].document).unbind("mouseup",o);c=null,b=null,A.fixed&&h&&C(r.dg),a.browser.msie&&r.dg.releaseCapture()}function l(a){var b={x:a.screenX,y:a.screenY};g={x:g.x+(b.x-c.x),y:g.y+(b.y-c.y)},c=b,A.rang&&(g.x<k.x&&(g.x=k.x),g.y<k.y&&(g.y=k.y),g.x>d&&(g.x=d),g.y>e&&(g.y=e)),r.dg.style.top=A.fixed&&!h?g.y-k.y+"px":g.y+"px",r.dg.style.left=A.fixed&&!h?g.x-k.x+"px":g.x+"px"}var c,d,e,g,i=z,j,k;a(b).bind("mousedown",function(b){if(b.target.id!=="lhgdg_xbtn_"+r.opt.id){j=n(),k=m();var p=r.dg.offsetLeft,q=r.dg.offsetTop,s=r.dg.clientWidth,t=r.dg.clientHeight;g=A.fixed&&!h?{x:p+k.x,y:q+k.y}:{x:p,y:q},c={x:b.screenX,y:b.screenY},d=j.w+k.x-s,e=j.h+k.y-t,r.dg.style.zIndex=parseInt(f,10)+1;for(var u=0,v=i.length;u<v;u++)a(i[u].document).bind("mousemove",l),a(i[u].document).bind("mouseup",o);b.preventDefault(),a.browser.msie&&r.dg.setCapture()}})},L=function(b){function o(d){for(var e=0,f=h.length;e<f;e++)a(h[e].document).unbind("mousemove",l),a(h[e].document).unbind("mouseup",o);c=null,b=null,a.browser.msie&&r.dg.releaseCapture()}function l(a){var b={x:a.screenX,y:a.screenY};i={w:b.x-c.x,h:b.y-c.y},i.w<200&&(i.w=200),i.h<100&&(i.h=100),r.dg.style.top=A.fixed?g.y-k.y+"px":g.y+"px",r.dg.style.left=A.fixed?g.x-k.x+"px":g.x+"px",r.reDialogSize(i.w,i.h)}var c,d,e,g,h=z,i,j,k;a(b).bind("mousedown",function(b){e=r.dg.clientWidth,d=r.dg.clientHeight,i={w:e,h:d},j=n(),k=m();var p=r.dg.offsetLeft,q=r.dg.offsetTop;g=A.fixed?{x:p+k.x,y:q+k.y}:{x:p,y:q},c={x:b.screenX-e,y:b.screenY-d},r.dg.style.zIndex=parseInt(f,10)+1;for(var s=0,t=h.length;s<t;s++)a(h[s].document).bind("mousemove",l),a(h[s].document).bind("mouseup",o);b.preventDefault(),a.browser.msie&&r.dg.setCapture()})},M=function(){r.dgFrm&&(A.link||a(r.dgFrm).unbind("load"),r.dgFrm.src="about:blank",r.dgFrm=null),z=[],a(r.dg).remove(),r.dg=null,s=t=u=v=w=x=y=null};r.ShowDialog=function(){if(a("#"+A.id,c)[0])return r;A.cover&&E();var b=A.fixed&&!h?"fixed":"absolute",d=D();r.dg=a(d,c).css({position:b,zIndex:k()}).appendTo(c.body)[0],s=a("#lhgdg_load_"+A.id,c)[0],t=a("#lhgdg_inbox_"+A.id,c)[0],u=a("#lhgdg_xbtn_"+A.id,c)[0],v=a("#lhgdg_drag_"+A.id,c)[0],w=a("#lhgdg_drop_"+A.id,c)[0],x=a("#lhgdg_btnBar_"+A.id,c)[0],y=a("#lhgdg_content_"+A.id,c)[0],H(r.dg),F(r.dg,A.top,A.left,A.fixed),G(r.dg),A.drag&&K(v),A.resize&&L(w);if(h){var e=a(r.dg).css("ie6png")==="true"?!0:!1;e&&a(r.dg).fixie6png()}A.html&&a.isFunction(A.dgOnLoad)&&A.dgOnLoad.call(r),A.html&&(s.style.display="none",t.style.display="",A.autoSize&&I()),A.btnBar&&A.cancelBtn&&r.addBtn("dgcancelBtn","取消",A.onCancel)},r.reDialogSize=function(b,c){a(r.dg).css({width:b+"px",height:c+"px"}),H(r.dg)},r.addBtn=function(b,d,e){if(A.btnBar)if(a("#lhgdg_"+A.id+"_"+b,c)[0])a("#lhgdg_"+A.id+"_"+b,c).html(d).click(e);else{var f='<div class="lhgdg_button"><button id="lhgdg_'+A.id+"_"+b+'">'+d+"</button></div>",g=a(f,c).bind("click",e)[0];a("#lhgdg_btnBar_"+A.id,c).append(g)}},r.removeBtn=function(b){a("#lhgdg_"+A.id+"_"+b,c)[0]&&a("#lhgdg_"+A.id+"_"+b,c).remove()},r.SetIndex=function(){r.dg.style.zIndex=parseInt(f,10)+1,f=parseInt(r.dg.style.zIndex,10);var a=l(r.dgWin);a.stopPropagation?a.stopPropagation():a.cancelBubble=!0},r.cancel=function(){M();if(e)if(A.parent&&A.parent.opt.cover){var a=A.parent.dg.style.zIndex;e.style.zIndex=parseInt(a,10)-1}else e.style.display="none";var b=l(r.dgWin);!b||(b.preventDefault?b.preventDefault():b.returnValue=!1)},r.cleanDialog=function(){r.dg&&M(),e&&(a(e).remove(),e=null)},A.onCancel=A.onCancel||r.cancel,A.onXclick=A.onXclick||r.cancel,q&&a(q).bind("click",r.ShowDialog),a(window).bind("unload",r.cleanDialog)},a(function(){var b=setTimeout(function(){(new a.dialog({id:"reLoadId",html:"lhgdialog",width:100,title:"reLoad",height:100,left:-9e3,btnBar:!1})).ShowDialog(),clearTimeout(b)},150)})})(lhgcore);
|