//INHERITS FROM VerticalTabControl (VerticalTabControl.js) function RepeatingVerticalTabControl() { VerticalTabControl.call(this); this.repeatingContent = null; this.tabLimit = -1; //Add new tab finger this.addTabFinger = document.createElement('div'); this.addTabFinger.className = "vertical_tab_finger"; this.addTabFinger.appendChild(document.createTextNode("+")); var rvtControl = this; this.addTabFinger.onclick = function(){ rvtControl.addTab() }; this.fingerColumn.appendChild(this.addTabFinger); }; RepeatingVerticalTabControl.prototype = new VerticalTabControl(); RepeatingVerticalTabControl.prototype.constructor = RepeatingVerticalTabControl; RepeatingVerticalTabControl.prototype.setRepeatingContent = function(content) { this.repeatingContent = content; }; //Overridden to append before the add button RepeatingVerticalTabControl.prototype.addTab=function() { var l = this.tabs.length; this.tabs[l] = new Tab(); // Feel dirty using innerHTML but I too lazy to create, append table & form elements this.tabs[l].finger.innerHTML = l + 1; this.tabs[l].content.innerHTML = this.repeatingContent; // Event handler for fingers, see http://www.brockman.se/writing/method-references.html.utf8 var rvtControl = this; this.tabs[l].finger.onclick = function(){ rvtControl.activate(l) }; this.fingerColumn.insertBefore(this.tabs[l].finger, this.addTabFinger); this.container.insertBefore(this.tabs[l].content, this.clearDiv); //this.container.appendChild(this.tabs[l].content); if ( l == this.tabLimit - 1) { //No more tabs should be added, delete the add button. this.fingerColumn.removeChild(this.addTabFinger); } this.activate(l); }; RepeatingVerticalTabControl.prototype.setTabLimit=function(limit) { this.tabLimit = limit; }