Merge pull request #585 from pi-hole/tweak/query_log_clickfiltering

Allow one-click filtering in Query Log
This commit is contained in:
DL6ER
2017-10-10 19:18:30 +02:00
committed by GitHub
3 changed files with 37 additions and 4 deletions

View File

@@ -185,8 +185,33 @@ $(document).ready(function() {
"targets": -1,
"data": null,
"defaultContent": ""
} ]
} ],
"initComplete": function () {
var api = this.api();
// Query type IPv4 / IPv6
api.$('td:eq(1)').click( function () { api.search( this.innerHTML ).draw(); $('#resetButton').show(); } );
api.$('td:eq(1)').hover(
function () { this.title="Click to show only "+this.innerHTML+" queries"; this.style.color="#72afd2" },
function () { this.style.color="" }
);
api.$("td:eq(1)").css("cursor","pointer");
// Domain
api.$('td:eq(2)').click( function () { api.search( this.innerHTML ).draw(); $('#resetButton').show(); } );
api.$('td:eq(2)').hover(
function () { this.title="Click to show only queries with domain "+this.innerHTML; this.style.color="#72afd2" },
function () { this.style.color="" }
);
api.$("td:eq(2)").css("cursor","pointer");
// Client
api.$('td:eq(3)').click( function () { api.search( this.innerHTML ).draw(); $('#resetButton').show(); } );
api.$('td:eq(3)').hover(
function () { this.title="Click to show only queries made by "+this.innerHTML; this.style.color="#72afd2" },
function () { this.style.color="" }
);
api.$("td:eq(3)").css("cursor","pointer");
}
});
$("#all-queries tbody").on( "click", "button", function () {
var data = tableApi.row( $(this).parents("tr") ).data();
if (data[4] === "1" || data[4] === "5")
@@ -198,6 +223,8 @@ $(document).ready(function() {
add(data[2],"black");
}
} );
$('#resetButton').click( function () { tableApi.search("").draw(); $('#resetButton').hide(); } );
} );