Difference between revisions of "MediaWiki:CreatureList.js"
Jump to navigation
Jump to search
Nussnougat (talk | contribs) m (Protected "MediaWiki:CreatureList.js" ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))) |
Nussnougat (talk | contribs) |
||
Line 1: | Line 1: | ||
function drawTable(mobs) { | function drawTable(mobs) { | ||
var output = $("#creatures-list"); | var output = $("#creatures-list"); | ||
− | var html = "<table class='vvwiki-table'><tr><th>Name</th><th>HP</th><th>Damage</th></tr>"; | + | var html = "<div><button>Add</button></div>" |
+ | var html = "<table class='vvwiki-table'><tr><th>Name</th><th>HP</th><th>Damage</th><th>Maturity</th></tr>"; | ||
mobs.forEach(function(mob) { | mobs.forEach(function(mob) { | ||
var url = "/index.php/Creatures:"+mob["name"]; | var url = "/index.php/Creatures:"+mob["name"]; | ||
Line 7: | Line 8: | ||
html += "<td><b><a href='"+url+"'>"+mob["name"]+"</a></b></td>"; | html += "<td><b><a href='"+url+"'>"+mob["name"]+"</a></b></td>"; | ||
html += "<td>"+mob["hp"]+"</td>"; | html += "<td>"+mob["hp"]+"</td>"; | ||
− | html += "<td>"+mob[" | + | html += "<td>"+mob["min_damage"]+" - "+mob["max_damage"]+"</td>"; |
+ | html += "<td>"+mob["maturity"]+"</td>"; | ||
html += "</tr>" | html += "</tr>" | ||
}); | }); |
Revision as of 13:28, 6 August 2019
function drawTable(mobs) { var output = $("#creatures-list"); var html = "<div><button>Add</button></div>" var html = "<table class='vvwiki-table'><tr><th>Name</th><th>HP</th><th>Damage</th><th>Maturity</th></tr>"; mobs.forEach(function(mob) { var url = "/index.php/Creatures:"+mob["name"]; html += "<tr>"; html += "<td><b><a href='"+url+"'>"+mob["name"]+"</a></b></td>"; html += "<td>"+mob["hp"]+"</td>"; html += "<td>"+mob["min_damage"]+" - "+mob["max_damage"]+"</td>"; html += "<td>"+mob["maturity"]+"</td>"; html += "</tr>" }); html += "</table>"; output.html(html); } $(document).ready(function() { if ($("#creatures-list") != null) { $.ajax({ type: "GET", dataType: "json", url: "/vv-api/get-creatures.php", success: function(data) { drawTable(data.result); }, error: function(status, exec) { $("#creatures-list").html("<i>Error retrieving mob data!</i>"); } }); } });