X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;ds=sidebyside;f=htdocs%2Fjavascript%2Foverlib.js;h=e900ab4a4c6c92022f2674b747f07018636a9c7a;hb=e173ee9b7e29b11c13c3bc5124d200cba6675cce;hp=64aae53dcf8aaaa2c4ffa241fde2bbf373054bf6;hpb=0337d704b62718d7c77106c0e4c4e26fb02beacf;p=platal.git
diff --git a/htdocs/javascript/overlib.js b/htdocs/javascript/overlib.js
index 64aae53..e900ab4 100644
--- a/htdocs/javascript/overlib.js
+++ b/htdocs/javascript/overlib.js
@@ -1,5 +1,5 @@
//\/////
-//\ overLIB 4.14 - You may not remove or change this notice.
+//\ overLIB 4.21 - You may not remove or change this notice.
//\ Copyright Erik Bosrup 1998-2004. All rights reserved.
//\
//\ Contributors are listed on the homepage.
@@ -14,7 +14,7 @@
//\ license agreement at the link above. Please give credit on sites that
//\ use overLIB and submit changes of the script so other people can use
//\ them as well.
-// $Revision: 1.107 $ $Date: 2004/12/26 15:34:56 $
+// $Revision: 1.119 $ $Date: 2005/07/02 23:41:44 $
//\/////
//\mini
@@ -22,11 +22,13 @@
// PRE-INIT
// Ignore these lines, configuration is below.
////////
-var olLoaded = 0;var pmStart = 10000000; var pmUpper = 10001000; var pmCount = pmStart+1; var pmt=''; var pms = new Array(); var olInfo = new Info('4.14', 1);
+var olLoaded = 0;var pmStart = 10000000; var pmUpper = 10001000; var pmCount = pmStart+1; var pmt=''; var pms = new Array(); var olInfo = new Info('4.21', 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
+var hookPts = new Array(), postParse = new Array(), cmdLine = new Array(), runTime = new Array();
+// for plugins
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');
////////
@@ -233,16 +235,7 @@ if (document.compatMode && document.compatMode == 'CSS1Compat') {
if(window.addEventListener) window.addEventListener("load",OLonLoad_handler,false);
else if (window.attachEvent) window.attachEvent("onload",OLonLoad_handler);
-// Capture events, alt. diffuses the overlib function.
-var olCheckMouseCapture = true;
-if ((olNs4 || olNs6 || olIe4)) {
- olMouseCapture();
-} else {
- overlib = no_overlib;
- nd = no_overlib;
- ver3fix = true;
-}
-
+var capExtent;
////////
// PUBLIC FUNCTIONS
@@ -459,7 +452,8 @@ function olMain() {
// Makes simple table without caption
function ol_content_simple(text) {
- txt='
' : '>')+(o3_textfontclass ? '' : wrapStr(0,o3_textsize,'text'))+text+(o3_textfontclass ? '' : wrapStr(1,o3_textsize))+' |
|
';
+ var cpIsMultiple = /,/.test(o3_cellpad);
+ var txt = '' : ((!olNs4&&cpIsMultiple) ? ' style="'+setCellPadStr(o3_cellpad)+'">' : '>'))+(o3_textfontclass ? '' : wrapStr(0,o3_textsize,'text'))+text+(o3_textfontclass ? '' : wrapStr(1,o3_textsize))+' |
|
';
set_background("");
return txt;
@@ -467,19 +461,21 @@ function ol_content_simple(text) {
// Makes table with caption and optional close link
function ol_content_caption(text,title,close) {
- var nameId;
- closing="";
- closeevent="onmouseover";
- if (o3_closeclick==1) closeevent= (o3_closetitle ? "title='" + o3_closetitle +"'" : "") + " onclick";
- if (o3_capicon!="") {
- nameId=' hspace=\"5\"'+' align=\"middle\" alt=\"\"';
- if (typeof o3_dragimg!='undefined'&&o3_dragimg) nameId=' hspace=\"5\"'+' name=\"'+o3_dragimg+'\" id=\"'+o3_dragimg+'\" align=\"middle\" alt=\"Drag Enabled\" title=\"Drag Enabled\"';
- o3_capicon='
';
+ var nameId, txt, cpIsMultiple = /,/.test(o3_cellpad);
+ var closing, closeevent;
+
+ closing = "";
+ closeevent = "onmouseover";
+ if (o3_closeclick == 1) closeevent = (o3_closetitle ? "title='" + o3_closetitle +"'" : "") + " onclick";
+ if (o3_capicon != "") {
+ nameId = ' hspace = \"5\"'+' align = \"middle\" alt = \"\"';
+ if (typeof o3_dragimg != 'undefined' && o3_dragimg) nameId =' hspace=\"5\"'+' name=\"'+o3_dragimg+'\" id=\"'+o3_dragimg+'\" align=\"middle\" alt=\"Drag Enabled\" title=\"Drag Enabled\"';
+ o3_capicon = '
';
}
- if (close != "")
- closing=''+(o3_closefontclass ? '' : wrapStr(0,o3_closesize,'close'))+close+(o3_closefontclass ? '' : wrapStr(1,o3_closesize,'close'))+' | ';
- txt='' : '>')+(o3_captionfontclass ? '' : ''+wrapStr(0,o3_captionsize,'caption'))+o3_capicon+title+(o3_captionfontclass ? '' : wrapStr(1,o3_captionsize)+'')+' | '+closing+'
' :'>')+(o3_textfontclass ? '' : wrapStr(0,o3_textsize,'text'))+text+(o3_textfontclass ? '' : wrapStr(1,o3_textsize)) + ' |
|
';
+ if (close != "")
+ closing = ''+(o3_closefontclass ? '' : wrapStr(0,o3_closesize,'close'))+close+(o3_closefontclass ? '' : wrapStr(1,o3_closesize,'close'))+' | ';
+ txt = '' : '>')+(o3_captionfontclass ? '' : ''+wrapStr(0,o3_captionsize,'caption'))+o3_capicon+title+(o3_captionfontclass ? '' : wrapStr(1,o3_captionsize)+'')+' | '+closing+'
' :((!olNs4&&cpIsMultiple) ? ' style="'+setCellPadStr(o3_cellpad)+'">' : '>'))+(o3_textfontclass ? '' : wrapStr(0,o3_textsize,'text'))+text+(o3_textfontclass ? '' : wrapStr(1,o3_textsize)) + ' |
|
';
set_background("");
return txt;
@@ -540,8 +536,8 @@ function createPopup(lyrContent){
runHook("createPopup", FBEFORE);
if (o3_wrap) {
- var wd,ww,theObj=(olNs4 ? over : over.style);
- theObj.top=theObj.left=-10000 + (!olNs4 ? 'px' : 0);
+ 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())) {
@@ -616,28 +612,39 @@ function no_overlib() { return ver3fix; }
// Capture the mouse and chain other scripts.
function olMouseCapture() {
capExtent = document;
- var fN, str, l, k, f, mseHandler = olMouseMove;
+ 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;
+ 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') {
- olCheckMouseCapture = false;
- return;
+ 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';
+ l = f.indexOf('{')+1;
+ k = f.lastIndexOf('}');
+ str = f.substring(l,k) + '\n';
}
}
-
str += 'olMouseMove(e); ';
mseHandler = new Function('e', str);
}
@@ -653,7 +660,7 @@ function olMouseCapture() {
// Does the actual command parsing.
function parseTokens(pf, ar) {
// What the next argument is expected to be.
- var v, mode=-1, par = (pf != 'ol_');
+ var v, i, mode=-1, par = (pf != 'ol_');
var fnMark = (par && !ar.length ? 1 : 0);
for (i = 0; i < ar.length; i++) {
@@ -798,7 +805,7 @@ function hideObject(obj) {
var theObj=(olNs4 ? obj : obj.style);
if (olNs6 && olShowId>0) { clearTimeout(olShowId); olShowId=0; }
theObj.visibility = 'hidden';
- theObj.top=theObj.left=-10000 + (!olNs4 ? 'px' : 0);
+ 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);
@@ -807,7 +814,7 @@ function hideObject(obj) {
o3_delayid = 0;
self.status = "";
- if (obj.onmouseout || obj.onmouseover) {
+ if (obj.onmouseout||obj.onmouseover) {
if (olNs4) obj.releaseEvents(Event.MOUSEOUT || Event.MOUSEOVER);
obj.onmouseout = obj.onmouseover = null;
}
@@ -952,6 +959,36 @@ function isExclusive(args) {
return false;
}
+// Sets cellpadding style string value
+function setCellPadStr(parameter) {
+ var Str='', j=0, ary = new Array(), top, bottom, left, right;
+
+ Str+='padding: ';
+ ary=parameter.replace(/\s+/g,'').split(',');
+
+ switch(ary.length) {
+ case 2:
+ top=bottom=ary[j];
+ left=right=ary[++j];
+ break;
+ case 3:
+ top=ary[j];
+ left=right=ary[++j];
+ bottom=ary[++j];
+ break;
+ case 4:
+ top=ary[j];
+ right=ary[++j];
+ bottom=ary[++j];
+ left=ary[++j];
+ break;
+ }
+
+ Str+= ((ary.length==1) ? ary[0] + 'px;' : top + 'px ' + right + 'px ' + bottom + 'px ' + left + 'px;');
+
+ return Str;
+}
+
// function will delay close by time milliseconds
function hideDelay(time) {
if (time&&!o3_delay) {
@@ -1101,11 +1138,11 @@ function createDivContainer(id,frm,zValue) {
objRef = divContainer.style;
}
- with (objRef) {
- position = 'absolute';
- visibility = 'hidden';
- zIndex = zValue;
- }
+ objRef.position = 'absolute';
+ objRef.visibility = 'hidden';
+ objRef.zIndex = zValue;
+ if (olIe4&&!olOp) objRef.left = objRef.top = '0px';
+ else objRef.left = objRef.top = -10000 + (!olNs4 ? 'px' : 0);
}
return divContainer;
@@ -1116,6 +1153,109 @@ function layerReference(id) {
return (olNs4 ? o3_frame.document.layers[id] : (document.all ? o3_frame.document.all[id] : o3_frame.document.getElementById(id)));
}
////////
+// UTILITY FUNCTIONS
+////////
+
+// Checks if something is a function.
+function isFunction(fnRef) {
+ var rtn = true;
+
+ if (typeof fnRef == 'object') {
+ for (var i = 0; i < fnRef.length; i++) {
+ if (typeof fnRef[i]=='function') continue;
+ rtn = false;
+ break;
+ }
+ } else if (typeof fnRef != 'function') {
+ rtn = false;
+ }
+
+ return rtn;
+}
+
+// Converts an array into an argument string for use in eval.
+function argToString(array, strtInd, argName) {
+ var jS = strtInd, aS = '', ar = array;
+ argName=(argName ? argName : 'ar');
+
+ if (ar.length > jS) {
+ for (var k = jS; k < ar.length; k++) aS += argName+'['+k+'], ';
+ aS = aS.substring(0, aS.length-2);
+ }
+
+ return aS;
+}
+
+// Places a hook in the correct position in a hook point.
+function reOrder(hookPt, fnRef, order) {
+ var newPt = new Array(), match, i, j;
+
+ if (!order || typeof order == 'undefined' || typeof order == 'number') return hookPt;
+
+ if (typeof order=='function') {
+ if (typeof fnRef=='object') {
+ newPt = newPt.concat(fnRef);
+ } else {
+ newPt[newPt.length++]=fnRef;
+ }
+
+ for (i = 0; i < hookPt.length; i++) {
+ match = false;
+ if (typeof fnRef == 'function' && hookPt[i] == fnRef) {
+ continue;
+ } else {
+ for(j = 0; j < fnRef.length; j++) if (hookPt[i] == fnRef[j]) {
+ match = true;
+ break;
+ }
+ }
+ if (!match) newPt[newPt.length++] = hookPt[i];
+ }
+
+ newPt[newPt.length++] = order;
+
+ } else if (typeof order == 'object') {
+ if (typeof fnRef == 'object') {
+ newPt = newPt.concat(fnRef);
+ } else {
+ newPt[newPt.length++] = fnRef;
+ }
+
+ for (j = 0; j < hookPt.length; j++) {
+ match = false;
+ if (typeof fnRef == 'function' && hookPt[j] == fnRef) {
+ continue;
+ } else {
+ for (i = 0; i < fnRef.length; i++) if (hookPt[j] == fnRef[i]) {
+ match = true;
+ break;
+ }
+ }
+ if (!match) newPt[newPt.length++]=hookPt[j];
+ }
+
+ for (i = 0; i < newPt.length; i++) hookPt[i] = newPt[i];
+ newPt.length = 0;
+
+ for (j = 0; j < hookPt.length; j++) {
+ match = false;
+ for (i = 0; i < order.length; i++) {
+ if (hookPt[j] == order[i]) {
+ match = true;
+ break;
+ }
+ }
+ if (!match) newPt[newPt.length++] = hookPt[j];
+ }
+ newPt = newPt.concat(order);
+ }
+
+ hookPt = newPt;
+
+ return hookPt;
+}
+
+////////
// PLUGIN ACTIVATION FUNCTIONS
////////
@@ -1144,10 +1284,10 @@ function parseCmdLine(pf, i, args) {
}
// Runs plugin functions to do things after parse.
-function postParseChecks(){
+function postParseChecks(pf,args){
if (typeof postParse != 'undefined' && postParse.length) {
for (var k = 0; k < postParse.length; k++) {
- if (postParse[k]()) continue;
+ if (postParse[k](pf,args)) continue;
return false; // end now since have an error
}
}
@@ -1173,7 +1313,7 @@ function registerCommands(cmdStr) {
// Registers no-parameter commands
function registerNoParameterCommands(cmdStr) {
- if (!cmdStr && typeof cmdStr!='string') return;
+ if (!cmdStr && typeof cmdStr != 'string') return;
pmt=(!pmt) ? cmdStr : pmt + ',' + cmdStr;
}
@@ -1182,7 +1322,6 @@ function registerHook(fnHookTo, fnRef, hookType, optPm) {
var hookPt, last = typeof optPm;
if (fnHookTo == 'plgIn'||fnHookTo == 'postParse') return;
- if (typeof hookPts == 'undefined') hookPts = new Array();
if (typeof hookPts[fnHookTo] == 'undefined') hookPts[fnHookTo] = new FunctionReference();
hookPt = hookPts[fnHookTo];
@@ -1218,7 +1357,6 @@ function registerHook(fnHookTo, fnRef, hookType, optPm) {
// Register a function that will set runtime variables.
function registerRunTimeFunction(fn) {
if (isFunction(fn)) {
- if (typeof runTime == 'undefined') runTime = new Array();
if (typeof fn == 'object') {
runTime = runTime.concat(fn);
} else {
@@ -1230,7 +1368,6 @@ function registerRunTimeFunction(fn) {
// Register a function that will handle command parsing.
function registerCmdLineFunction(fn){
if (isFunction(fn)) {
- if (typeof cmdLine == 'undefined') cmdLine = new Array();
if (typeof fn == 'object') {
cmdLine = cmdLine.concat(fn);
} else {
@@ -1242,7 +1379,6 @@ function registerCmdLineFunction(fn){
// Register a function that does things after command parsing.
function registerPostParseFunction(fn){
if (isFunction(fn)) {
- if (typeof postParse == 'undefined') postParse = new Array();
if (typeof fn == 'object') {
postParse = postParse.concat(fn);
} else {
@@ -1257,141 +1393,40 @@ function registerPostParseFunction(fn){
// Runs any hooks registered.
function runHook(fnHookTo, hookType) {
- var l = hookPts[fnHookTo], k, rtnVal, optPm, arS, ar = runHook.arguments;
+ var l = hookPts[fnHookTo], k, rtnVal = null, optPm, arS, ar = runHook.arguments;
if (hookType == FREPLACE) {
arS = argToString(ar, 2);
- if (typeof l == 'undefined' || !(l = l.ovload)) return eval(fnHookTo+'('+arS+')');
- else return eval('l('+arS+')');
+ if (typeof l == 'undefined' || !(l = l.ovload)) rtnVal = eval(fnHookTo+'('+arS+')');
+ else rtnVal = eval('l('+arS+')');
} else if (hookType == FBEFORE || hookType == FAFTER) {
- if (typeof l == 'undefined') return;
- l=(hookType == 1 ? l.before : l.after);
-
- if (!l.length) return;
-
- arS = argToString(ar, 2);
- for (var k = 0; k < l.length; k++) eval('l[k]('+arS+')');
-
+ if (typeof l != 'undefined') {
+ l=(hookType == 1 ? l.before : l.after);
+
+ if (l.length) {
+ arS = argToString(ar, 2);
+ for (var k = 0; k < l.length; k++) eval('l[k]('+arS+')');
+ }
+ }
} else if (hookType == FALTERNATE) {
optPm = ar[2];
arS = argToString(ar, 3);
if (typeof l == 'undefined' || (l = l.alt[pms[optPm-1-pmStart]]) == 'undefined') {
- return eval(fnHookTo+'('+arS+')');
+ rtnVal = eval(fnHookTo+'('+arS+')');
} else {
- return eval('l('+arS+')');
+ rtnVal = 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;
- }
-}
-
-////////
-// UTILITY FUNCTIONS
-////////
-
-// Checks if something is a function.
-function isFunction(fnRef) {
- var rtn = true;
-
- if (typeof fnRef == 'object') {
- for (var i = 0; i < fnRef.length; i++) {
- if (typeof fnRef[i]=='function') continue;
- rtn = false;
- break;
- }
- } else if (typeof fnRef != 'function') {
- rtn = false;
- }
-
- return rtn;
-}
-
-// Converts an array into an argument string for use in eval.
-function argToString(array, strtInd, argName) {
- var jS = strtInd, aS = '', ar = array;
- argName=(argName ? argName : 'ar');
-
- if (ar.length > jS) {
- for (var k = jS; k < ar.length; k++) aS += argName+'['+k+'], ';
- aS = aS.substring(0, aS.length-2);
- }
-
- return aS;
-}
-
-// Places a hook in the correct position in a hook point.
-function reOrder(hookPt, fnRef, order) {
- if (!order || typeof order == 'undefined' || typeof order == 'number') return;
-
- var newPt = new Array(), match;
-
- if (typeof order=='function') {
- if (typeof fnRef=='object') {
- newPt = newPt.concat(fnRef);
- } else {
- newPt[newPt.length++]=fnRef;
- }
-
- for (var i = 0; i < hookPt.length; i++) {
- match = false;
- if (typeof fnRef == 'function' && hookPt[i] == fnRef) {
- continue;
- } else {
- for(var j = 0; j < fnRef.length; j++) if (hookPt[i] == fnRef[j]) {
- match = true;
- break;
- }
- }
- if (!match) newPt[newPt.length++] = hookPt[i];
- }
-
- newPt[newPt.length++] = order;
-
- } else if (typeof order == 'object') {
- if (typeof fnRef == 'object') {
- newPt = newPt.concat(fnRef);
- } else {
- newPt[newPt.length++] = fnRef;
- }
-
- for (var j = 0; j < hookPt.length; j++) {
- match = false;
- if (typeof fnRef == 'function' && hookPt[j] == fnRef) {
- continue;
- } else {
- for (var i = 0; i < fnRef.length; i++) if (hookPt[j] == fnRef[i]) {
- match = true;
- break;
- }
- }
- if (!match) newPt[newPt.length++]=hookPt[j];
- }
-
- for (i = 0; i < newPt.length; i++) hookPt[i] = newPt[i];
- newPt.length = 0;
-
- for (var j = 0; j < hookPt.length; j++) {
- match = false;
- for (var i = 0; i < order.length; i++) {
- if (hookPt[j] == order[i]) {
- match = true;
- break;
- }
- }
- if (!match) newPt[newPt.length++] = hookPt[j];
- }
- newPt = newPt.concat(order);
+ for (k=l.length; k > 0; k--) if((rtnVal=eval('l[k-1]('+arS+')'))!=void(0)) break;
}
- for(i = 0; i < newPt.length; i++) hookPt[i] = newPt[i];
-
- return hookPt;
+ return rtnVal;
}
////////
@@ -1441,3 +1476,16 @@ 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');
+///////
+// ESTABLISH MOUSECAPTURING
+///////
+
+// Capture events, alt. diffuses the overlib function.
+var olCheckMouseCapture=true;
+if ((olNs4 || olNs6 || olIe4)) {
+ olMouseCapture();
+} else {
+ overlib = no_overlib;
+ nd = no_overlib;
+ ver3fix = true;
+}