Common.js: Difference between revisions
From Redrock Wiki
No edit summary Tag: Manual revert |
No edit summary |
||
| (20 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
/* Any JavaScript here will be loaded for all users on every page load. */ | /* Any JavaScript here will be loaded for all users on every page load. */ | ||
/* collapsible categories */ | |||
$(function () { | $(function () { | ||
var coll = document.getElementsByClassName("collapsibleList"); | var coll = document.getElementsByClassName("collapsibleList"); | ||
| Line 7: | Line 8: | ||
coll[i].addEventListener("click", function () { | coll[i].addEventListener("click", function () { | ||
var content = this.nextElementSibling | var content = this.nextElementSibling | ||
if (this.closest('.collapsedDefault') && !content.classList.contains("overridden")) { | |||
content.style.cssText = 'display: inline !important'; | |||
content.classList.add("overridden"); | |||
return; | |||
} | |||
if (content.style.display === "inline") { | if (content.style.display === "inline") { | ||
content.style.display | content.style.cssText = 'display: none !important'; | ||
this.innerHTML = this.innerHTML.replace('-', ' | this.innerHTML = this.innerHTML.replace('-down', '-up'); | ||
} else { | } else { | ||
content.style.display | content.style.cssText = 'display: inline !important'; | ||
this.innerHTML = this.innerHTML.replace(' | this.innerHTML = this.innerHTML.replace('-up', '-down'); | ||
} | } | ||
}); | }); | ||
} | } | ||
}); | }); | ||
Latest revision as of 18:36, 9 April 2026
/* Any JavaScript here will be loaded for all users on every page load. */
/* collapsible categories */
$(function () {
var coll = document.getElementsByClassName("collapsibleList");
for (var i = 0; i < coll.length; i++) {
coll[i].addEventListener("click", function () {
var content = this.nextElementSibling
if (this.closest('.collapsedDefault') && !content.classList.contains("overridden")) {
content.style.cssText = 'display: inline !important';
content.classList.add("overridden");
return;
}
if (content.style.display === "inline") {
content.style.cssText = 'display: none !important';
this.innerHTML = this.innerHTML.replace('-down', '-up');
} else {
content.style.cssText = 'display: inline !important';
this.innerHTML = this.innerHTML.replace('-up', '-down');
}
});
}
});