1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 05:50:42 +02:00

[ticket/12541] Activate attachments tab when files are dropped into textarea

PHPBB3-12541
This commit is contained in:
PayBas
2014-06-02 12:42:45 +02:00
parent 48679eeff8
commit 082a6b29a9
2 changed files with 30 additions and 15 deletions

View File

@@ -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;
if (typeof(p) === 'string') {
show_panel = p;
}
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);
}
}
});
});
/**
* Activate specific subPanel
*/
function activateSubPanel(p, panels) {
var i;
if (typeof(p) === 'string') {
show_panel = p;
}
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
*/