1 |
- (function(b){function p(h,a,d){var c=a.positionTo,f=b(window).scrollTop();if(c){d=null;var g=0,e=0;"string"==typeof c?d=b(c):"object"==typeof c&&(d=b(c.slt),g=c.left||0,e=c.top||0);d.height();d.width();c=d.offset().top+e;d=d.offset().left+g}else c=b(window).height(),c=(c-h.height())/2+f,d=(d-h.width())/2;0>c&&(c=0);0>d&&(d=0);"fixed"==a.position?h.css({position:"fixed",margin:"0 0 0 0",zIndex:a.zIndex+1,top:c-f,left:d,display:"block"}):h.css({position:"absolute",margin:"0 0 0 0",zIndex:a.zIndex+1,top:c,left:d,display:"block"});a.dymamic&&h.hide().fadeIn(a.speed);a.dymamicOff&&(a.dymamic=!0)}var e=null;b.fn.openDialog=function(h){if(0==this.size())return null;var a={dymamic:!1,dymamicOff:!1,opacity:.7,backgroundColor:"#000",positionTo:"",speed:240,clickOtherClose:!0,border:!1,width:"",height:"",draw:void 0,position:"absolute",closedFunc:function(){}};h&&(a=b.extend(a,h));"ui"!=a.dialogType&&(e=a);b(this).css("width",a.width);b(this).css("height",a.height);h=b(document).width();var d=b(document).height(),c=this,f=!!a.zIndex;a.zIndex=a.zIndex||2E3;if(a.border)var g=c.show().width(),c=c.wrap('\x3cdiv style\x3d"position: relative;width:'+g+'px" class\x3d"popwrap"\x3e\x3cdiv class\x3d"popcon faceImg_pop"\x3e\x3c/div\x3e\x3c/div\x3e').parent().after('\x3cb class\x3d"bg_mask" style\x3d"width:'+(g+20)+'px"\x3e\x3c/b\x3e').parent();b(this).data("p",e);g=b(c[0].tagName+".open_dialog_jquery");0<g.size()&&(g=g.toArray().sort(function(a,c){return b(a).css("zIndex")<b(c).css("zIndex")}),f||(f=b(g[0]).css("zIndex"),f="auto"==f?a.zIndex:f,a.zIndex=parseInt(f)+2));b(this).addClass("open_dialog_jquery");g=a.zIndex-1;f=b(this).attr("bgid");f||(f="#bg_x_"+g,b(this).attr("bgid",f));a.backgroundColor&&(0==b(f).size()?b("body").append('\x3cdiv style\x3d"position:absolute;left:0px;top:0px;width:100%;height:'+d+"px;background-color:"+a.backgroundColor+";z-index:"+(g-1)+";display:none;\" id\x3d'"+f.substring(1)+"'\x3e\x3c/div\x3e"):b(f).css("height",b(document).height()));c.hide();a.backgroundColor&&(a.dymamic?b(f).fadeTo(0,0).show().fadeTo(a.speed,a.opacity):(g=b(f),g.attr("isOpacity")||(g.fadeTo(0,a.opacity),g.attr("isOpacity",!0)),g.css("display","block")));p(c,a,h,d);if(e&&e.clickOtherClose)b(f).one("click",function(){b(c).closeDialog();if("function"==typeof e.onclose)e.onclose()});if(e&&e.close)c.find(e.close).one("click",function(){b(c).closeDialog();return!1});if(e&&e.draw){var k=b(this).find(e.draw);if(!k.attr("draw")){k.attr("draw",!0);var m,n,l=k.parent();k.mousedown(function(a){k.css("cursor","move");k.isDraw=!0;m=a.clientX-l.offset().left;n=a.clientY+b(window).scrollTop()-l.offset().top});b(document).mouseup(function(){k.css("cursor","");k.isDraw=!1}).mousemove(function(a){k.isDraw&&l.css({left:a.clientX-m,top:a.clientY+b(window).scrollTop()-n})})}}};b.fn.closeDialog=function(e){var a=b(this).data("p");a.dymamic?this.fadeOut(a.speed):this.hide();this.removeClass("open_dialog_jquery");var d=b(this).attr("bgid");if(a&&0<b(d).length&&(a.dymamic?b(d).fadeOut(a.speed,function(){"function"==typeof e&&e()}):(b(d).hide(),"function"==typeof e&&e()),"function"==typeof a.onclose))a.onclose();return this}})(jQuery);
|