Difference between revisions of "User:Boundbylife/template:npcwh"

From EVE University Wiki
Jump to: navigation, search
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 container = document.querySelector('.wikitable'); // Adjust if necessary to select appropriately
+
     // Select all tables to potentially insert the toggle button before each
    container.parentNode.insertBefore(toggleButton, container);
+
     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




Template documentation (for the above template, sometimes hidden or invisible)
This is a template to add Wormhole NPCs to any page anywhere. This might be helpful for a Wormhole Site Running Page, for instance, or for a page explaining exactly what sleepers are and how to deal with them.

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

Battleship

2x Sleepless Warden TRIGGER for next wave

Remote Repair

Icon ship sig.png 400

Icon velocity.png 1,305 m/s

Icon target range.png 255 km

55 km Icon orbit.png 145 m/s

58 DPS,Volley,Interval 288 (5 s)

340 DPS,Volley,Interval 6,092 (18 s)

Icon hull.png 134,933

Battleship

3x Sleepless Upholder

Energy Neutralization

Icon ship sig.png 400

Icon velocity.png 800 m/s

Icon target range.png 225 km

65 km Icon orbit.png 100 m/s

382 DPS,Volley,Interval 1,904 (5 s)

60 DPS,Volley,Interval 1,052 (18 s)

Icon hull.png 56,400

frigate

4x Emergent Keeper

Energy NeutralizationRemote Repair

Icon ship sig.png 35

Icon velocity.png 2,880 m/s

Icon target range.png 15 km

5 km Icon orbit.png 320 m/s

8 DPS,Volley,Interval 36 (5 s)

16 DPS,Volley,Interval 136 (9 s)

Icon hull.png 4,400

Cruiser

16x Awakened Keeper

Stasis WebifierWarp DisruptorEnergy Neutralization

Icon ship sig.png 150

Icon velocity.png 2,115 m/s

Icon target range.png 105 km

30 km Icon orbit.png 235 m/s

36 DPS,Volley,Interval 180 (5 s)

18 DPS,Volley,Interval 270 (15 s)

Icon hull.png 19,250

Sentry Tower

2x Wakeful Sentry Tower

Icon ship sig.png 50

Icon velocity.png 0 m/s

Icon target range.png 250 km

0 km Icon orbit.png 0 m/s

74 DPS,Volley,Interval 1,092 (15 s)

0 DPS,Volley,Interval 0 (0 s)

Icon hull.png 15,167

Capital Escalation 1

Battleship

10x Sleepless Warden

Remote Repair

Icon ship sig.png 400

Icon velocity.png 1,305 m/s

Icon target range.png 255 km

55 km Icon orbit.png 145 m/s

58 DPS,Volley,Interval 288 (5 s)

340 DPS,Volley,Interval 6,092 (18 s)

Icon hull.png 134,933


No Headers

Battleship

Sleepless Upholder

Energy Neutralization

Icon ship sig.png 400

Icon velocity.png 800 m/s

Icon target range.png 225 km

65 km Icon orbit.png 100 m/s

382 DPS,Volley,Interval 1,904 (5 s)

60 DPS,Volley,Interval 1,052 (18 s)

Icon hull.png 56,400

Visit User:Boundbylife/template:npcwh/doc to edit this text! (How does this work?) (Refresh this text - why?)