More actions
Boundbylife (talk | contribs) No edit summary |
Boundbylife (talk | contribs) No edit summary |
||
| Line 8: | Line 8: | ||
<script> | <script> | ||
document.addEventListener('DOMContentLoaded', function () { | document.addEventListener('DOMContentLoaded', function () { | ||
// Create a toggle button | |||
var toggleButton = document.createElement('button'); | var toggleButton = document.createElement('button'); | ||
toggleButton.textContent = 'Advanced View'; | toggleButton.textContent = 'Advanced View'; | ||
toggleButton.onclick = function() { | toggleButton.onclick = function() { | ||
var columns = document.querySelectorAll('.toggle-column'); | // 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++) { | for (var i = 0; i < columns.length; i++) { | ||
// Toggle display state | |||
columns[i].style.display = columns[i].style.display === 'none' ? '' : 'none'; | columns[i].style.display = columns[i].style.display === 'none' ? '' : 'none'; | ||
} | } | ||
// Toggle button text | |||
this.textContent = this.textContent === 'Advanced View' ? 'Hide Advanced View' : 'Advanced View'; | this.textContent = this.textContent === 'Advanced View' ? 'Hide Advanced View' : 'Advanced View'; | ||
}; | }; | ||
var | // 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> | </script> | ||
Revision as of 17:57, 17 April 2024
Syntax
To use this template, simply use the following syntax:
| Code | Explanation |
|---|---|
| {{npcwh|start}} | This begins the table and adds headers. |
| {{npcwh|wave|Wave 1}} | Inserts a wave header. Whatever you pass as the second parameter ends up in the title. |
| {{npcwh|Sleepless Warden|2x|{{trigger}}}} | Here we specify the NPC's name, number, and trigger status. Passing {{trigger}} inserts a red "x" after the name. |
| {{npcwh|end}} | This tells the table to stop. |
Shortened Syntax
You can use short names for convenience:
- {{npcwh|swar|2x|{{trigger}}}}
- {{npcwh|suph|3x}}
- {{npcwh|skee|4x}}
The short name takes the first letter of the first word (eg. "Sleepless" becomes "s") and adds the first three letters of the second word (eg. "Warden" becomes "war").
No Headers
Alternatively you can start a table with no headers:
- {{npcwh|start2}}
Example Usage
Headers
| name | data | more data |
|---|---|---|
| cats | 273 | 53 |
| dogs | 65 | 8,492 |
| mice | 1,649 | 548 |
<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 | | {{{2}}} x start {{{3}}} | class=icon | | class=icon | | class=icon | |-
| Sleeper Ship Name | Effect(s) | Sig | Speed | Attack | Orbit | DPS/Volley | DPS/Volley | EHP | ||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Wave 1 | ||||||||||||||
|
|
|
|
|
55 km |
58 |
340 |
|
|||||||
|
3x Sleepless Upholder |
|
|
|
|
65 km |
382 |
60 |
|
||||||
|
4x Emergent Keeper |
|
|
|
|
5 km |
8 |
16 |
|
||||||
|
|
16x Awakened Keeper |
|
|
|
|
30 km |
36 |
18 |
|
|||||
|
|
2x Wakeful Sentry Tower |
|
|
|
0 km |
74 |
0 |
|
||||||
| Capital Escalation 1 | ||||||||||||||
|
10x Sleepless Warden |
|
|
|
|
55 km |
58 |
340 |
|
||||||
No Headers
|
Sleepless Upholder |
|
|
|
|
65 km |
382 |
60 |
|