fix +/- expand collapse on i2ptunnel tables, and fix the padding

This commit is contained in:
hankhill19580
2020-04-26 02:19:47 +00:00
parent 2a8f23602a
commit 1083d2939b
3 changed files with 19 additions and 17 deletions

View File

@ -3,19 +3,15 @@ function initTables() {
var hideableTables = document.querySelectorAll("table.tunnelConfig th"); var hideableTables = document.querySelectorAll("table.tunnelConfig th");
hideableTables.forEach(function(configTable) { hideableTables.forEach(function(configTable) {
configTable.onclick = function() { function lookupTableRow() {
function lookupTableRow() { for (var i = 0, row; (row = configTable.offsetParent.rows[i]); i++) {
for ( if (configTable.parentNode == row) {
var i = 0, row; return i;
(row = configTable.offsetParent.rows[i]);
i++
) {
if (configTable.parentNode == row) {
return i;
}
} }
return -1;
} }
return -1;
}
configTable.onclick = function() {
var collapseme = false; var collapseme = false;
for (var i = 0, row; (row = configTable.offsetParent.rows[i]); i++) { for (var i = 0, row; (row = configTable.offsetParent.rows[i]); i++) {
var l = lookupTableRow(); var l = lookupTableRow();
@ -27,6 +23,8 @@ hideableTables.forEach(function(configTable) {
) { ) {
row.style.visibility = "collapse"; row.style.visibility = "collapse";
} }
} else {
row.firstElementChild.classList.remove('tunnelConfigExpanded');
} }
} else if (row.style.visibility == "visible") { } else if (row.style.visibility == "visible") {
if (row.firstElementChild.localName != "th") { if (row.firstElementChild.localName != "th") {
@ -35,14 +33,15 @@ hideableTables.forEach(function(configTable) {
) { ) {
row.style.visibility = "collapse"; row.style.visibility = "collapse";
collapseme = true; collapseme = true;
configTable.classList.remove(
"tunnelConfigExpanded"
);
} }
} else {
row.firstElementChild.classList.remove('tunnelConfigExpanded');
} }
} else { } else {
row.style.visibility = "visible"; row.style.visibility = "visible";
configTable.classList.add("tunnelConfigExpanded"); if (row.firstElementChild.localName == 'th') {
row.firstElementChild.classList.add('tunnelConfigExpanded');
}
} }
} }
} }
@ -57,6 +56,9 @@ hideableTables.forEach(function(configTable) {
} }
for (var i = 0, row; (row = hideableTables[0].offsetParent.rows[i]); i++) { for (var i = 0, row; (row = hideableTables[0].offsetParent.rows[i]); i++) {
row.style.visibility = "visible"; row.style.visibility = "visible";
if (row.firstElementChild.localName == 'th') {
row.firstElementChild.classList.add('tunnelConfigExpanded');
}
} }
}); });

View File

@ -353,7 +353,7 @@ html body#tunnelEditPage form div.panel table#serverTunnelEdit.tunnelConfig tbod
.tunnelConfigExpanded { .tunnelConfigExpanded {
background: url(images/dropdown_active.png) #433e47 !important; background: url(images/dropdown_active.png) #433e47 !important;
padding-left: 30px; padding-left: 0px !important;
} }
.tunnelConfigContracted { .tunnelConfigContracted {

View File

@ -535,7 +535,7 @@ html body#tunnelEditPage form div.panel table#serverTunnelEdit.tunnelConfig tbod
.excludeBackgroundImage { .excludeBackgroundImage {
background-image: none !important; background-image: none !important;
padding-left: 30px; padding-left: 0px !important;
} }
.tunnelProperties { .tunnelProperties {