mirror of
https://github.com/bartvdbraak/SlayerWeightCalculator.git
synced 2025-06-28 15:29:15 +00:00
filter tasks
This commit is contained in:
parent
c7c02b4bd1
commit
eedd66d763
6 changed files with 351 additions and 65 deletions
42
js/script.js
42
js/script.js
|
@ -1,29 +1,12 @@
|
|||
jQuery.fn.dataTable.Api.register( 'sum()', function ( ) {
|
||||
return this.flatten().reduce( function ( a, b ) {
|
||||
if ( typeof a === 'string' ) {
|
||||
a = a.replace(/[^\d.-]/g, '') * 1;
|
||||
}
|
||||
if ( typeof b === 'string' ) {
|
||||
b = b.replace(/[^\d.-]/g, '') * 1;
|
||||
}
|
||||
|
||||
return a + b;
|
||||
}, 0 );
|
||||
} );
|
||||
|
||||
function setBlocklists() {
|
||||
$.getJSON( "data/monsters.json", function( data ) {
|
||||
$.getJSON( "data/monsters.json", {format: "json"}, function( data ) {
|
||||
|
||||
var content = '';
|
||||
|
||||
console.log(data)
|
||||
for (i = 0; i < data.length; i++) {
|
||||
console.log(data[i].monster)
|
||||
content += '<option value="'+data[i].monster+'">'+data[i].monster+'</option>'
|
||||
}
|
||||
|
||||
console.log(content)
|
||||
|
||||
$( ".blocktask" ).each(function( index ) {
|
||||
$(this).append(content)
|
||||
});
|
||||
|
@ -31,8 +14,11 @@ function setBlocklists() {
|
|||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
setBlocklists();
|
||||
applyChanges('krystilia');
|
||||
});
|
||||
|
||||
function filterTasks(data) {
|
||||
|
@ -87,12 +73,19 @@ function filterTasks(data) {
|
|||
|
||||
// Task blocks
|
||||
|
||||
|
||||
$( ".blocktask" ).each(function( index ) {
|
||||
if ($(this).val().toUpperCase() == data[i].monster.toUpperCase()) {
|
||||
index_list.push(i)
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
console.log(index_list,data)
|
||||
for (var i in index_list) {
|
||||
data.splice(i, 1)
|
||||
console.log(i)
|
||||
}
|
||||
console.log(data)
|
||||
return data
|
||||
}
|
||||
|
||||
|
@ -106,10 +99,9 @@ function sumWeights(data) {
|
|||
|
||||
var table;
|
||||
|
||||
function deleteOldDataTable(table) {
|
||||
if ( $.fn.dataTable.isDataTable( '#master' ) ) {
|
||||
table.destroy();
|
||||
}
|
||||
function deleteOldDataTable() {
|
||||
table = $('#master').DataTable()
|
||||
table.destroy();
|
||||
}
|
||||
|
||||
function applyChanges(master) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue