//\///// //\ overLIB Speech Bubble Plugin //\ Modified August 21, 2006 to reflect name change for 'createPopup' routine //\ Modified August 31, 2006 added the IMAGEPATH command to specify the directory where images are //\ //\ You may not remove or change this notice. //\ Copyright Erik Bosrup 1998-2003. All rights reserved. //\ Contributors are listed on the homepage. //\ See http://www.bosrup.com/web/overlib/ for details. //\///// //////// // PRE-INIT // Ignore these lines, configuration is below. //////// if (typeof olInfo == 'undefined' || typeof olInfo.meets == 'undefined' || !olInfo.meets(4.23)) alert('overLIB 4.23 or later is required for the Speech Bubble Plugin.'); else { registerCommands('bubble,bubbletype,adjbubble,imagepath'); var imgWidth=[250,330,144,202,200]; // image width in pixels var imgHeight=[150,160,190,221,66]; // image height in pixels var contentWidth=[200,250,130,184,190]; // image content width in pixels var contentHeight=[80,85,150,176,46]; // image content height in pixels var padLeft=[30,40,7,9,5]; // X displacement of content from image upper left corner var padTop=[25,48,10,34,4]; // Y displacement of content from image upper left corner var arwTipX=[180,50,51,9,19]; // x location of tip from image upper left corner var arwTipY=[148,5,180,221,64]; // y location of tip from image upper left corner //////// // DEFAULT CONFIGURATION // Settings you want everywhere are set here. All of this can also be // changed on your html page or through an overLIB call. //////// if (typeof ol_bubble=='undefined') var ol_bubble=0; if (typeof ol_bubbletype=='undefined') var ol_bubbletype=''; if (typeof ol_adjbubble=='undefined') var ol_adjbubble=0; if (typeof ol_imagepath=='undefined') var ol_imagepath='images/'; // images subdirectory var olBId, olBContentWd=contentWidth; //////// // END OF CONFIGURATION // Don't change anything below this line, all configuration is above. //////// //////// // INIT //////// // Runtime variables init. Don't change for config! var o3_bubble=0; var o3_bubbletype=''; var o3_adjbubble=0; var o3_imagepath=''; //////// // PLUGIN FUNCTIONS //////// function setBubbleVariables() { o3_bubble=ol_bubble; o3_bubbletype=ol_bubbletype; o3_adjbubble=ol_adjbubble; o3_imagepath=ol_imagepath; } // Parses Speech Bubble commands function parseBubbleExtras(pf,i,ar) { var k=i; if (k < ar.length) { if (ar[k]==BUBBLE) { eval(pf +'bubble=('+pf+'bubble==0) ? 1 : 0'); return k; } if (ar[k]==BUBBLETYPE) { eval(pf+'bubbletype="'+ar[++k]+'"'); return k; } if (ar[k]==ADJBUBBLE) { eval(pf +'adjbubble=('+pf+'adjbubble==0) ? 1 : 0'); return k; } if (ar[k]==IMAGEPATH) { eval(pf+'imagepath="'+ar[++k]+'"'); return k; } } return -1; } //////// // CHECKS FOR BUBBLE EFFECT //////// function chkForBubbleEffect() { if(o3_bubble) { o3_bubbletype=(o3_bubbletype) ? o3_bubbletype : 'flower'; registerImages('flower,oval,square,pushpin,quotation,roundcorners',o3_imagepath); // root names given to images (should be gif file) for (var i=0; i0||o3_fixy>0) o3_fixx=o3_fixy=-1; if(o3_relx||o3_rely) o3_relx=o3_rely=null; if(typeof o3_shadow!='undefined'&&o3_shadow) o3_shadow=0; if(o3_bubbletype!='roundcorners') { o3_width=olBContentWd[olBId]; if(o3_hpos==CENTER||o3_hpos==LEFT) o3_hpos=RIGHT; if(o3_vpos==ABOVE) o3_vpos=BELOW; if(o3_vauto) o3_vauto=0; if(o3_hauto) o3_hauto=0; if(o3_wrap) o3_wrap=0; } } return true; } //////// // BUBBLE EFFECT SUPPORTING ROUTINES //////// function registerImages(imgStr,path) { if(typeof imgStr!='string') return; if (/\/$/.test(path)) path=path.replace(/\/$/,''); if(typeof olBTypes=='undefined') olBTypes=imgStr.split(','); if(typeof olBubbleImg=='undefined') { olBubbleImg=new Array(); for (var i=0; i0) bPadDiff=parseInt(0.5*bHtDiff); Y=(bHtDiff<0) ? fc*bTopPad[olBId] : fc*bTopPad[olBId]+bPadDiff; X=fc*bLeftPad[olBId]; Y=Math.round(Y); X=Math.round(X); // txt=(olNs4) ? '
' : ((olIe55&&olHideForm) ? backDropSource(Math.round(fc*bWd[olBId]),Math.round((bHtDiff<0 ? fc*bHt[olBId]-bHtDiff : fc*bHt[olBId])),zIdx++) : '') + '
'; txt += '
'; txt += (olNs4 ? '
' : '
')+content+'
' // layerWrite(txt); if(olNs4) { var imgLyr=over.document.layers['bLayer']; var cLyr=over.document.layers['bContent']; imgLyr.zIndex=0; cLyr.zIndex=1; cLyr.top=Y; cLyr.left=X; } // Set popup's new width and height values here so they are available in placeLayer() o3_width=Math.round(fc*bWd[olBId]); o3_aboveheight=Math.round(fc*bHt[olBId]); if(fc*bArwTipY[olBId] < 0.5*fc*bHt[olBId]) sY = fc*bArwTipY[olBId]; else sY = -(fc*bHt[olBId]+20) o3_offsetx-=Math.round(fc*bArwTipX[olBId]); o3_offsety+=Math.round(sY); } function doRoundCorners(content) { var txt='', wd,ht, zIdx=0, o=olBubbleImg[olBId]; wd=(olNs4) ? over.clip.width : over.offsetWidth; ht=(olNs4) ? over.clip.height : over.offsetHeight; txt = (olIe55&&olHideForm) ? backDropSource(wd+28,ht+28,zIdx++) + '
' : ''; txt+= ''+ ''+ ''+ '
'+content+'
'; txt += (olIe55&&olHideForm) ? '
' : ''; layerWrite(txt); o3_width=wd+28; o3_aboveheight=ht+28; } function resizeBubble(h1, dF, fold) { var df,h2,fnew,alpha,cnt=0; while(cnt<2) { df=-signOf(h1)*dF; fnew=fold+df; h2=getHeightDiff(fnew)[0]; if(Math.abs(h2)\n\n<'+'\/style>'); } //end