Mercurial > moin-2.0
changeset 2111:60e75cabd0d6
merged
| author | Thomas Waldmann <tw AT waldmann-edv DOT de> |
|---|---|
| date | Sat, 04 May 2013 16:32:45 +0200 |
| parents | 38b5c2746f83 (current diff) 054749699f8a (diff) |
| children | 678c1bd96267 |
| files | |
| diffstat | 1 files changed, 14 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/MoinMoin/templates/common.js Sat May 04 16:08:33 2013 +0200 +++ b/MoinMoin/templates/common.js Sat May 04 16:32:45 2013 +0200 @@ -253,7 +253,8 @@ // create a UL that will be displayed as row of tabs or column of buttons $(function () { var tabs = $('#moin-usersettings'), - titles = $('<ul class="moin-tab-titles">'); + titles = $('<ul class="moin-tab-titles">'), + hashTag = window.location.hash; // for each form on page, create a corresponding LI $('.moin-tab-body').each(function () { var li = $(document.createElement('li')), @@ -264,6 +265,7 @@ // add click handler to show this form and hide all others aTagClone.click(function (ev) { var tab = this.hash; + window.location.hash = tab; $('.moin-current-tab').removeClass('moin-current-tab'); $(ev.target).addClass('moin-current-tab'); tabs.children('.moin-tab-body').hide().removeClass('moin-current-form'); @@ -275,8 +277,17 @@ $('.moin-tabs ul').remove(); // add tabs/buttons with click handlers to top/side per theme template $('.moin-tabs').prepend(titles); - // click a tab to show first form and hide all other forms - $(titles.children('li').children('a')[0]).click(); + + // check for the hashtag and switch tab + if (hashTag !== '') { + var tab = $('.moin-tab-titles li a[href="'+ hashTag +'"]'); + if (tab.length !== 0) { + $(tab)[0].click(); + } + } else { + // click a tab to show first form and hide all other forms + $(titles.children('li').children('a')[0]).click(); + } // save initial values of each form; used in changeHandler to detect changes to a form $('#moin-usersettings form').each(function () {
