微件:ToggleCollapseState/RegFunctions

来自MCG大图书馆
<script>
    function toggleColStat(mwCollapsibleTextID) {
        var elements = document.querySelectorAll('[id="mw-customcollapsible-' + mwCollapsibleTextID + '"]');
        if (elements.length > 0) {
            elements.forEach(function(element) {
                element.style.display = (element.style.display === "none") ? "block" : "none";
            });
        } else {
            console.error(mwCollapsibleTextID + " not found.");
        }
    }
    function idProcess(IDs) {
    	var ids = IDs.split(',');
    	ids.forEach(function(id) {
            toggleColStat(id.trim());
        });
    }
    function idProcesswPrefix(IDs, Pref) {
    	var ids = IDs.split(',');
    	ids.forEach(function(id) {
            toggleColStat(Pref + id.trim());
        });
    }
    function scrollToAnchor(anchorId) {
        var anchor = document.getElementById(anchorId);
        if (anchor) {
            anchor.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "nearest" });
        } else {
            console.error ("anchor not found")
        }
    }
</script>