mirror of
https://github.com/bartvdbraak/SlayerWeightCalculator.git
synced 2025-04-27 17:41:22 +00:00
fix bugs
This commit is contained in:
parent
d32ffcef31
commit
879ce1c7c7
2 changed files with 22 additions and 8 deletions
|
@ -76,13 +76,13 @@
|
||||||
<input type="text" min="1" max="99" name="slayerlevel" id="slayerlevel" maxlength="2" placeholder="99" value="99">
|
<input type="text" min="1" max="99" name="slayerlevel" id="slayerlevel" maxlength="2" placeholder="99" value="99">
|
||||||
</div>
|
</div>
|
||||||
<div class="col-6 text-center">
|
<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>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<h3>Krystilia</h3>
|
<h3 id="mastertitle"></h3>
|
||||||
<table id="master" class="display nowrap" width="100%">
|
<table id="master" class="display nowrap" width="100%">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
26
js/script.js
26
js/script.js
|
@ -1,3 +1,7 @@
|
||||||
|
String.prototype.capitalize = function() {
|
||||||
|
return this.charAt(0).toUpperCase() + this.slice(1);
|
||||||
|
}
|
||||||
|
|
||||||
function setBlocklists() {
|
function setBlocklists() {
|
||||||
$.getJSON( "data/monsters.json", {format: "json"}, function( data ) {
|
$.getJSON( "data/monsters.json", {format: "json"}, function( data ) {
|
||||||
|
|
||||||
|
@ -14,8 +18,6 @@ function setBlocklists() {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
setBlocklists();
|
setBlocklists();
|
||||||
applyChanges('krystilia');
|
applyChanges('krystilia');
|
||||||
|
@ -60,8 +62,9 @@ function filterTasks(data) {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'Fossil Island Wyverns':
|
case 'Fossil Island Wyverns':
|
||||||
if ($("#wyverns").prop("checked") == true) {
|
if ($("#fossilwyverns").prop("checked") == true) {
|
||||||
index_list.push(i)
|
index_list.push(i)
|
||||||
|
console.log('1')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,16 +79,21 @@ function filterTasks(data) {
|
||||||
$( ".blocktask" ).each(function( index ) {
|
$( ".blocktask" ).each(function( index ) {
|
||||||
if ($(this).val().toUpperCase() == data[i].monster.toUpperCase()) {
|
if ($(this).val().toUpperCase() == data[i].monster.toUpperCase()) {
|
||||||
index_list.push(i)
|
index_list.push(i)
|
||||||
|
console.log('2')
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Quest unlocks
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(index_list)
|
||||||
|
|
||||||
|
|
||||||
for (var i in index_list) {
|
for (var i in index_list) {
|
||||||
data.splice(i, 1)
|
data.splice(i, 1)
|
||||||
console.log(i)
|
|
||||||
}
|
}
|
||||||
console.log(data)
|
|
||||||
return data
|
return data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,15 +105,21 @@ function sumWeights(data) {
|
||||||
return total
|
return total
|
||||||
}
|
}
|
||||||
|
|
||||||
var table;
|
var table, currentMaster;
|
||||||
|
|
||||||
function deleteOldDataTable() {
|
function deleteOldDataTable() {
|
||||||
table = $('#master').DataTable()
|
table = $('#master').DataTable()
|
||||||
table.destroy();
|
table.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setMasterTitle(master) {
|
||||||
|
$("#mastertitle").text(master.capitalize());
|
||||||
|
}
|
||||||
|
|
||||||
function applyChanges(master) {
|
function applyChanges(master) {
|
||||||
|
currentMaster = master;
|
||||||
deleteOldDataTable();
|
deleteOldDataTable();
|
||||||
|
setMasterTitle(master);
|
||||||
|
|
||||||
$.getJSON( "data/"+master+".json", function( data ) {
|
$.getJSON( "data/"+master+".json", function( data ) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue