Skip to content
Permalink
Browse files

DBC filtering

  • Loading branch information...
Marlamin committed Sep 8, 2019
1 parent 726f063 commit f48d238a0762824865053b5295475163935305aa
Showing with 24 additions and 4 deletions.
  1. +1 −1 dbc/css/dbc.css
  2. +21 −1 dbc/index.php
  3. +2 −2 maps/js/leaflet_wowmap.js
@@ -85,7 +85,7 @@
.select2-container--default .select2-results>.select2-results__options{
max-height: 400px !important;
}

thead input { width: 100% }
/* Mobile Devices */
@media screen and (max-width: 767px) {
#fileFilter, #buildFilter, #dbcform {
@@ -153,7 +153,26 @@
<script src="/dbc/js/dbc.js?v=<?=filemtime("/var/www/wow.tools/dbc/js/dbc.js")?>"></script>
<script type='text/javascript'>
var currentBuild = 0;
var filtersEnabled = false;
function toggleFilters(){
if(!filtersEnabled){
$("#tableContainer thead tr").clone(true).appendTo("#tableContainer thead");
$("#tableContainer thead tr:eq(1) th").each( function (i) {
var title = $(this).text();
$(this).html( '<input type="text"/>' );
$( 'input', this ).on( 'keyup change', function () {
if ( $('#dbtable').DataTable().column(i).search() !== this.value ) {
$('#dbtable').DataTable().column(i).search(this.value).draw();
}
} );
} );
filtersEnabled = true;
}else{
$("#tableContainer thead tr:eq(1)").remove();
filtersEnabled = false;
}
}
(function() {
$('#fileFilter').select2();
var vars = {};
@@ -235,8 +254,8 @@
"serverSide": true,
"ajax": {
"url": "/api/data/" + vars["dbc"].toLowerCase() + "/?build=" + vars["build"],
"type": "POST",
"data": function( result ) {
delete result.columns;
return result;
}
},
@@ -246,6 +265,7 @@
"pagingType": "input",
"orderMulti": false,
"ordering": false,
"language": { "search": "<a class='btn btn-dark btn-sm btn-outline-primary' href='#' onClick='toggleFilters()' style='margin-right: 10px'>Toggle filters</a> Search: _INPUT_ " },
"search": { "search": searchString },
"columnDefs": [
{
@@ -417,13 +417,13 @@

function drawWorldMap(){
var wmapxhr = new XMLHttpRequest();
wmapxhr.open( 'GET', '/api/data/uimapassignment/?build=' + Versions[Current.Map][Current.Version].fullbuild + '&draw=1&start=0&length=10000&search%5Bvalue%5D=&search%5Bregex%5D=false&columns%5B6%5D%5Bsearch%5D%5Bvalue%5D=' + Current.InternalMapID, true );
wmapxhr.open( 'GET', '/api/data/uimapassignment/?build=' + Versions[Current.Map][Current.Version].fullbuild + '&draw=1&start=0&length=10000&search%5Bvalue%5D=&search%5Bregex%5D=false&columns%5B13%5D%5Bsearch%5D%5Bvalue%5D=exact:' + Current.InternalMapID, true );
wmapxhr.responseType = 'json';
wmapxhr.onreadystatechange = function() {
if (wmapxhr.readyState === 4){
var drawn = new Array();
for(var i = 0; i < wmapxhr.response.data.length; i++){
if(!drawn.includes(wmapxhr.response.data[i][11])){
if(wmapxhr.response.data[i][13] == Current.InternalMapID && !drawn.includes(wmapxhr.response.data[i][11])){
var latlngx = WoWtoLatLng(wmapxhr.response.data[i][4], wmapxhr.response.data[i][5]);
var latlngy = WoWtoLatLng(wmapxhr.response.data[i][7], wmapxhr.response.data[i][8]);
WorldMapLayer.addLayer(new L.imageOverlay("/maps/worldmap/" + wmapxhr.response.data[i][11] + ".png", [latlngx, latlngy], {opacity: 0.67}));

0 comments on commit f48d238

Please sign in to comment.
You can’t perform that action at this time.