This commit is contained in:
Bart van der Braak 2019-04-26 14:48:29 +02:00
parent d32ffcef31
commit 879ce1c7c7
2 changed files with 22 additions and 8 deletions

View file

@ -76,13 +76,13 @@
<input type="text" min="1" max="99" name="slayerlevel" id="slayerlevel" maxlength="2" placeholder="99" value="99">
</div>
<div class="col-6 text-center">
<input type="submit" value="Apply changes" onclick="applyChanges('krystilia')">
<input type="submit" value="Apply changes" onclick="applyChanges(currentMaster)">
</div>
</div>
<div class="row">
<div class="col">
<h3>Krystilia</h3>
<h3 id="mastertitle"></h3>
<table id="master" class="display nowrap" width="100%">
<thead>
<tr>

View file

@ -1,3 +1,7 @@
String.prototype.capitalize = function() {
return this.charAt(0).toUpperCase() + this.slice(1);
}
function setBlocklists() {
$.getJSON( "data/monsters.json", {format: "json"}, function( data ) {
@ -14,8 +18,6 @@ function setBlocklists() {
})
}
$(document).ready(function() {
setBlocklists();
applyChanges('krystilia');
@ -60,8 +62,9 @@ function filterTasks(data) {
}
break;
case 'Fossil Island Wyverns':
if ($("#wyverns").prop("checked") == true) {
if ($("#fossilwyverns").prop("checked") == true) {
index_list.push(i)
console.log('1')
}
}
@ -76,16 +79,21 @@ function filterTasks(data) {
$( ".blocktask" ).each(function( index ) {
if ($(this).val().toUpperCase() == data[i].monster.toUpperCase()) {
index_list.push(i)
console.log('2')
}
});
// Quest unlocks
}
console.log(index_list)
for (var i in index_list) {
data.splice(i, 1)
console.log(i)
}
console.log(data)
return data
}
@ -97,15 +105,21 @@ function sumWeights(data) {
return total
}
var table;
var table, currentMaster;
function deleteOldDataTable() {
table = $('#master').DataTable()
table.destroy();
}
function setMasterTitle(master) {
$("#mastertitle").text(master.capitalize());
}
function applyChanges(master) {
currentMaster = master;
deleteOldDataTable();
setMasterTitle(master);
$.getJSON( "data/"+master+".json", function( data ) {