All pastes #121665 Raw Edit

Anonymous

public text v1 · immutable
·published 2006-08-08 04:02 UTC
rendered paste body
Object.prototype.inherit = function(superObj, overWriteMember) {
  /*
    inherit all members and objects of object 'superObj'
    
    if 'this' object already has the data member, overWriteMember
    will decide whether or not to overwrite the member
  */
  
  var m;
  
  for (m in superObj) {
    if (this[m] == undefined || overWriteMember)
      this[m] = superObj[m];
  }
}


// example

function DocumentTab(url, label) /* extends TabClass */
{
  // inherit TabClass, pass along the 'docwin'
  this.inherit( ( new TabClass( document.getElementById("iframe_content") , document.createElement("DIV") ) ) );
  
  // data members
  this.label = label;                                       // [string] tab's display name (may contain HTML)
  this.url = url;                                           // [string] url to point tab window to
  this.frameIndice = null;                                  // [number] indice to frames collection which points to this tab's iframe
  this.iframe = null;                                       // [object node] iframe tag
  this.iframe_win = null;                                   // [object window] iframe window
  this.iframe_history = [];                                 // [array] of strings; keeps track of iframe history url
  this.iframe_indice = null;                                // [number] indice of iframe_history[]
  this.node = document.createElement("DIV");                // [object node] div that contains tab
  this.navigatingFrame = false;                             // [boolean / number] number of history indice if navigating, false if not
  this.pid = null;                                          // [number] progress id for 'Persits.Upload' ASP obj; associates uploads to their tab
  this.color = null;                                        // [string] tab color (for css styles)
  this.hierarchy = null;                                    // [array] holds the hiearchy for the iframe
  this.no_close = false;                                    // [boolean] if true, remove close link

  // methods
  this.generateTab = DocumentTab_Create;
  this.generateIframe = DocumentTab_CreateIFrame;
  this.setActive = DocumentTab_ShowActiveHTML;
  this.setInActive = DocumentTab_ShowInActiveHTML;
  this.positionElements = DocumentTab_PositionElements;
  this.onClose = DocumentTab_CloseTab;
  this.navigateIframe = DocumentTab_IframeHistory;
  
  //this.docwin.className = "tabdocument";
  this.node.className = "dhtml";
}