Loading ...
Sorry, an error occurred while loading the content.

Re: [OLmws] Re: Nested IFRAME problem

Expand Messages
  • Foteos Macrides
    Dmitry, That information helps, though a URL for a test document which shows your actual use of deeply nested iframes and what you ve done so far for handling
    Message 1 of 6 , Jul 30, 2008
    • 0 Attachment
      Dmitry,
       
      That information helps, though a URL for a test document which shows your actual use of deeply nested iframes and what you've done so far for handling popups from within them would be more helpful.
       
      Your function set is homologous to the OLpageLoc function in overlibmws.js, which is called as OLpageLoc(obj, 'Left') and OLpageLoc(obj, 'Top') to get the x and y coordinates for the object, respectively.  But your function set doesn't appear to take into account any scrolling within iframes via CSS overflow-induced scroll bars.  If you don't need to take such scrolling into account, you can simply supplement the filter in the OLoptFRAME function of overlibmws_crossframe.js so that it passes with a FRAME parameter of top in addition to parent:
       
      function OLoptFRAME(frm){
      . . . 
        var n=window.name,o;
        if(((n&&parent!=self)&&(o3_frame==parent||o3_frame==top))
           &&(o=OLgetRef(n,parent.document))){
         if(OLie4&&!OLop7){
          OLx=event.clientX+OLfd().scrollLeft;
          OLy=event.clientY+OLfd().scrollTop;
         }
         OLifX=OLpageLoc(o,'Left')-
           (OLie4&&!OLop7? OLfd().scrollLeft:self.pageXOffset);
         OLifY=myOLpageLoc(o,'Top')-
           (OLie4&&!OLop7?OLfd().scrollTop:self.pageYOffset);
        }
       }
      . . . 
      }
       
      The OLifX and OLifY globals are used by the OLplaceLayer function in overlibmws.js for cursor-based positioning of popups.  You'll need to add OFFSETX and OFFSETY commands in your overlib function call to make sure there is no overlap of the popup with the cursor, and thus avoid the rapidly alternating display/hide chatter which such overlap causes.  The above code change should deal with any scrolling in the top document and any CSS overflow-based scrolling in the nested iframe within which the overlib function call was made, but not any CSS overflow-based scrolling in any iframes nested between them.  I'm still thinking about a general strategy for support of nested iframes, but this should get you reasonably far along toward your objective with the DHTMGoodies library.
       
      The OLchkIfRef function in overlibmws_crossframe.js will need similar tweaks to support non-border-restricted REF-based positioning in nested iframes, though that's not an immediate concern for you.
       
      Fote
      --
       
      ----- Original Message -----
      Sent: Wednesday, July 30, 2008 5:45 AM
      Subject: [OLmws] Re: Nested IFRAME problem

      I make a project which needs complex frame structure. Unfortunately FRAMESET doesn't allow using popups over frames. So I decided to use IFRAMES.  Moreover, I found great library DHTMGoodies. It allows to make nice frameset on iframes:
      http://www.dhtmlgoodies.com/packages/dhtml-suite-for-applications/demos/demo-pane-splitter.html

      As far as I know it is the most functional and most lightweigth library for DHTML splitters.

      Unfortunately this library provides rather fixed layout (only 5 frames). If I need to change the layout I am to use nested IFRAMES.  That's why I need support for deeply nested IFRAMES in overlib.

      By now I managed to show overlib with RELX and RELY commands, but this approach has obvious limitations. It would be great to use cursor-based positioning, OFFDELAY and so on.

      By the way, getting absolute coordinates from nested iframes is rather tricky. I managed to compose a function that works in IE and Firefox. I didn't tried it in other browsers.

      Using these functions showing tooltip from any nested iframe looks like:

      <a
        href="#"
        onmouseover="top.overlib('text',
          top.RELX, findPosExX(this), top.RELY, findPosExY(this))"
        onmouseout="top.nd()">test</a>;

      Here are the functions (hope they will help you).

      function findPosX(obj) { return findPos(obj, 'Left', 'x'); }
      function findPosY(obj) { return findPos(obj, 'Top', 'y'); }
      function findPosExX(obj) { return findPosEx(obj, 'Left', 'x'); }
      function findPosExY(obj) { return findPosEx(obj, 'Top', 'y'); }

      /* gets the absolute coordinate of an object from the window left
          top corner */
      function findPos(obj, prop, prop1)
      {
        var cur = 0;
        if(obj.offsetParent)
            while(1)
            {
              cur += obj['offset'+prop] - obj['scroll'+prop];
              if(!obj.offsetParent)
                break;
              obj = obj.offsetParent;
            }
        else if(obj[prop1])
            cur += obj[prop1];
        return cur;
      }

      /* this function just ascends all the windows to the top and
          sum absolute coordinates */
      function findPosEx(obj, prop, prop1){
      var cur = findPos(obj, prop, prop1);
      var d = obj.ownerDocument;
      var w = d.defaultView || d.parentWindow;
      while(w && w != top){
      var id = w.id, name = w.name;
      w = w.parent;
      var wo = null;
      if(id){
        wo = w.document.getElementById(id);
      }else if(name){
        var wos = w.document.getElementsByName(name);
        if(wos.length != 1){
      eh_alert('There are ' + wos.length + ' frames with name "'
       + name + '"! There should be only 1!');
      break;
        }
        wo = wos[0];
      }
      if(!wo){
      eh_alert('cannot find window element by id: ' + w.id + ', name: ' + w.name);
      break;
      }
      cur += findPos(wo, prop, prop1);
      }
      return cur;
      }

      --- In overlibmws@yahoogroups.com, Foteos Macrides wrote:
      >
      > Dmitry,
      >
      > Sorry, but I don't have an "uncompressed source" and myself simply keep the modules as included in the overlibmws.zip distribution.  When working on an enhancement or bug fix, I might temporarily "expand" one or another function manually, inserting newlines after semi-colons and at braces, and indentation spaces at the beginnings of lines, but once I'm done and ready to update the distribution, I remove the "unnecessary" spaces and newlines.
      >
      > The overlibmws_crossframe.js plug-in originally was a tiny module with code simply for pre-pending appropriate frame references for the cClick function in the captions of sticky popups when invoked across frames in frame documents.  Then last year I expanded it a bit to deal with iframe content, mainly focusing on enabling sticky popups with iframe content to have cursor-based or REF-based positioning of popups which are not restricted to within the iframe border, by treating them as secondary popups of the parent.  That involved some tricky code for taking into account overflow-based scrolling within the iframe, and document scrolling within the parent, which would work reliably for both the IE and W3C DOM models.  Once I did get that to be reliable, it became reasonable also to add support for non-border-restricted primary popups with cursor-based or REF-based positioning within embedded iframes.  However, I hadn't given any thought to including support for nested iframes (our phrase "nesting level of 1" really refers to iframes which aren't nested  :<).
      >
      > Are your documents with nested iframes on the internet (as opposed to an intranet), such that you could provide a URL via which I could see them actually being used in some worthwhile way?  Perhaps that might help me to think of a strategy for adding such support to code which hadn't anticipated the need.
      >
      > Fote
      > --
      >
      >   ----- Original Message -----
      >   From: dmitry.kochin
      >   To: overlibmws@yahoogroups.com
      >   Sent: Tuesday, July 29, 2008 4:32 AM
      >   Subject: [OLmws] Re: Nested IFRAME problem
      >
      >
      >   I understood that, thank you. Is it possible to add support for the cursor-based positioning for nesting deeper than one level?
      >
      >   Are there any principal difficulties?
      >
      >   I could try to make it myself. Can you share uncompressed source of  your overlibmws.js?
      >
      >   --- In overlibmws@yahoogroups.com, Foteos Macrides wrote:
      >   >
      >   > Dimitry,
      >   >
      >   > The FRAME command can take any valid frame reference (including top) as its parameter, as described in the FRAME section of the Command Reference:
      >   >
      >   > http://www.macridesweb.com/oltest/commandRef.html#frame
      >   >
      >   > However, the support for cursor-based positioning which takes into account any scrolling of an iframe document and/or its parent document only works for a depth of one, and requires that the parameter be parent to ensure that the nesting is not deeper.  If you have more deeply nested iframes and specify top to avoid restriction of the popup by frame borders, you should use REL-, MID- or REF-based positioning instead of cursor-based positioning.
      >   >
      >   > Fote
      >   > --
      >   >
      >   >   ----- Original Message -----
      >   >   From: dmitry.kochin
      >   >   To: overlibmws@yahoogroups.com
      >   >   Sent: Monday, July 28, 2008 1:52 PM
      >   >   Subject: [OLmws] Nested IFRAME problem
      >   >
      >   >
      >   >   I have a site with numerous nested IFRAMEs. I wanted to use overlibmws to show popups over iframes, disregarding frame borders.  But unfortunately FRAME command cannot be used with deep nesting iframes.  As soon as I know it allows only 1 level of iframe, i.e. FRAME,parent command.
      >   >
      >   >   Is it possible to use something like FRAME,top command to show popup in the topmost window from any nested iframe?
    Your message has been successfully submitted and would be delivered to recipients shortly.