diff options
-rw-r--r-- | phpBB/assets/javascript/plupload.js | 5 | ||||
-rw-r--r-- | phpBB/styles/prosilver/template/forum_fn.js | 40 |
2 files changed, 30 insertions, 15 deletions
diff --git a/phpBB/assets/javascript/plupload.js b/phpBB/assets/javascript/plupload.js index 8ffd452a09..5445e83e15 100644 --- a/phpBB/assets/javascript/plupload.js +++ b/phpBB/assets/javascript/plupload.js @@ -586,6 +586,11 @@ uploader.bind('FilesAdded', function(up, files) { return; } + // Switch the active tab if the style supports it + if (typeof activateSubPanel == 'function') { + activateSubPanel('attach-panel'); + } + // Show the file list if there aren't any files currently. if (!$('#file-list-container').is(':visible')) { $('#file-list-container').show(100); diff --git a/phpBB/styles/prosilver/template/forum_fn.js b/phpBB/styles/prosilver/template/forum_fn.js index ef7ca23ef4..fa838fde19 100644 --- a/phpBB/styles/prosilver/template/forum_fn.js +++ b/phpBB/styles/prosilver/template/forum_fn.js @@ -104,28 +104,38 @@ jQuery(document).ready(function() { show_panel = this.getAttribute('data-show-panel'); if (panels.length) { - subPanels(show_panel); + activateSubPanel(show_panel, panels); childNodes.click(function () { - subPanels(this.getAttribute('data-subpanel')); + activateSubPanel(this.getAttribute('data-subpanel'), panels); return false; }); } + }); +}); - function subPanels(p) { - var i; +/** +* Activate specific subPanel +*/ +function activateSubPanel(p, panels) { + var i; - if (typeof(p) === 'string') { - show_panel = p; - } - $('input[name="show_panel"]').val(show_panel); + if (typeof(p) === 'string') { + show_panel = p; + } + $('input[name="show_panel"]').val(show_panel); - for (i = 0; i < panels.length; i++) { - jQuery('#' + panels[i]).css('display', panels[i] === show_panel ? 'block' : 'none'); - jQuery('#' + panels[i] + '-tab').toggleClass('activetab', panels[i] === show_panel); - } - } - }); -}); + if (typeof(panels) === 'undefined') { + panels = []; + jQuery('.sub-panels a[data-subpanel]').each(function() { + panels.push(this.getAttribute('data-subpanel')); + }); + } + + for (i = 0; i < panels.length; i++) { + jQuery('#' + panels[i]).css('display', panels[i] === show_panel ? 'block' : 'none'); + jQuery('#' + panels[i] + '-tab').toggleClass('activetab', panels[i] === show_panel); + } +} /** * Call print preview |