⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 overlibmws.js

📁 groupoffice
💻 JS
📖 第 1 页 / 共 3 页
字号:
// Chooses LGF 
function OLdoLGF(){
return (o3_background!=''||o3_fullhtml)?OLcontentBackground(o3_text,o3_background,o3_fullhtml):
(o3_cap=="")?OLcontentSimple(o3_text):
(o3_sticky)?OLcontentCaption(o3_text,o3_cap,o3_close):OLcontentCaption(o3_text,o3_cap,'');
}

// Creates and writes layer content
function OLdoLyr(){
// Create content
if(o3_background==''&&!o3_fullhtml){
if(o3_fgbackground!='')o3_fgbackground=' background="'+o3_fgbackground+'"';
if(o3_bgbackground!='')o3_bgbackground=' background="'+o3_bgbackground+'"';
if(o3_cgbackground!='')o3_cgbackground=' background="'+o3_cgbackground+'"';
if(o3_fgcolor!='')o3_fgcolor=' bgcolor="'+o3_fgcolor+'"';
if(o3_bgcolor!='')o3_bgcolor=' bgcolor="'+o3_bgcolor+'"';
if(o3_cgcolor!='')o3_cgcolor=' bgcolor="'+o3_cgcolor+'"';
if(o3_height>0)o3_height=' height="'+o3_height+'"';else o3_height='';}
if(!OLns4)OLrepositionTo(over,(OLns6?20:0),0);
var lyrHtml=OLdoLGF();
// If sticky, initialize
if(o3_sticky){if(o3_timerid>0){clearTimeout(o3_timerid);o3_timerid=0;}
o3_showingsticky=1;o3_removecounter=0;}
// Write layer
if(o3_wrap&&!o3_fullhtml){
OLlayerWrite(lyrHtml);o3_width=(OLns4?over.clip.width:over.offsetWidth);
o3_wrap=0;if(o3_wrapmax>0&&o3_width>o3_wrapmax)o3_width=o3_wrapmax;lyrHtml=OLdoLGF();}
OLlayerWrite(lyrHtml);o3_width=(OLns4?over.clip.width:over.offsetWidth);
if(OLbubblePI&&o3_bubble)OLgenerateBubble(lyrHtml);
}

////////
// LAYER GENERATION FUNCTIONS
////////
// Makes simple table without caption
function OLcontentSimple(text){
var txt=
'<table'+(o3_wrap?'':' width="'+o3_width+'"')+o3_height+' border="0" cellpadding="'+o3_border
+'" cellspacing="0"'+(o3_bgclass?' class="'+o3_bgclass+'"':o3_bgcolor+o3_bgbackground)
+'><tr><td><table width="100%"'+o3_height+' border="0" cellpadding="'+o3_textpadding
+'" cellspacing="0"'+(o3_fgclass?' class="'+o3_fgclass+'"':o3_fgcolor+o3_fgbackground)
+'><tr><td valign="top"'+(o3_fgclass?' class="'+o3_fgclass+'"':'')+'>'
+OLlgfUtil(0,o3_textfontclass,'div',o3_textcolor,o3_textfont,o3_textsize)+text
+OLlgfUtil(1,'','div')+'</td></tr></table>'+((o3_base>0&&!o3_wrap)?
('<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td height="'+o3_base
+'"></td></tr></table>'):'')+'</td></tr></table>';
OLsetBackground('');
return txt;
}

// Makes table with caption and optional close link
function OLcontentCaption(text,title,close){
var closing='',closeevent='onmouseover',caption,maintxt,txt;
if(o3_closeclick==1)closeevent=(o3_closetitle?'title="'+o3_closetitle+'" ':'')+'onclick';
if(o3_capicon!='')o3_capicon='<img src="'+o3_capicon+'" /> ';
if(close!=''){closing='<td align="right"><a href="javascript:return '+OLfnRef+'cClick();" '
+closeevent+'="return '+OLfnRef+'cClick();"'+(o3_closefontclass?' class="'+o3_closefontclass
+'">':'>'+OLlgfUtil(0,'','span',o3_closecolor,o3_closefont,o3_closesize))+close
+(o3_closefontclass?'':OLlgfUtil(1,'','span'))+'</a></td>';}
caption='<table width="100%" border="0" cellpadding="'+o3_captionpadding+'" cellspacing="0"'
+(o3_cgclass?' class="'+o3_cgclass+'"':o3_cgcolor+o3_cgbackground)+'><tr><td'
+(o3_cgclass?' class="'+o3_cgclass+'">':'>')+(o3_captionfontclass?'<div class="'
+o3_captionfontclass+'">':'<strong>'
+OLlgfUtil(0,'','div',o3_capcolor,o3_captionfont,o3_captionsize))+o3_capicon+title
+OLlgfUtil(1,'','div')+(o3_captionfontclass?'':'</strong>')+'</td>'+closing+'</tr></table>';
maintxt='<table width="100%" '+o3_height+' border="0" cellpadding="'+o3_textpadding
+'" cellspacing="0"'+(o3_fgclass?' class="'+o3_fgclass+'"':o3_fgcolor+o3_fgbackground)
+'><tr><td valign="top"'+(o3_fgclass?' class="'+o3_fgclass+'"':'')+'>'
+OLlgfUtil(0,o3_textfontclass,'div',o3_textcolor,o3_textfont,o3_textsize)+text
+OLlgfUtil(1,'','div')+'</td></tr></table>';
txt='<table'+(o3_wrap?'':' width="'+o3_width+'"')+o3_height+' border="0" cellpadding="'
+o3_border+'" cellspacing="0"'+(o3_bgclass?' class="'+o3_bgclass+'"':o3_bgcolor+o3_bgbackground)
+'><tr><td>'+(o3_capbelow?maintxt+caption:caption+maintxt)+((o3_base>0&&!o3_wrap)?
('<table width="100%" border="0" cellpadding="0" cellspacing="0"><tr><td height="'+o3_base
+'"></td></tr></table>'):'')+'</td></tr></table>';
OLsetBackground('');
return txt;
}

// Sets the background picture, padding and lots more. :)
function OLcontentBackground(text, picture, hasfullhtml){
var txt;if(hasfullhtml){txt=text;}else{txt=
'<table'+(o3_wrap?'':' width="'+o3_width+'"')+' border="0" cellpadding="0" cellspacing="0" '
+'height="'+o3_height+'"><tr><td colspan="3" height="'+o3_padyt+'"></td></tr><tr><td width="'
+o3_padxl+'"></td><td valign="top"'+(o3_wrap?'':' width="'+(o3_width-o3_padxl-o3_padxr)+'"')+'>'
+OLlgfUtil(0,o3_textfontclass,'div',o3_textcolor,o3_textfont,o3_textsize)+text+
OLlgfUtil(1,'','div')+'</td><td width="'+o3_padxr+'"></td></tr><tr><td colspan="3" height="'
+o3_padyb+'"></td></tr></table>';}
OLsetBackground(picture);
return txt;
}

// LGF utility.
function OLlgfUtil(end,tfc,ele,col,fac,siz){
if(end)return ('</'+(OLns4?'font':ele)+'>');else return (tfc?'<div class="'+tfc+'">':
('<'+(OLns4?'font color="'+col+'" face="'+OLquoteMultiNameFonts(fac)+'" size="'+siz:ele
+' style="color:'+col+';font-family:'+OLquoteMultiNameFonts(fac)+';font-size:'+siz+';'
+(ele=='span'?'text-decoration:underline;':''))+'">'));
}

// Quotes multi-word font names
function OLquoteMultiNameFonts(theFont){
var i,v,pM=theFont.split(',');
for(i=0;i<pM.length;i++){v=pM[i];v=v.replace(/^\s+/,'').replace(/\s+$/,'');
if(/\s/.test(v) && !/['"]/.test(v)){v="\'"+v+"\'";pM[i]=v;}}
return pM.join();
}

// Loads a picture into the div.
function OLsetBackground(pic){
if(pic==''){if(OLns4)over.background.src=null;
else if(OLie4||OLns6){over.style.width='';over.style.backgroundImage='none';}
}else{if(OLns4)over.background.src=pic;else if(OLie4||OLns6){
over.style.width=o3_width+'px';over.style.backgroundImage='url('+pic+')';}}
}

////////
// HANDLING FUNCTIONS
////////
// Displays the popup
function OLdisp(statustext){
if(o3_allowmove==0){
if(OLshadowPI)OLdispShadow();if(OLiframePI)OLdispIfShim();
OLplaceLayer();o3_showid=setTimeout("OLshowObject(over)",1);
o3_allowmove=(o3_sticky||o3_nofollow)?0:1;}
if(statustext!="")self.status=statustext;
}

// Decides where we want the popup.
function OLplaceLayer(){
var snp,X,Y,pgLeft,pgTop,pWd=o3_width,pHt,iWd=100,iHt=100,SB=0,LM=0,CX=0,TM=0,BM=0,CY=0;
var o=OLfd(),nsb=(OLns6&&o3_frame.scrollbars&&!o3_frame.scrollbars.visible)?1:0;
// HORIZONTAL PLACEMENT
if(!OLkht&&o&&o.clientWidth)iWd=o.clientWidth;
else if(o3_frame.innerWidth){SB=Math.ceil(1.4*(o3_frame.outerWidth-o3_frame.innerWidth));
if(SB>20)SB=20;iWd=o3_frame.innerWidth;}
pgLeft=(OLie4)?o.scrollLeft:o3_frame.pageXOffset;
if(OLie55&&OLfilterPI&&o3_filtershadow)SB=CX=5;else
if((OLshadowPI)&&bkdrop&&o3_shadow&&o3_shadowx){SB+=((o3_shadowx>0)?o3_shadowx:0);
LM=((o3_shadowx<0)?Math.abs(o3_shadowx):0);CX=Math.abs(o3_shadowx);}
if(o3_ref!=""||o3_fixx> -1||o3_relx!=null||o3_midx!=null){
if(o3_ref!=""){
// Relative to a REFerence
X=OLrefXY[0];if(OLie55&&OLfilterPI&&o3_filtershadow){if(o3_refp=='UR'||o3_refp=='LR')X -= 5;}
else if((OLshadowPI)&&bkdrop&&o3_shadow&&o3_shadowx){  
if(o3_shadowx<0&&(o3_refp=='UL'||o3_refp=='LL'))X += o3_shadowx;
else if(o3_shadowx>0&&(o3_refp=='UR'||o3_refp=='LR'))X -= o3_shadowx;}
}else{if(o3_midx!=null){
// Middle of popup relative to middle of window
X=parseInt(pgLeft+((iWd-pWd-SB-LM)/2)+o3_midx);
}else{if(o3_relx!=null){
// Relative to window margins
if(o3_relx>=0)X=pgLeft+o3_relx+LM;else X=pgLeft+o3_relx+iWd-pWd-SB;
}else{
// Fixed position
X=o3_fixx+LM;}}}
}else{
// From mouse
if(o3_hauto){
if(o3_hpos==LEFT&&o3_x-pgLeft<iWd/2&&o3_x-pWd-o3_offsetx<pgLeft+LM)o3_hpos=RIGHT;else
if(o3_hpos==RIGHT&&o3_x-pgLeft>iWd/2&&o3_x+pWd+o3_offsetx>pgLeft+iWd-SB)o3_hpos=LEFT;}
X=(o3_hpos==CENTER)?parseInt(o3_x-((pWd+CX)/2)+o3_offsetx):
(o3_hpos==LEFT)?o3_x-o3_offsetx-pWd:o3_x+o3_offsetx;
if(o3_snapx>1){
// Snapping
snp=X % o3_snapx;
if(o3_hpos==LEFT){X=X-(o3_snapx+snp);}else{X=X+(o3_snapx-snp);}}}
if(!o3_nojustx&&X+pWd>pgLeft+iWd-SB)
// Justify
X=iWd+pgLeft-pWd-SB;if(!o3_nojustx&&X-LM<pgLeft)X=pgLeft+LM;
// VERTICAL PLACEMENT
pgTop=OLie4?o.scrollTop:o3_frame.pageYOffset;
if(!OLkht&&!nsb&&o&&o.clientHeight)iHt=o.clientHeight;
else if(o3_frame.innerHeight)iHt=o3_frame.innerHeight;
if(OLbubblePI&&o3_bubble)pHt=OLbubbleHt;else pHt=OLns4?over.clip.height:over.offsetHeight;
if((OLshadowPI)&&bkdrop&&o3_shadow&&o3_shadowy){TM=(o3_shadowy<0)?Math.abs(o3_shadowy):0;
if(OLie55&&OLfilterPI&&o3_filtershadow)BM=CY=5;else
BM=(o3_shadowy>0)?o3_shadowy:0;CY=Math.abs(o3_shadowy);}
if(o3_ref!=""||o3_fixy> -1||o3_rely!=null||o3_midy!=null){
if(o3_ref!=""){
// Relative to a REFerence
Y=OLrefXY[1];if(OLie55&&OLfilterPI&&o3_filtershadow){if(o3_refp=='LL'||o3_refp=='LR')Y -= 5;}
else if((OLshadowPI)&&bkdrop&&o3_shadow&&o3_shadowy){
if(o3_shadowy<0&&(o3_refp=='UL'||o3_refp=='UR'))Y+=o3_shadowy;else
if(o3_shadowy>0&&(o3_refp=='LL'||o3_refp=='LR'))Y-=o3_shadowy;}
}else{if(o3_midy!=null){
// Middle of popup relative to middle of window
Y=parseInt(pgTop+((iHt-pHt-CY)/2)+o3_midy);
}else{if(o3_rely!=null){
// Relative to window margins
if(o3_rely>=0)Y=pgTop+o3_rely+TM;else Y=pgTop+o3_rely+iHt-pHt-BM;}else{
// Fixed position
Y=o3_fixy+TM;}}}
}else{
// From mouse
if(o3_vauto){
if(o3_vpos==ABOVE&&o3_y-pgTop<iHt/2&&o3_y-pHt-o3_offsety<pgTop)o3_vpos=BELOW;else
if(o3_vpos==BELOW&&o3_y-pgTop>iHt/2&&o3_y+pHt+o3_offsety+((OLns4||OLkht)?17:0)>pgTop+iHt-BM)
o3_vpos=ABOVE;}Y=(o3_vpos==VCENTER)?parseInt(o3_y-((pHt+CY)/2)+o3_offsety):
(o3_vpos==ABOVE)?o3_y-(pHt+o3_offsety+BM):o3_y+o3_offsety+TM;
if(o3_snapy>1){
// Snapping
snp=Y % o3_snapy;
if(pHt>0&&o3_vpos==ABOVE){Y=Y-(o3_snapy+snp);}else{Y=Y+(o3_snapy-snp);}}}
if(!o3_nojusty&&Y+pHt+BM>pgTop+iHt)
// Justify
Y=pgTop+iHt-pHt-BM;if(!o3_nojusty&&Y-TM<pgTop)Y=pgTop+TM;
// Actually move the object.
OLrepositionTo(over,X,Y);if(OLns6&&o3_frame.innerHeight){
iHt=o3_frame.innerHeight;OLrepositionTo(over,X,Y);}
if(OLshadowPI)OLrepositionShadow(X,Y);
if(OLiframePI)OLrepositionIfShim(X,Y);
if(OLscrollPI)OLchkScroll(X-pgLeft,Y-pgTop);
}

// Chooses body or documentElement
function OLfd(f){
var fd=((f)?f:o3_frame).document,fdc=fd.compatMode,fdd=fd.documentElement;
return (!OLopr&&fdc&&fdc!='BackCompat'&&fdd&&fdd.clientWidth)?fd.documentElement:fd.body;
}

// Gets location of a REFerence object
function OLgetRefXY(ref){
var mn=ref,mref=OLgetRefById(mn,o3_frame.document),mkObj,of,refXY;
if(mref==null)mref=OLgetRefByName(mn,o3_frame.document);if(mref==null)return [null,null];
mkObj=mref;refXY=[o3_refx,o3_refy];
if(OLns4){if(typeof mref.length!='undefined'&&mref.length>1){
mkObj=mref[0];refXY[0]+=mref[0].x+mref[1].pageX;refXY[1]+=mref[0].y+mref[1].pageY;
}else{if((mref.toString().indexOf('Image')!= -1)||(mref.toString().indexOf('Anchor')!= -1)){
refXY[0]+=mref.x;refXY[1]+=mref.y;}else{refXY[0]+=mref.pageX;refXY[1]+=mref.pageY;}}
}else{refXY[0]+=OLpageLoc(mref,'Left');refXY[1]+=OLpageLoc(mref,'Top');}
of=OLgetRefOffsets(mkObj);refXY[0]+=of[0];refXY[1]+=of[1];
return refXY;
}

// Gets popup vs REFerence offsets
function OLgetRefOffsets(mkObj){
var mc=o3_refc.toUpperCase(),mp=o3_refp.toUpperCase(),mW=0,mH=0,pW=0,pH=0,off=[0,0];
pW=(OLbubblePI&&o3_bubble)?o3_width:OLns4?over.clip.width:over.offsetWidth;
pH=(OLbubblePI&&o3_bubble)?OLbubbleHt:OLns4?over.clip.height:over.offsetHeight;
if((!OLop7)&&mkObj.toString().indexOf('Image')!= -1){mW=mkObj.width;mH=mkObj.height;
}else if((!OLop7)&&mkObj.toString().indexOf('Anchor')!= -1){mc=o3_refc='UL';}else{
mW=(OLns4)?mkObj.clip.width:mkObj.offsetWidth;mH=(OLns4)?mkObj.clip.height:mkObj.offsetHeight;}
if(mc=='UL'){off=(mp=='UR')?[-pW,0]:(mp=='LL')?[0,-pH]:(mp=='LR')?[-pW,-pH]:[0,0];
}else if(mc=='UR'){off=(mp=='UR')?[mW-pW,0]:(mp=='LL')?[mW,-pH]:(mp=='LR')?[mW-pW,-pH]:[mW,0];
}else if(mc=='LL'){off=(mp=='UR')?[-pW,mH]:(mp=='LL')?[0,mH-pH]:(mp=='LR')?[-pW,mH-pH]:[0,mH];
}else if(mc=='LR'){off=(mp=='UR')?[mW-pW,mH]:(mp=='LL')?[mW,mH-pH]:(mp=='LR')?[mW-pW,mH-pH]:
[mW,mH];}
return off;
}

// Gets x or y location of object
function OLpageLoc(o,t){
var l=0;
while(o.offsetParent&&o.offsetParent.tagName.toLowerCase()!='html'){
l+=o['offset'+t];o=o.offsetParent;}l+=o['offset'+t];
return l;
} 

// Seeks REFerence by id
function OLgetRefById(l,d){
var r="",j;d=(d||document);
if(OLie4&&d.all){return d.all[l];}else if(d.getElementById){return d.getElementById(l);
}else if(d.layers&&d.layers.length>0){if(d.layers[l])return d.layers[l];
for(j=0;j<d.layers.length;j++){r=OLgetRefById(l,d.layers[j].document);if(r)return r;}}
return null;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -