2 //\ overLIB Crossframe Support Plugin
3 //\ This file requires overLIB 4.10 or later.
5 //\ overLIB 4.05 - You may not remove or change this notice.
6 //\ Copyright Erik Bosrup 1998-2004. All rights reserved.
7 //\ Contributors are listed on the homepage.
8 //\ See http://www.bosrup.com/web/overlib/ for details.
15 // Ignore these lines, configuration is below.
17 if (typeof olInfo == 'undefined' || typeof olInfo.meets == 'undefined' || !olInfo.meets(4.10)) alert('overLIB 4.10 or later is required for the Cross Frame Support Plugin.');
19 registerCommands('frame');
26 // Parses FRAME command
27 function parseFrameExtras(pf,i,ar) {
31 if (ar[k] == FRAME) { v = ar[++k]; if(pf == 'ol_') ol_frame = v; else opt_FRAME(v); return k; }
41 // Defines which frame we should point to.
42 function opt_FRAME(frm) {
44 over = createDivContainer('overDiv');
48 // Get frame depth of nested frames
49 function frmDepth(thisFrame,ofrm) {
52 for (var i = 0; i<thisFrame.length; i++) {
53 if (thisFrame[i].length > 0) {
54 retVal = frmDepth(thisFrame[i],ofrm);
55 if (retVal == '') continue;
56 } else if (thisFrame[i] != ofrm) continue;
57 retVal = '[' + i + ']' + retVal;
64 // Gets frame reference value relative to top frame
65 function getFrmRef(srcFrm,tgetFrm) {
68 if (tgetFrm != srcFrm) {
69 var tFrm = frmDepth(top.frames,tgetFrm)
70 var sFrm = frmDepth(top.frames,srcFrm)
71 if (sFrm.length == tFrm.length) {
72 l = tFrm.lastIndexOf('[')
75 while ( sFrm.substring(0,l) != tFrm.substring(0,l) )
76 l = tFrm.lastIndexOf('[',l-1)
82 var cnt = 0, p = '',str = tFrm
83 while ((k = str.lastIndexOf('[')) != -1) {
85 str = str.substring(0,k)
88 for (var i = 0; i<cnt; i++) p = p + 'parent.'
89 rtnVal = p + 'frames' + sFrm + '.'
95 function chkForFrmRef() {
96 if(o3_frame != ol_frame) fnRef = getFrmRef(ol_frame,o3_frame)
101 // PLUGIN REGISTRATIONS
103 registerCmdLineFunction(parseFrameExtras);
104 registerPostParseFunction(chkForFrmRef);