|
|
| 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}}} |