phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] property/inc overlib.js,1.4


From: sigurdne
Subject: [Phpgroupware-cvs] property/inc overlib.js,1.4
Date: Tue, 3 May 2005 15:46:00 +0200

Update of property/inc

Modified Files:
     Branch: MAIN
            overlib.js lines: +289 -170

Log Message:
no message

====================================================
Index: property/inc/overlib.js
diff -u property/inc/overlib.js:1.3 property/inc/overlib.js:1.4
--- property/inc/overlib.js:1.3 Tue Sep 28 08:17:44 2004
+++ property/inc/overlib.js     Tue May  3 13:46:52 2005
@@ -1,5 +1,5 @@
 //\/////
-//\  overLIB 4.06 - You may not remove or change this notice.
+//\  overLIB 4.17 - You may not remove or change this notice.
 //\  Copyright Erik Bosrup 1998-2004. All rights reserved.
 //\
 //\  Contributors are listed on the homepage.
@@ -22,9 +22,11 @@
 // PRE-INIT
 // Ignore these lines, configuration is below.
 ////////
-var olLoaded = 0;var pmStart = 10000000; var pmUpper = 10001000; var pmCount = 
pmStart+1;  var pms = new Array(); var olInfo = new Info('4.06', 1);
-var FREPLACE = 0; var FBEFORE = 1; var FAFTER = 2; var FALTERNATE = 3;
+var olLoaded = 0;var pmStart = 10000000; var pmUpper = 10001000; var pmCount = 
pmStart+1; var pmt=''; var pms = new Array(); var olInfo = new Info('4.17', 1);
+var FREPLACE = 0; var FBEFORE = 1; var FAFTER = 2; var FALTERNATE = 3; var 
FCHAIN=4;
 var olHideForm=0;  // parameter for hiding SELECT and ActiveX elements in 
IE5.5+
+var olHautoFlag = 0;  // flags for over-riding VAUTO and HAUTO if corresponding
+var olVautoFlag = 0;  // positioning commands are used on the command line
 
registerCommands('donothing,inarray,caparray,sticky,background,noclose,caption,left,right,center,offsetx,offsety,fgcolor,bgcolor,textcolor,capcolor,closecolor,width,border,cellpad,status,autostatus,autostatuscap,height,closetext,snapx,snapy,fixx,fixy,relx,rely,fgbackground,bgbackground,padx,pady,fullhtml,above,below,capicon,textfont,captionfont,closefont,textsize,captionsize,closesize,timeout,function,delay,hauto,vauto,closeclick,wrap,followmouse,mouseoff,closetitle,cssoff,compatmode,cssclass,fgclass,bgclass,textfontclass,captionfontclass,closefontclass');

 ////////
@@ -185,12 +187,14 @@
 // Our layer
 var over = null;
 var fnRef, hoveringSwitch = false;
+var olHideDelay;

 // Decide browser version
 var isMac = (navigator.userAgent.indexOf("Mac") != -1);
-var olOp=(navigator.userAgent.toLowerCase().indexOf('opera') > -1 && 
document.createTextNode);  // Opera 7
+var olOp = (navigator.userAgent.toLowerCase().indexOf('opera') > -1 && 
document.createTextNode);  // Opera 7
 var olNs4 = (navigator.appName=='Netscape' && parseInt(navigator.appVersion) 
== 4);
 var olNs6 = (document.getElementById) ? true : false;
+var olKq = (olNs6 && /konqueror/i.test(navigator.userAgent));
 var olIe4 = (document.all) ? true : false;
 var olIe5 = false;
 var olIe55 = false; // Added additional variable to identify IE5.5+
@@ -205,16 +209,16 @@

 // Microsoft Stupidity Check(tm).
 if (olIe4) {
-       var agent=navigator.userAgent;
+       var agent = navigator.userAgent;
        if (/MSIE/.test(agent)) {
-               var versNum=parseFloat(agent.match(/MSIE (\d\.\d+)\.*/)[1]);
+               var versNum = parseFloat(agent.match(/MSIE[ 
](\d\.\d+)\.*/i)[1]);
                if (versNum >= 5){
                        olIe5=true;
                        olIe55=(versNum>=5.5&&!olOp) ? true : false;
                        if (olNs6) olNs6=false;
                }
        }
-       if (olNs6) olIe4=false;
+       if (olNs6) olIe4 = false;
 }

 // Check for compatability mode.
@@ -224,8 +228,8 @@

 // Add window onload handlers to indicate when all modules have been loaded
 // For Netscape 6+ and Mozilla, uses addEventListener method on the window 
object
-// For IE it uses the attachEvent method of the window object
-
+// For IE it uses the attachEvent method of the window object and for Netscape 
4.x
+// it sets the window.onload handler to the OLonload_handler function for 
Bubbling
 if(window.addEventListener) 
window.addEventListener("load",OLonLoad_handler,false);
 else if (window.attachEvent) window.attachEvent("onload",OLonLoad_handler);

@@ -249,9 +253,13 @@
 function overlib() {
        if (!olLoaded || isExclusive(overlib.arguments)) return true;
        if (olCheckMouseCapture) olMouseCapture();
-       if (over) cClick();
+       if (over) {
+               over = (typeof over.id != 'string') ? 
o3_frame.document.all['overDiv'] : over;
+               cClick();
+       }

        // Load defaults to runtime.
+  olHideDelay=0;
        o3_text=ol_text;
        o3_cap=ol_cap;
        o3_sticky=ol_sticky;
@@ -318,13 +326,7 @@
        // Special for frame support, over must be reset...
        o3_frame = ol_frame;

-       if (olNs4) {
-               over = o3_frame.document.layers['overDiv'];
-       } else if (document.all) {
-               over = o3_frame.document.all['overDiv'];
-       } else if (document.getElementById) {
-               over = o3_frame.document.getElementById("overDiv");
-       }
+       if(!(over=createDivContainer())) return false;

        parseTokens('o3_', overlib.arguments);
        if (!postParseChecks()) return false;
@@ -340,11 +342,8 @@
 // Clears popups if appropriate
 function nd(time) {
        if (olLoaded && !isExclusive()) {
-               if (time && !o3_delay) {
-                       if (o3_timerid > 0) clearTimeout(o3_timerid);
-
-                       o3_timerid = setTimeout("cClick()",(o3_timeout = time));
-               }
+               hideDelay(time);  // delay popup close if time specified
+
                if (o3_removecounter >= 1) { o3_showingsticky = 0 };

                if (o3_showingsticky == 0) {
@@ -478,7 +477,7 @@
                o3_capicon='<img src=\"'+o3_capicon+'\"'+nameId+' />';
        }

-       if (close != "")
+       if (close != "")
                closing='<td '+(!o3_compatmode && o3_closefontclass ? 
'class="'+o3_closefontclass : 'align="RIGHT')+'"><a href="javascript:return 
'+fnRef+'cClick();"'+((o3_compatmode && o3_closefontclass) ? ' class="' + 
o3_closefontclass + '" ' : ' ')+closeevent+'="return 
'+fnRef+'cClick();">'+(o3_closefontclass ? '' : 
wrapStr(0,o3_closesize,'close'))+close+(o3_closefontclass ? '' : 
wrapStr(1,o3_closesize,'close'))+'</a></td>';
        txt='<table width="'+o3_width+ '" border="0" 
cellpadding="'+o3_border+'" cellspacing="0" '+(o3_bgclass ? 
'class="'+o3_bgclass+'"' : o3_bgcolor+' '+o3_bgbackground+' 
'+o3_height)+'><tr><td><table width="100%" border="0" cellpadding="0" 
cellspacing="0"><tr><td'+(o3_captionfontclass ? ' 
class="'+o3_captionfontclass+'">' : '>')+(o3_captionfontclass ? '' : 
'<b>'+wrapStr(0,o3_captionsize,'caption'))+o3_capicon+title+(o3_captionfontclass
 ? '' : wrapStr(1,o3_captionsize)+'</b>')+'</td>'+closing+'</tr></table><table 
width="100%" border="0" cellpadding="' + o3_cellpad + '" cellspacing="0" 
'+(o3_fgclass ? 'class="'+o3_fgclass+'"' : o3_fgcolor+' '+o3_fgbackground+' 
'+o3_height)+'><tr><td valign="TOP"'+(o3_textfontclass ? ' 
class="'+o3_textfontclass+'">' :'>')+(o3_textfontclass ? '' : 
wrapStr(0,o3_textsize,'text'))+text+(o3_textfontclass ? '' : 
wrapStr(1,o3_textsize)) + '</td></tr></table></td></tr></table>';

@@ -510,6 +509,7 @@
                if (olNs4) {
                        over.background.src = pic;
                } else if (over.style) {
+                       over.style.width=o3_width + 'px';
                        over.style.backgroundImage = "url("+pic+")";
                }
        }
@@ -539,12 +539,16 @@
 function createPopup(lyrContent){
        runHook("createPopup", FBEFORE);

-       if (o3_wrap && !(olNs4 || olOp)) {
-               if (olIe4) {
-                       over.style.pixelWidth = 0;
-               } else if (olNs6) {
-                       repositionTo(over, 0, -over.offsetHeight);
-               }
+       if (o3_wrap) {
+               var wd,ww,theObj = (olNs4 ? over : over.style);
+               theObj.top = theObj.left = ((olIe4&&!olOp) ? 0 : -10000) + 
(!olNs4 ? 'px' : 0);
+               layerWrite(lyrContent);
+               wd = (olNs4 ? over.clip.width : over.offsetWidth);
+               if (wd > (ww=windowWidth())) {
+                       lyrContent=lyrContent.replace(/\&nbsp;/g, ' ');
+                       o3_width=ww;
+                       o3_wrap=0;
+               }
        }

        layerWrite(lyrContent);
@@ -561,114 +565,25 @@
 function placeLayer() {
        var placeX, placeY, widthFix = 0;

-       // HORIZONTAL PLACEMENT
-       if (eval('o3_frame.'+docRoot) && eval("typeof 
o3_frame."+docRoot+".clientWidth=='number'") && 
eval('o3_frame.'+docRoot+'.clientWidth')) {
-               iwidth = eval('o3_frame.'+docRoot+'.clientWidth');
-       } else if (typeof(o3_frame.innerWidth) == 'number') {
-               widthFix = Math.ceil(1.2*(o3_frame.outerWidth - 
o3_frame.innerWidth));
-               iwidth = o3_frame.innerWidth;
-       }
+       // HORIZONTAL PLACEMENT, re-arranged to work in Safari
+       if (o3_frame.innerWidth) widthFix=18;
+       iwidth = windowWidth();

        // Horizontal scroll offset
        winoffset=(olIe4) ? eval('o3_frame.'+docRoot+'.scrollLeft') : 
o3_frame.pageXOffset;
-       var parsedWidth = parseInt(o3_width);
-
-       if (o3_fixx > -1 || o3_relx != null) {
-               // Fixed position
-               placeX=(o3_relx != null ? ( o3_relx < 0 ? winoffset +o3_relx+ 
iwidth - parsedWidth - widthFix : winoffset+o3_relx) : o3_fixx);
-       } else {
-               // If HAUTO, decide what to use.
-               if (o3_hauto == 1) {
-                       if ((o3_x - winoffset) > (iwidth / 2)) {
-                               o3_hpos = LEFT;
-                       } else {
-                               o3_hpos = RIGHT;
-                       }
-               }
-
-               // From mouse
-               if (o3_hpos == CENTER) { // Center
-                       placeX = o3_x+o3_offsetx-(parsedWidth/2);

-                       if (placeX < winoffset) placeX = winoffset;
-               }
-
-               if (o3_hpos == RIGHT) { // Right
-                       placeX = o3_x+o3_offsetx;
-
-                       if ((placeX+parsedWidth) > (winoffset+iwidth - 
widthFix)) {
-                               placeX = iwidth+winoffset - parsedWidth - 
widthFix;
-                               if (placeX < 0) placeX = 0;
-                       }
-               }
-               if (o3_hpos == LEFT) { // Left
-                       placeX = o3_x-o3_offsetx-parsedWidth;
-                       if (placeX < winoffset) placeX = winoffset;
-               }
-
-               // Snapping!
-               if (o3_snapx > 1) {
-                       var snapping = placeX % o3_snapx;
-
-                       if (o3_hpos == LEFT) {
-                               placeX = placeX - (o3_snapx+snapping);
-                       } else {
-                               // CENTER and RIGHT
-                               placeX = placeX+(o3_snapx - snapping);
-                       }
-
-                       if (placeX < winoffset) placeX = winoffset;
-               }
-       }
+       placeX = 
runHook('horizontalPlacement',FCHAIN,iwidth,winoffset,widthFix);

-       // VERTICAL PLACEMENT
-       if (eval('o3_frame.'+docRoot) && eval("typeof 
o3_frame."+docRoot+".clientHeight=='number'") && 
eval('o3_frame.'+docRoot+'.clientHeight')) {
-               iheight = eval('o3_frame.'+docRoot+'.clientHeight');
-       } else if (typeof(o3_frame.innerHeight)=='number') {
-               iheight = o3_frame.innerHeight;
-       }
+       // VERTICAL PLACEMENT, re-arranged to work in Safari
+       if (o3_frame.innerHeight) {
+               iheight=o3_frame.innerHeight;
+       } else if (eval('o3_frame.'+docRoot)&&eval("typeof 
o3_frame."+docRoot+".clientHeight=='number'")&&eval('o3_frame.'+docRoot+'.clientHeight'))
 {
+               iheight=eval('o3_frame.'+docRoot+'.clientHeight');
+       }

        // Vertical scroll offset
        scrolloffset=(olIe4) ? eval('o3_frame.'+docRoot+'.scrollTop') : 
o3_frame.pageYOffset;
-       var parsedHeight=(o3_aboveheight ? parseInt(o3_aboveheight) : (olNs4 ? 
over.clip.height : over.offsetHeight));
-
-       if (o3_fixy > -1 || o3_rely != null) {
-               // Fixed position
-               placeY=(o3_rely != null ? (o3_rely < 0 ? 
scrolloffset+o3_rely+iheight - parsedHeight : scrolloffset+o3_rely) : o3_fixy);
-       } else {
-               // If VAUTO, decide what to use.
-               if (o3_vauto == 1) {
-                       if ((o3_y - scrolloffset) > (iheight/2)) {
-                               o3_vpos = ABOVE;
-                       } else {
-                               o3_vpos = BELOW;
-                       }
-               }
-
-               // From mouse
-               if (o3_vpos == ABOVE) {
-                       if (o3_aboveheight == 0) o3_aboveheight = parsedHeight;
-
-                       placeY = o3_y - (o3_aboveheight+o3_offsety);
-                       if (placeY < scrolloffset) placeY = scrolloffset;
-               } else {
-                       // BELOW
-                       placeY = o3_y+o3_offsety;
-               }
-
-               // Snapping!
-               if (o3_snapy > 1) {
-                       var snapping = placeY % o3_snapy;
-
-                       if (o3_aboveheight > 0 && o3_vpos == ABOVE) {
-                               placeY = placeY - (o3_snapy+snapping);
-                       } else {
-                               placeY = placeY+(o3_snapy - snapping);
-                       }
-
-                       if (placeY < scrolloffset) placeY = scrolloffset;
-               }
-       }
+       placeY = runHook('verticalPlacement',FCHAIN,iheight,scrolloffset);

        // Actually move the object.
        repositionTo(over, placeX, placeY);
@@ -690,7 +605,7 @@

        // MouseOut handler
        if (hoveringSwitch && !olNs4 && runHook("cursorOff", FREPLACE)) {
-               cClick();
+               (olHideDelay ? hideDelay(olHideDelay) : cClick());
                hoveringSwitch = !hoveringSwitch;
        }
 }
@@ -701,18 +616,40 @@
 // Capture the mouse and chain other scripts.
 function olMouseCapture() {
        capExtent = document;
-       var fN, mseHandler = olMouseMove;
-       var re = /function[ ]+(\w+)\(/;
+       var fN, str = '', l, k, f, wMv, sS, mseHandler = olMouseMove;
+       var re = /function[ ]*(\w*)\(/;

-       if (document.onmousemove || (!olIe4 && window.onmousemove)) {
-               if (window.onmousemove) capExtent = window;
-               fN = capExtent.onmousemove.toString().match(re);
-
-               if (fN || fN[1] == 'anonymous' || fN[1] == 'olMouseMove') {
-                       olCheckMouseCapture = false;
-                       return;
+       wMv = (!olIe4 && window.onmousemove);
+       if (document.onmousemove || wMv) {
+               if (wMv) capExtent = window;
+               f = capExtent.onmousemove.toString();
+               fN = f.match(re);
+               if (fN == null) {
+                       str = f+'(e); ';
+               } else if (fN[1] == 'anonymous' || fN[1] == 'olMouseMove' || 
(wMv && fN[1] == 'onmousemove')) {
+                       if (!olOp && wMv) {
+                               l = f.indexOf('{')+1;
+                               k = f.lastIndexOf('}');
+                               sS = f.substring(l,k);
+                               if ((l = sS.indexOf('(')) != -1) {
+                                       sS = 
sS.substring(0,l).replace(/^\s+/,'').replace(/\s+$/,'');
+                                       if (eval("typeof " + sS + " == 
'undefined'")) window.onmousemove = null;
+                                       else str = sS + '(e);';
+                               }
+                       }
+                       if (!str) {
+                               olCheckMouseCapture = false;
+                               return;
+                       }
+               } else {
+                       if (fN[1]) str = fN[1]+'(e); ';
+                       else {
+                               l = f.indexOf('{')+1;
+                               k = f.lastIndexOf('}');
+                               str = f.substring(l,k) + '\n';
+                       }
                }
-               var str = fN[1]+'(e); ' + 'olMouseMove(e); ';
+               str += 'olMouseMove(e); ';
                mseHandler = new Function('e', str);
        }

@@ -720,7 +657,6 @@
        if (olNs4) capExtent.captureEvents(Event.MOUSEMOVE);
 }

-
 ////////
 // PARSING FUNCTIONS
 ////////
@@ -757,7 +693,7 @@
                        if (ar[i]==BACKGROUND) { 
eval(pf+'background="'+ar[++i]+'"'); continue; }
                        if (ar[i]==NOCLOSE) { if (pf!='ol_') opt_NOCLOSE(); 
continue; }
                        if (ar[i]==CAPTION) { 
eval(pf+"cap='"+escSglQuote(ar[++i])+"'"); continue; }
-                       if (ar[i]==CENTER || ar[i]==LEFT || ar[i]==RIGHT) { 
eval(pf+'hpos='+ar[i]); continue; }
+                       if (ar[i]==CENTER || ar[i]==LEFT || ar[i]==RIGHT) { 
eval(pf+'hpos='+ar[i]); if(pf!='ol_') olHautoFlag=1; continue; }
                        if (ar[i]==OFFSETX) { eval(pf+'offsetx='+ar[++i]); 
continue; }
                        if (ar[i]==OFFSETY) { eval(pf+'offsety='+ar[++i]); 
continue; }
                        if (ar[i]==FGCOLOR) { eval(pf+'fgcolor="'+ar[++i]+'"'); 
continue; }
@@ -784,7 +720,7 @@
                        if (ar[i]==PADX) { eval(pf+'padxl='+ar[++i]); 
eval(pf+'padxr='+ar[++i]); continue; }
                        if (ar[i]==PADY) { eval(pf+'padyt='+ar[++i]); 
eval(pf+'padyb='+ar[++i]); continue; }
                        if (ar[i]==FULLHTML) { if (pf!='ol_') 
eval(pf+'fullhtml=1'); continue; }
-                       if (ar[i]==BELOW || ar[i]==ABOVE) { 
eval(pf+'vpos='+ar[i]); continue; }
+                       if (ar[i]==BELOW || ar[i]==ABOVE) { 
eval(pf+'vpos='+ar[i]); if (pf!='ol_') olVautoFlag=1; continue; }
                        if (ar[i]==CAPICON) { eval(pf+'capicon="'+ar[++i]+'"'); 
continue; }
                        if (ar[i]==TEXTFONT) { 
eval(pf+"textfont='"+escSglQuote(ar[++i])+"'"); continue; }
                        if (ar[i]==CAPTIONFONT) { 
eval(pf+"captionfont='"+escSglQuote(ar[++i])+"'"); continue; }
@@ -800,7 +736,7 @@
                        if (ar[i]==CLOSECLICK) { eval(pf 
+'closeclick=('+pf+'closeclick == 0) ? 1 : 0'); continue; }
                        if (ar[i]==WRAP) { eval(pf +'wrap=('+pf+'wrap == 0) ? 1 
: 0'); continue; }
                        if (ar[i]==FOLLOWMOUSE) { eval(pf 
+'followmouse=('+pf+'followmouse == 1) ? 0 : 1'); continue; }
-                       if (ar[i]==MOUSEOFF) { eval(pf 
+'mouseoff=('+pf+'mouseoff == 0) ? 1 : 0'); continue; }
+                       if (ar[i]==MOUSEOFF) { eval(pf 
+'mouseoff=('+pf+'mouseoff==0) ? 1 : 0'); v=ar[i+1]; if (pf != 'ol_' && 
eval(pf+'mouseoff') && typeof v == 'number' && (v < pmStart || v > pmUpper)) 
olHideDelay=ar[++i]; continue; }
                        if (ar[i]==CLOSETITLE) { 
eval(pf+"closetitle='"+escSglQuote(ar[++i])+"'"); continue; }
                        if (ar[i]==CSSOFF||ar[i]==CSSCLASS) { 
eval(pf+'css='+ar[i]); continue; }
                        if (ar[i]==COMPATMODE) { 
eval(pf+'compatmode=('+pf+'compatmode==0) ? 1 : 0'); continue; }
@@ -818,11 +754,9 @@
        if ((pf == 'o3_') && o3_wrap) {
                o3_width = 0;

-               if (olOp || (olIe4 && isMac)) {
-                       var tReg=/<.*\n*>/ig;
-                       if (!tReg.test(o3_text)) o3_text = o3_text.replace(/[ 
]+/g, '&nbsp;');
-                       if (!tReg.test(o3_cap))o3_cap = o3_cap.replace(/[ ]+/g, 
'&nbsp;');
-               }
+               var tReg=/<.*\n*>/ig;
+               if (!tReg.test(o3_text)) o3_text = o3_text.replace(/[ ]+/g, 
'&nbsp;');
+               if (!tReg.test(o3_cap))o3_cap = o3_cap.replace(/[ ]+/g, 
'&nbsp;');
        }
        if ((pf == 'o3_') && o3_sticky) {
                if (!o3_close && (o3_frame != ol_frame)) o3_close = ol_close;
@@ -839,7 +773,7 @@
 function layerWrite(txt) {
        txt += "\n";
        if (olNs4) {
-               var lyr = o3_frame.document.overDiv.document
+               var lyr = o3_frame.document.layers['overDiv'].document
                lyr.write(txt)
                lyr.close()
        } else if (typeof over.innerHTML != 'undefined') {
@@ -875,6 +809,7 @@
        var theObj=(olNs4 ? obj : obj.style);
        if (olNs6 && olShowId>0) { clearTimeout(olShowId); olShowId=0; }
        theObj.visibility = 'hidden';
+       theObj.top = theObj.left = ((olIe4&&!olOp) ? 0 : -10000) + (!olNs4 ? 
'px' : 0);

        if (o3_timerid > 0) clearTimeout(o3_timerid);
        if (o3_delayid > 0) clearTimeout(o3_delayid);
@@ -883,9 +818,9 @@
        o3_delayid = 0;
        self.status = "";

-       if (over.onmouseout || over.onmouseover) {
-               if (olNs4) over.releaseEvents(Event.MOUSEOUT || 
Event.MOUSEOVER);
-               over.onmouseout = over.onmouseover = null;
+       if (obj.onmouseout || obj.onmouseover) {
+               if (olNs4) obj.releaseEvents(Event.MOUSEOUT || Event.MOUSEOVER);
+               obj.onmouseout = obj.onmouseover = null;
        }

        runHook("hideObject", FAFTER);
@@ -902,8 +837,8 @@
 function cursorOff() {
        var left = parseInt(over.style.left);
        var top = parseInt(over.style.top);
-       var right=left+(over.offsetWidth >= parseInt(o3_width) ? 
over.offsetWidth : parseInt(o3_width));
-       var bottom=top+(over.offsetHeight >= o3_aboveheight ? over.offsetHeight 
: o3_aboveheight);
+       var right = left + (over.offsetWidth >= parseInt(o3_width) ? 
over.offsetWidth : parseInt(o3_width));
+       var bottom = top + (over.offsetHeight >= o3_aboveheight ? 
over.offsetHeight : o3_aboveheight);

        if (o3_x < left || o3_x > right || o3_y < top || o3_y > bottom) return 
true;

@@ -929,7 +864,7 @@
        if (olNs4) {
                over.captureEvents(Event.MOUSEOUT || Event.MOUSEOVER);
                over.onmouseover = function () { if (o3_timerid > 0) { 
clearTimeout(o3_timerid); o3_timerid = 0; } }
-               over.onmouseout = cClick;
+               over.onmouseout = function (e) { if (olHideDelay) 
hideDelay(olHideDelay); else cClick(e); }
        } else {
                over.onmouseover = function () {hoveringSwitch = true; if 
(o3_timerid > 0) { clearTimeout(o3_timerid); o3_timerid =0; } }
        }
@@ -939,21 +874,16 @@

 // Function to scan command line arguments for multiples
 function opt_MULTIPLEARGS(i, args, parameter) {
-  var k = i, l, re, pV, str = '';
+  var k=i, re, pV, str='';

   for(k=i; k<args.length; k++) {
+               if(typeof args[k] == 'number' && args[k]>pmStart) break;
                str += args[k] + ',';
-               if(typeof args[k] == 'number'&&args[k]>pmStart) break;
        }
-  if(k >= args.length) l = str.length-1;
-  else {
-    re = eval('/,' + args[k] + '/');
-    l = str.search(re);
-  }
+       if (str) str = str.substring(0,--str.length);

        k--;  // reduce by one so the for loop this is in works correctly
-       str = str.substring(0, l);
-       pV = (olNs4&&/cellpad/i.test(parameter)) ? str.split(',')[0] : str;
+       pV=(olNs4 && /cellpad/i.test(parameter)) ? str.split(',')[0] : str;
        eval(parameter + '="' + pV + '"');

        return k;
@@ -961,7 +891,7 @@

 // Remove &nbsp; in texts when done.
 function nbspCleanup() {
-       if (o3_wrap && (olOp || (olIe4 && isMac))) {
+       if (o3_wrap) {
                o3_text = o3_text.replace(/\&nbsp;/g, ' ');
                o3_cap = o3_cap.replace(/\&nbsp;/g, ' ');
        }
@@ -1032,6 +962,171 @@
 function isExclusive(args) {
        return false;
 }
+
+// function will delay close by time milliseconds
+function hideDelay(time) {
+       if (time&&!o3_delay) {
+               if (o3_timerid > 0) clearTimeout(o3_timerid);
+
+               o3_timerid=setTimeout("cClick()",(o3_timeout=time));
+       }
+}
+
+// Was originally in the placeLayer() routine; separated out for future ease
+function horizontalPlacement(browserWidth, horizontalScrollAmount, widthFix) {
+       var placeX, iwidth=browserWidth, winoffset=horizontalScrollAmount;
+       var parsedWidth = parseInt(o3_width);
+
+       if (o3_fixx > -1 || o3_relx != null) {
+               // Fixed position
+               placeX=(o3_relx != null ? ( o3_relx < 0 ? winoffset +o3_relx+ 
iwidth - parsedWidth - widthFix : winoffset+o3_relx) : o3_fixx);
+       } else {
+               // If HAUTO, decide what to use.
+               if (o3_hauto == 1) {
+                       if ((o3_x - winoffset) > (iwidth / 2)) {
+                               o3_hpos = LEFT;
+                       } else {
+                               o3_hpos = RIGHT;
+                       }
+               }
+
+               // From mouse
+               if (o3_hpos == CENTER) { // Center
+                       placeX = o3_x+o3_offsetx-(parsedWidth/2);
+
+                       if (placeX < winoffset) placeX = winoffset;
+               }
+
+               if (o3_hpos == RIGHT) { // Right
+                       placeX = o3_x+o3_offsetx;
+
+                       if ((placeX+parsedWidth) > (winoffset+iwidth - 
widthFix)) {
+                               placeX = iwidth+winoffset - parsedWidth - 
widthFix;
+                               if (placeX < 0) placeX = 0;
+                       }
+               }
+               if (o3_hpos == LEFT) { // Left
+                       placeX = o3_x-o3_offsetx-parsedWidth;
+                       if (placeX < winoffset) placeX = winoffset;
+               }
+
+               // Snapping!
+               if (o3_snapx > 1) {
+                       var snapping = placeX % o3_snapx;
+
+                       if (o3_hpos == LEFT) {
+                               placeX = placeX - (o3_snapx+snapping);
+                       } else {
+                               // CENTER and RIGHT
+                               placeX = placeX+(o3_snapx - snapping);
+                       }
+
+                       if (placeX < winoffset) placeX = winoffset;
+               }
+       }
+
+       return placeX;
+}
+
+// was originally in the placeLayer() routine; separated out for future ease
+function verticalPlacement(browserHeight,verticalScrollAmount) {
+       var placeY, iheight=browserHeight, scrolloffset=verticalScrollAmount;
+       var parsedHeight=(o3_aboveheight ? parseInt(o3_aboveheight) : (olNs4 ? 
over.clip.height : over.offsetHeight));
+
+       if (o3_fixy > -1 || o3_rely != null) {
+               // Fixed position
+               placeY=(o3_rely != null ? (o3_rely < 0 ? 
scrolloffset+o3_rely+iheight - parsedHeight : scrolloffset+o3_rely) : o3_fixy);
+       } else {
+               // If VAUTO, decide what to use.
+               if (o3_vauto == 1) {
+                       if ((o3_y - scrolloffset) > (iheight / 2) && o3_vpos == 
BELOW && (o3_y + parsedHeight + o3_offsety - (scrolloffset + iheight) > 0)) {
+                               o3_vpos = ABOVE;
+                       } else if (o3_vpos == ABOVE && (o3_y - (parsedHeight + 
o3_offsety) - scrolloffset < 0)) {
+                               o3_vpos = BELOW;
+                       }
+               }
+
+               // From mouse
+               if (o3_vpos == ABOVE) {
+                       if (o3_aboveheight == 0) o3_aboveheight = parsedHeight;
+
+                       placeY = o3_y - (o3_aboveheight+o3_offsety);
+                       if (placeY < scrolloffset) placeY = scrolloffset;
+               } else {
+                       // BELOW
+                       placeY = o3_y+o3_offsety;
+               }
+
+               // Snapping!
+               if (o3_snapy > 1) {
+                       var snapping = placeY % o3_snapy;
+
+                       if (o3_aboveheight > 0 && o3_vpos == ABOVE) {
+                               placeY = placeY - (o3_snapy+snapping);
+                       } else {
+                               placeY = placeY+(o3_snapy - snapping);
+                       }
+
+                       if (placeY < scrolloffset) placeY = scrolloffset;
+               }
+       }
+
+       return placeY;
+}
+
+// checks positioning flags
+function checkPositionFlags() {
+       if (olHautoFlag) olHautoFlag = o3_hauto=0;
+       if (olVautoFlag) olVautoFlag = o3_vauto=0;
+       return true;
+}
+
+// get Browser window width
+function windowWidth() {
+       var w;
+       if (o3_frame.innerWidth) w=o3_frame.innerWidth;
+       else if (eval('o3_frame.'+docRoot)&&eval("typeof 
o3_frame."+docRoot+".clientWidth=='number'")&&eval('o3_frame.'+docRoot+'.clientWidth'))
+               w=eval('o3_frame.'+docRoot+'.clientWidth');
+       return w;
+}
+
+// create the div container for popup content if it doesn't exist
+function createDivContainer(id,frm,zValue) {
+       id = (id || 'overDiv'), frm = (frm || o3_frame), zValue = (zValue || 
1000);
+       var objRef, divContainer = layerReference(id);
+
+       if (divContainer == null) {
+               if (olNs4) {
+                       divContainer = frm.document.layers[id] = new 
Layer(window.innerWidth, frm);
+                       objRef = divContainer;
+               } else {
+                       var body = (olIe4 ? frm.document.all.tags('BODY')[0] : 
frm.document.getElementsByTagName("BODY")[0]);
+                       if (olIe4&&!document.getElementById) {
+                               body.insertAdjacentHTML("beforeEnd",'<div 
id="'+id+'"></div>');
+                               divContainer=layerReference(id);
+                       } else {
+                               divContainer = 
frm.document.createElement("DIV");
+                               divContainer.id = id;
+                               body.appendChild(divContainer);
+                       }
+                       objRef = divContainer.style;
+               }
+
+               with (objRef) {
+                       position = 'absolute';
+                       visibility = 'hidden';
+                       top = left = -10000 + (!olNs4) ? 'px' : 0;
+                       zIndex = zValue;
+               }
+       }
+
+       return divContainer;
+}
+
+// get reference to a layer with ID=id
+function layerReference(id) {
+       return (olNs4 ? o3_frame.document.layers[id] : (document.all ? 
o3_frame.document.all[id] : o3_frame.document.getElementById(id)));
+}
 ////////
 //  PLUGIN ACTIVATION FUNCTIONS
 ////////
@@ -1088,6 +1183,12 @@
        }
 }

+// Registers no-parameter commands
+function registerNoParameterCommands(cmdStr) {
+       if (!cmdStr && typeof cmdStr!='string') return;
+       pmt=(!pmt) ? cmdStr : pmt + ',' + cmdStr;
+}
+
 // Register a function to hook at a certain point.
 function registerHook(fnHookTo, fnRef, hookType, optPm) {
        var hookPt, last = typeof optPm;
@@ -1116,6 +1217,10 @@

                } else if (hookType == FALTERNATE) {
                        if (last=='number') hookPt.alt[pms[optPm-1-pmStart]] = 
fnRef;
+               } else if (hookType == FCHAIN) {
+                       hookPt = hookPt.chain;
+                       if (typeof fnRef=='object') 
hookPt=hookPt.concat(fnRef); // add other functions
+                       else hookPt[hookPt.length++]=fnRef;
                }

                return;
@@ -1164,7 +1269,7 @@

 // Runs any hooks registered.
 function runHook(fnHookTo, hookType) {
-       var l = hookPts[fnHookTo], optPm, arS, ar = runHook.arguments;
+       var l = hookPts[fnHookTo], k, rtnVal, optPm, arS, ar = 
runHook.arguments;

        if (hookType == FREPLACE) {
                arS = argToString(ar, 2);
@@ -1190,6 +1295,11 @@
                } else {
                        return eval('l('+arS+')');
                }
+       } else if (hookType == FCHAIN) {
+               arS=argToString(ar,2);
+               l=l.chain;
+
+               for (k=l.length; k > 0; k--) 
if((rtnVal=eval('l[k-1]('+arS+')'))!=void(0)) return rtnVal;
        }
 }

@@ -1306,6 +1416,7 @@
        this.before = new Array();
        this.after = new Array();
        this.alt = new Array();
+       this.chain = new Array();
 }

 // Object for simple access to the overLIB version used.
@@ -1318,8 +1429,13 @@
        this.major = parseInt(this.simpleversion / 100);
        this.minor = parseInt(this.simpleversion / 10) - this.major * 10;
        this.revision = parseInt(this.simpleversion) - this.major * 100 - 
this.minor * 10;
+       this.meets = meets;
 }

+// checks for Core Version required
+function meets(reqdVersion) {
+       return (!reqdVersion) ? false : this.simpleversion >= 
Math.round(100*parseFloat(reqdVersion));
+}


 ////////
@@ -1331,6 +1447,9 @@
 registerHook("ol_content_simple", ol_content_simple, FALTERNATE, CSSCLASS);
 registerHook("ol_content_caption", ol_content_caption, FALTERNATE, CSSCLASS);
 registerHook("ol_content_background", ol_content_background, FALTERNATE, 
CSSCLASS);
+registerPostParseFunction(checkPositionFlags);
 registerHook("hideObject", nbspCleanup, FAFTER);
-if(olNs4) olLoaded=1;
-
+registerHook("horizontalPlacement", horizontalPlacement, FCHAIN);
+registerHook("verticalPlacement", verticalPlacement, FCHAIN);
+if (olNs4||(olIe5&&isMac)||olKq) olLoaded=1;
+registerNoParameterCommands('sticky,autostatus,autostatuscap,fullhtml,hauto,vauto,closeclick,wrap,followmouse,mouseoff,compatmode');






reply via email to

[Prev in Thread] Current Thread [Next in Thread]