diff options
Diffstat (limited to 'phpBB/styles/prosilver/template/forum_fn.js')
-rw-r--r-- | phpBB/styles/prosilver/template/forum_fn.js | 59 |
1 files changed, 39 insertions, 20 deletions
diff --git a/phpBB/styles/prosilver/template/forum_fn.js b/phpBB/styles/prosilver/template/forum_fn.js index bb29f00490..1ab1387d10 100644 --- a/phpBB/styles/prosilver/template/forum_fn.js +++ b/phpBB/styles/prosilver/template/forum_fn.js @@ -106,32 +106,51 @@ function dE(n, s, type) { /** * Alternate display of subPanels */ -function subPanels(p) { - var i, e, t; +jQuery(document).ready(function() { + jQuery('.sub-panels').each(function() { + + var panels = [], + childNodes = jQuery('a[data-subpanel]', this).each(function() { + panels.push(this.getAttribute('data-subpanel')); + }), + show_panel = this.getAttribute('data-show-panel'); + + if (panels.length) { + subPanels(show_panel); + childNodes.click(function () { + subPanels(this.getAttribute('data-subpanel')); + return false; + }); + } - if (typeof(p) === 'string') { - show_panel = p; - } + function subPanels(p) { + var i, e, t; - for (i = 0; i < panels.length; i++) { - e = document.getElementById(panels[i]); - t = document.getElementById(panels[i] + '-tab'); + if (typeof(p) === 'string') { + show_panel = p; + } - if (e) { - if (panels[i] === show_panel) { - e.style.display = 'block'; - if (t) { - t.className = 'activetab'; - } - } else { - e.style.display = 'none'; - if (t) { - t.className = ''; + for (i = 0; i < panels.length; i++) { + e = document.getElementById(panels[i]); + t = document.getElementById(panels[i] + '-tab'); + + if (e) { + if (panels[i] === show_panel) { + e.style.display = 'block'; + if (t) { + t.className = 'activetab'; + } + } else { + e.style.display = 'none'; + if (t) { + t.className = ''; + } + } } } } - } -} + }); +}); /** * Call print preview |