overlib_crossframe_mini.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536
  1. //\/////
  2. //\ overLIB Crossframe Support Plugin
  3. //\ This file requires overLIB 4.10 or later.
  4. //\
  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.
  9. //\/////
  10. //\ THIS IS A VERY MODIFIED VERSION. DO NOT EDIT OR PUBLISH. GET THE ORIGINAL!
  11. 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.');else{registerCommands('frame');
  12. function parseFrameExtras(pf,i,ar){var k=i,v;
  13. if(k<ar.length){if(ar[k]==FRAME){v=ar[++k];if(pf=='ol_')ol_frame=v;else opt_FRAME(v);return k;}}
  14. return-1;}
  15. function opt_FRAME(frm){o3_frame=frm;over=createDivContainer('overDiv');return 0;}
  16. function frmDepth(thisFrame,ofrm){var retVal='';
  17. for(var i=0;i<thisFrame.length;i++){if(thisFrame[i].length>0){retVal=frmDepth(thisFrame[i],ofrm);if(retVal=='')continue;}else if(thisFrame[i]!=ofrm)continue;retVal='['+i+']'+retVal;break;}
  18. return retVal;}
  19. function getFrmRef(srcFrm,tgetFrm){var rtnVal=''
  20. if(tgetFrm!=srcFrm){var tFrm=frmDepth(top.frames,tgetFrm)
  21. var sFrm=frmDepth(top.frames,srcFrm)
  22. if(sFrm.length==tFrm.length){l=tFrm.lastIndexOf('[')
  23. if(l){while( sFrm.substring(0,l)!=tFrm.substring(0,l) )
  24. l=tFrm.lastIndexOf('[',l-1)
  25. tFrm=tFrm.substr(l)
  26. sFrm=sFrm.substr(l)}}
  27. var cnt=0,p='',str=tFrm
  28. while((k=str.lastIndexOf('['))!=-1){cnt++
  29. str=str.substring(0,k)}
  30. for(var i=0;i<cnt;i++)p=p+'parent.'
  31. rtnVal=p+'frames'+sFrm+'.'}
  32. return rtnVal}
  33. function chkForFrmRef(){if(o3_frame!=ol_frame)fnRef=getFrmRef(ol_frame,o3_frame)
  34. return true;}
  35. registerCmdLineFunction(parseFrameExtras);registerPostParseFunction(chkForFrmRef);
  36. }