1
0
mirror of https://github.com/django/django.git synced 2024-12-22 09:05:43 +00:00

Fixed #35137 -- Simplified JS toggle function

This commit is contained in:
denisiko 2024-12-01 15:12:24 +01:00
parent 6a0006ac0f
commit 1830a420c0

View File

@ -101,14 +101,9 @@
}, false);
});
}
function toggle() {
for (var i = 0; i < arguments.length; i++) {
var e = document.getElementById(arguments[i]);
if (e) {
e.style.display = e.style.display == 'none' ? 'block': 'none';
}
}
return false;
function toggleDisplay(elementId) {
var e = document.getElementById(elementId);
e.style.display = e.style.display == 'none' ? 'block': 'none';
}
function collapseDetails(summaryId) {
var summary = document.getElementById(summaryId);
@ -125,7 +120,8 @@
s1 = "Switch to copy-and-paste view";
s2 = "Switch back to interactive view";
link.textContent = link.textContent.trim() == s1 ? s2: s1;
toggle('browserTraceback', 'pastebinTraceback');
toggleDisplay('browserTraceback');
toggleDisplay('pastebinTraceback');
return false;
}
</script>