thomascube
2009-05-18 a74ec2f812201317acf974db2cdbf5e28cd324af
skins/default/splitter.js
@@ -49,16 +49,9 @@
    // read saved position from cookie
    var cookie = bw.get_cookie(this.id);
    if (cookie)
    if (cookie && !isNaN(cookie))
      {
      var param = cookie.split(':');
      for (var i=0, p; i<param.length; i++)
        {
        p = param[i].split('=');
        this[p[0]] = !isNaN(p[1]) ? parseFloat(p[1]) : p[1];
        }
      this.pos = parseFloat(cookie);
      this.resize();
      }
    else if (this.pos)
@@ -81,7 +74,10 @@
      this.p2.style.top = Math.ceil(this.pos + lh / 2) + 'px';
      this.layer.move(this.layer.x, Math.round(this.pos - lh / 2 + 1));        
      if (bw.ie)
        this.p2.style.height = (parseInt(this.p2.parentNode.offsetHeight) - parseInt(this.p2.style.top))+'px';
   {
        var new_height = (parseInt(this.p2.parentNode.offsetHeight) - parseInt(this.p2.style.top));
        this.p2.style.height = (new_height > 0 ? new_height : 0) +'px';
        }
      }
    else
      {
@@ -124,7 +120,7 @@
        // the position of each iframe when the event is received
        var s = this;
        var id = iframes[n].id;
        this.iframe_events[n] = function(e){ e._rc_pos_offset = rcube_get_object_pos(document.getElementById(id)); return s.onDrag(e); }
        this.iframe_events[n] = function(e){ e._offset = rcube_get_object_pos(document.getElementById(id)); return s.onDrag(e); }
        if (iframedoc.addEventListener)
          iframedoc.addEventListener('mousemove', this.iframe_events[n], false);
@@ -143,15 +139,9 @@
   */
  this.onDrag = function(e)
    {
    var pos = rcube_event.get_mouse_pos(e);
    if (!this.drag_active) return false;
    if (e._rc_pos_offset)
      {
      pos.x += e._rc_pos_offset.x;
      pos.y += e._rc_pos_offset.y;
      }
    var pos = rcube_event.get_mouse_pos(e);
    if (this.relative)
      {
@@ -222,13 +212,17 @@
    return bw.safari ? true : rcube_event.cancel(e);
    };
  /**
   * Handler for window resize events
   */
  this.onResize = function(e)
    {
    if (this.horizontal)
      this.p2.style.height = (parseInt(this.p2.parentNode.offsetHeight) - parseInt(this.p2.style.top))+'px';
      {
      var new_height = (parseInt(this.p2.parentNode.offsetHeight) - parseInt(this.p2.style.top));
      this.p2.style.height = (new_height > 0 ? new_height : 0) +'px';
      }
    else
      this.p2.style.width = (parseInt(this.p2.parentNode.offsetWidth) - parseInt(this.p2.style.left))+'px';
    };
@@ -238,7 +232,7 @@
    // save state in cookie
    var exp = new Date();
    exp.setYear(exp.getFullYear() + 1);
    bw.set_cookie(this.id, 'pos='+this.pos, exp);
    bw.set_cookie(this.id, this.pos, exp);
    }
  }  // end class rcube_splitter