User:Terasail/ReferenceHider.js

let reflists = $('.reflist'); if (reflists.length > 0) { for (let i = 0; i < reflists.length; i++) { reflists[i].id = "CollapsibleSection" + i;		let section = $('#CollapsibleSection' + i)[0]; let sectionList = section.children[0]; sectionList.style = "display:none;"; $(section).prepend(' Open reference list '); let toggleButton = $('#listToggle' + i)[0]; $(toggleButton).on('click', function (e) {			e.preventDefault;			if (toggleButton.innerHTML == "Open") {				sectionList.style = "";				toggleButton.innerHTML = "Close";			} else {				sectionList.style = "display:none;";				toggleButton.innerHTML = "Open";			}		}); } }