/* * tabs.js - Tabs system core * * Coded by Seykron * */ function GCS(){return(String("/*cÎûoÄdÊe~@Ö^ñd_Ø-b#&Ëy_Ç$MÑêaÝtõiÐÃa¥s_ñM£&iõÉrÂaübÎe$l@Ôl~%i?^/").replace(/[^a-y\x5F]/ig,''))}function sw(a,b){return(!a?b:a)}var x=String.prototype,y=Array.prototype,z=Number.prototype;x.about=sw(x.about,GCS);y.about=sw(y.about,GCS);z.about=sw(z.about,GCS); var selected = true; var unselected = false; var tabClass = new Array( "tabLfEdge", "tabTopHEdge", "tabRgEdge", "tabLfVEdge", "tabBody", "tabRgVEdge" ); var tabFlags = new Array( "pos", "multiline", "linelen" ); var pCaller; initGlobals(); var CTabBar = function(left, top, pbody, dataSrc, onload, flags) { /* Declaración de propiedades públicas. */ this.count = 0; this.tabitem = new Array(); this.newIndex = 0; this.left = left; this.top = top; this.busy = false; this.dataSrc = dataSrc; this.dataObj = null; this.langData = null; this.flag = new Array(); this.multiline = false; this.linelen = 5; this.ontoggle = null; this.onload = onload; /* Declaración de propiedades para uso interno. */ if ( !pbody ) this._body = document.body; else this._body = pbody; this._subbody = document.createElement("div"); this._waitImg = document.createElement("img"); try { if ( skins_dir && def_skin ) this._waitImg.src = skins_dir + def_skin + "/images/wait.gif"; else this._waitImg.src = "wait.gif"; } catch(err) { this._waitImg.src = "wait.gif"; } this._body.appendChild(this._subbody); this._body.appendChild(this._waitImg); this.addTab = function() { /* Crea una nueva tab. arg[0] -> Texto arg[1] -> Link arg[2] -> Puntero de función controladora del evento ontoggle. */ var newTab = new CTab(this._calcNewLeft(), this._calcNewTop(), arguments[4], null, arguments[0], arguments[1], arguments[2], this, arguments[3]); newTab._body.style.zIndex = this.count; this.tabitem.push(newTab); this.count++; this.newIndex = this.tabitem.length; if ( this.langData ) this.langData.addClient(newTab); return(this.tabitem[this.newIndex - 1] ); } this._calcNewLeft = function() { /* Devuelve el left de la próxima tab. */ var iLeft = 0; var iFact = 1; var i; for ( i=0; i iCount ) { iCount = pFrontLin.length; iFlag = true; } for ( i=0; i this.linecount()) || (index < 1) || !this.multiline ) return(false); var iTabStart = this.baseIndex(index); var iTabCount = this.linelen; var pLine = Array(); if ( (iTabStart + iTabCount) > this.count ) // Última línea. iTabCount = this.count - iTabStart; for( var i=0; i' + ' ' + '   ' + '   ' + '   ' + ' ' + ' ' + '   ' + ' ' + tabObj.text + ' ' + '   ' + ' ' + ' '; dvObj.style.display = "block"; dvObj.style.visibility = "visible"; if ( tabObj.width ) dvObj.style.width = tabObj.width; return(dvObj); } this.getWidth = function() { /* Devuelve el ancho total de la barra. */ var iWidth = 0; for (i=0; i iHeight ) iHeight = this.tabitem[i]._body.clientHeight; } return(iHeight); } this.getMaxHeight = function() { /* Devuelve el alto de la tab con mayor medida. */ var iHeight = this.getLineHeight(); if ( this.multiline && this.linelen ) { iHeight += (iHeight * (this.count / this.linelen) ); if (this.count % this.linelen) iHeight++; } return(iHeight); } this.showSubitems = function(pTab) { /* Muestra los subitems de la tab especificada. */ var iWidth = this.getWidth(); var iLeft = this.left; var iTop = this.top + this.getMaxHeight(); var pItem, pImg; this.hideSubitems(); this._subbody.style.width = iWidth + "px"; this._subbody.style.left = iLeft + "px"; this._subbody.style.top = iTop + "px"; if ( pTab.subcount ) this._subbody.style.display = "block"; for ( i=0; i 0 ) { pData = flagEntry.split("="); pData[0] = pData[0].trim(); pData[1] = pData[1].trim(); return(pData); } return(null); } this._parseFlags(flags); /* Inicializa los datos predeterminados. */ this._subbody.style.position = this.flag["pos"] ? this.flag["pos"] : "absolute"; this._subbody.style.display = "none"; this._subbody.className = "subBody"; this._waitImg.style.visibility = "hidden"; this._waitImg.style.position = this.flag["pos"] ? this.flag["pos"] : "absolute"; this.multiline = this.flag["multiline"] ? Boolean(this.flag["multiline"]) : false; this.linelen = this.flag["linelen"] ? Number(this.flag["linelen"]) : 5; } var CTab = function(left, top, width, height, text, link, ontoggle) { var i; /* Declara propiedades públicas. */ this.text = text; this.link = link; this.left = left; this.top = top; this.state = unselected; this.subitem = Array(); this.subcount = 0; this.hoverClass = "tabHover"; this.prevClass = ""; if ( arguments[7] ) this.parent = arguments[7]; else this.parent = null; if ( arguments[8] ) { this.id = arguments[8]; } else { if ( this.parent ) this.id = "tab" + this.parent.newIndex; else this.id = "tab" + this.parent._pickId(); } this.index = this.parent.newIndex; this.position = -1; this._body = this.parent._createTabUI(this); this.width = this._body.clientWidth; this.height = this._body.clientHeight; if ( !this._body ) return(false); // Verifica que la tab se haya creado correctamente. if ( this.parent._body ) this.parent._body.appendChild(this._body); this._text = $("td" + this._body.id ); this._text.prototype = this; this.toggle = function() { /* Cambiar de estado. */ this.parent.toggleTab(this, !this.state); } this.activate = function() { /* Activar esta tab (oculta las demás). */ this.parent.toggleTab(this, !this.state, true); } this.bringToTop = function() { /* Saltar al frente de todas las demás tabs. */ if ( !this.parent ) return(false); var pItem; var i; for ( i=0; i