1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

[ticket/11563] Fix subPanels()

Fix subPanels() code
Modernize subPanels() with jQuery
Use HTML5 data attributes instead of including JS

PHPBB3-11563
This commit is contained in:
Vjacheslav Trushkin
2013-05-23 11:55:04 +03:00
parent 2fcae1ca16
commit 7a34c7eabe
4 changed files with 47 additions and 47 deletions

View File

@@ -106,32 +106,48 @@ 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() {
if (typeof(p) === 'string') {
show_panel = p;
}
var panels = this.getAttribute('data-panels').split(','),
show_panel = this.getAttribute('data-show-panel');
for (i = 0; i < panels.length; i++) {
e = document.getElementById(panels[i]);
t = document.getElementById(panels[i] + '-tab');
if (panels.length) {
subPanels(show_panel);
jQuery('a[data-subpanel]', this).click(function () {
subPanels(this.getAttribute('data-subpanel'));
return false;
});
}
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 = '';
function subPanels(p) {
var i, e, t;
if (typeof(p) === 'string') {
show_panel = p;
}
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