diff options
| author | Daniel Sutcliffe <dansut@users.sourceforge.net> | 2009-07-22 15:49:24 +0000 |
|---|---|---|
| committer | Daniel Sutcliffe <dansut@users.sourceforge.net> | 2009-07-22 15:49:24 +0000 |
| commit | 86a7aca95b0a875551a9adf37a16c4d1e0b4dd80 (patch) | |
| tree | 99065193537bc91d4bfb08d4c02d3e04927c1896 /javascript/libs | |
| parent | 8234e7d487fb21ab480307589f22ed47f648196e (diff) | |
| download | util-86a7aca95b0a875551a9adf37a16c4d1e0b4dd80.tar.gz util-86a7aca95b0a875551a9adf37a16c4d1e0b4dd80.tar.bz2 util-86a7aca95b0a875551a9adf37a16c4d1e0b4dd80.zip | |
make tab persistance unable to select non existent tab
Diffstat (limited to 'javascript/libs')
| -rw-r--r-- | javascript/libs/tabpane.js | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/javascript/libs/tabpane.js b/javascript/libs/tabpane.js index 2143b2b..9d86fb6 100644 --- a/javascript/libs/tabpane.js +++ b/javascript/libs/tabpane.js @@ -1,4 +1,4 @@ -// $Header: /cvsroot/bitweaver/_bit_util/javascript/libs/tabpane.js,v 1.20 2008/12/11 15:04:52 wjames5 Exp $ +// $Header: /cvsroot/bitweaver/_bit_util/javascript/libs/tabpane.js,v 1.21 2009/07/22 15:49:24 dansut Exp $ //------------------------------------------------------------------------- // Tab Pane 1.02 @@ -78,16 +78,16 @@ function WebFXTabPane( el, bUseCookie ) { this.pages = []; this.selectedIndex = null; + this.useCookie = bUseCookie != null ? bUseCookie : true; + // <--- quick hack to set persistence only on pages where referrer == location var ref = document.referrer.split( /[#\?]/ ); var loc = document.location.href.split( /[#\?]/ ); if( loc[0] != ref[0] ) { - WebFXTabPane.setCookie( "webfxtab_" + this.element.id, 0 ); + this.useCookie = false; } // end quick hack - xing ---> - this.useCookie = bUseCookie != null ? bUseCookie : true; - // add class name tag to class name this.element.className = this.classNameTag + " " + this.element.className; @@ -96,15 +96,6 @@ function WebFXTabPane( el, bUseCookie ) { this.tabRow.className = "tabcontainer"; el.insertBefore( this.tabRow, el.firstChild ); - var tabIndex = 0; - if ( this.useCookie ) { - tabIndex = Number( WebFXTabPane.getCookie( "webfxtab_" + this.element.id ) ); - if ( isNaN( tabIndex ) ) { - tabIndex = 0; - } - } - this.selectedIndex = tabIndex; - // loop through child nodes and add them var cs = el.childNodes; var n; @@ -113,6 +104,15 @@ function WebFXTabPane( el, bUseCookie ) { this.addTabPage( cs[i] ); } } + + var tabIndex = 0; + if ( this.useCookie ) { + tabIndex = Number( WebFXTabPane.getCookie( "webfxtab_" + this.element.id ) ); + if ( isNaN( tabIndex ) || !this.pages[ tabIndex ] ) { + tabIndex = 0; + } + } + this.setSelectedIndex( tabIndex ); } WebFXTabPane.prototype.classNameTag = "tabsystem"; |
