forked from I2P_Developers/i2p.i2p
improve collapsing table behavior
This commit is contained in:
@ -11,23 +11,33 @@ hideableTables.forEach(function(configTable) {
|
|||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
configTable.onclick = function() {
|
function hideRow(row) {
|
||||||
var collapseme = false;
|
if (Object.keys(row.querySelectorAll(".buttons")).length < 1 ) {
|
||||||
|
if (Object.keys(row.querySelectorAll("th")).length < 1 ) {
|
||||||
|
row.style.visibility = "collapse";
|
||||||
|
}
|
||||||
|
} else if (Object.keys(row.querySelectorAll("th")).length < 1 ) {
|
||||||
|
if (Object.keys(row.querySelectorAll(".buttons")).length < 1 ) {
|
||||||
|
row.style.visibility = "collapse";
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
configTable.style.visibility = "visible"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function showAllControls() {
|
||||||
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();
|
hideRow(row)
|
||||||
if (i >= l) {
|
}
|
||||||
|
}
|
||||||
|
configTable.onclick = function() {
|
||||||
|
var minRow = lookupTableRow();
|
||||||
|
for (var i = 0, row; (row = configTable.offsetParent.rows[i]); i++) {
|
||||||
|
if (i >= minRow) {
|
||||||
if (row.classList.contains("tunnelConfigExpanded")) {
|
if (row.classList.contains("tunnelConfigExpanded")) {
|
||||||
row.style.visibility = "collapse";
|
hideRow(row)
|
||||||
row.querySelectorAll("th").forEach(function(configRow) {
|
|
||||||
configRow.classList.remove('tunnelConfigExpanded');
|
|
||||||
configRow.parentElement.style.visiblity = "visible"
|
|
||||||
});
|
|
||||||
row.querySelectorAll(".buttons").forEach(function(configRow) {
|
|
||||||
configRow.classList.remove('tunnelConfigExpanded');
|
|
||||||
configRow.parentElement.style.visiblity = "visible"
|
|
||||||
});
|
|
||||||
configTable.classList.remove('tunnelConfigExpanded');
|
configTable.classList.remove('tunnelConfigExpanded');
|
||||||
row.classList.remove('tunnelConfigExpanded');
|
row.classList.remove('tunnelConfigExpanded');
|
||||||
|
console.log("hiding", row)
|
||||||
} else {
|
} else {
|
||||||
row.style.visibility = "visible";
|
row.style.visibility = "visible";
|
||||||
row.querySelectorAll("th").forEach(function(configRow) {
|
row.querySelectorAll("th").forEach(function(configRow) {
|
||||||
@ -36,28 +46,13 @@ hideableTables.forEach(function(configTable) {
|
|||||||
configTable.classList.add('tunnelConfigExpanded');
|
configTable.classList.add('tunnelConfigExpanded');
|
||||||
row.classList.add('tunnelConfigExpanded')
|
row.classList.add('tunnelConfigExpanded')
|
||||||
row.classList.add('excludeBackgroundImage')
|
row.classList.add('excludeBackgroundImage')
|
||||||
|
console.log("unhiding", row)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
configTable.parentNode.style.visibility = "visible";
|
configTable.parentNode.style.visibility = "visible";
|
||||||
};
|
};
|
||||||
for (var i = 0, row; (row = configTable.offsetParent.rows[i]); i++) {
|
showAllControls()
|
||||||
if (row.firstElementChild.localName != "th") {
|
|
||||||
if (!row.firstElementChild.classList.contains("buttons")) {
|
|
||||||
row.style.visibility = "collapse";
|
|
||||||
row.querySelectorAll("th").forEach(function(configRow) {
|
|
||||||
configRow.classList.remove('tunnelConfigExpanded');
|
|
||||||
configRow.parentElement.style.visiblity = "visible"
|
|
||||||
});
|
|
||||||
row.querySelectorAll(".buttons").forEach(function(configRow) {
|
|
||||||
configRow.classList.remove('tunnelConfigExpanded');
|
|
||||||
configRow.parentElement.style.visiblity = "visible"
|
|
||||||
});
|
|
||||||
configTable.classList.remove('tunnelConfigExpanded');
|
|
||||||
row.classList.remove('tunnelConfigExpanded');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
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";
|
||||||
row.querySelectorAll("th").forEach(function(configRow) {
|
row.querySelectorAll("th").forEach(function(configRow) {
|
||||||
|
Reference in New Issue
Block a user