Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

User:Boundbylife/template:npcwh: Difference between revisions

From EVE University Wiki
No edit summary
No edit summary
 
Line 1: Line 1:
<!--THIS IS TESTING CSS, AND SHOULD BE REPLACED BY A MODIFIED {{NPCTableCSS}} FOR DEPLOYMENT -->
<!--THIS IS TESTING CSS, AND SHOULD BE REPLACED BY A MODIFIED {{NPCTableCSS}} FOR DEPLOYMENT -->
<includeonly>
<includeonly>
<style>
.toggle-column {
    display: none;
}
</style>
<script>
document.addEventListener('DOMContentLoaded', function () {
    // Create a toggle button
    var toggleButton = document.createElement('button');
    toggleButton.textContent = 'Advanced View';
    toggleButton.onclick = function() {
        // Select all toggleable columns in tables with 'wikitable' and/or 'sortable' classes
        var columns = document.querySelectorAll('.wikitable .toggle-column, .sortable .toggle-column');
        for (var i = 0; i < columns.length; i++) {
            // Toggle display state
            columns[i].style.display = columns[i].style.display === 'none' ? '' : 'none';
        }
        // Toggle button text
        this.textContent = this.textContent === 'Advanced View' ? 'Hide Advanced View' : 'Advanced View';
    };
    // Select all tables to potentially insert the toggle button before each
    var tables = document.querySelectorAll('.wikitable, .sortable');
    tables.forEach(function(table) {
        var buttonClone = toggleButton.cloneNode(true); // Clone the button for each table
        table.parentNode.insertBefore(buttonClone, table); // Insert the button above each table
    });
});
</script>
|-
|-
| class=icon | {{#switch: {{{1}}}
| class=icon | {{#switch: {{{1}}}