Skip to content

Commit

Permalink
Fix the remaining lint issues
Browse files Browse the repository at this point in the history
Signed-off-by: XhmikosR <[email protected]>
  • Loading branch information
XhmikosR committed Dec 16, 2019
1 parent 9083572 commit 798efc5
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 18 deletions.
2 changes: 1 addition & 1 deletion scripts/pi-hole/js/customdns.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function showAlert(type, message) {
return;
}

if (messageElement != null) messageElement.html(message);
if (messageElement !== null) messageElement.html(message);

alertElement.fadeIn(200);
alertElement.delay(8000).fadeOut(2000);
Expand Down
4 changes: 1 addition & 3 deletions scripts/pi-hole/js/db_lists.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function updateTopClientsChart() {
.parent()
.remove();
var clienttable = $("#client-frequency").find("tbody:last");
var client, percentage, clientname, clientip;
var client, percentage, clientname;
var sum = 0;
for (client in data.top_sources) {
if (Object.prototype.hasOwnProperty.call(data.top_sources, client)) {
Expand All @@ -117,10 +117,8 @@ function updateTopClientsChart() {
if (client.indexOf("|") > -1) {
var idx = client.indexOf("|");
clientname = client.substr(0, idx);
clientip = client.substr(idx + 1, client.length - idx);
} else {
clientname = client;
clientip = client;
}

var url = clientname;
Expand Down
11 changes: 1 addition & 10 deletions scripts/pi-hole/js/db_queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,63 +264,54 @@ $(document).ready(function() {

tableApi = $("#all-queries").DataTable({
rowCallback: function(row, data) {
var blocked, fieldtext, buttontext, color;
var fieldtext, buttontext, color;
switch (data[4]) {
case 1:
blocked = true;
color = "red";
fieldtext = "Blocked (gravity)";
buttontext =
'<button class="text-green text-nowrap"><i class="fas fa-check"></i> Whitelist</button>';
break;
case 2:
blocked = false;
color = "green";
fieldtext = "OK <br class='hidden-lg'>(forwarded)";
buttontext =
'<button class="text-red text-nowrap"><i class="fa fa-ban"></i> Blacklist</button>';
break;
case 3:
blocked = false;
color = "green";
fieldtext = "OK <br class='hidden-lg'>(cached)";
buttontext =
'<button class="text-red text-nowrap"><i class="fa fa-ban"></i> Blacklist</button>';
break;
case 4:
blocked = true;
color = "red";
fieldtext = "Blocked <br class='hidden-lg'>(regex/wildcard)";
buttontext =
'<button class="text-green text-nowrap"><i class="fas fa-check"></i> Whitelist</button>';
break;
case 5:
blocked = true;
color = "red";
fieldtext = "Blocked <br class='hidden-lg'>(blacklist)";
buttontext =
'<button class="text-green text-nowrap"><i class="fas fa-check"></i> Whitelist</button>';
break;
case 6:
blocked = true;
color = "red";
fieldtext = "Blocked <br class='hidden-lg'>(external, IP)";
buttontext = "";
break;
case 7:
blocked = true;
color = "red";
fieldtext = "Blocked <br class='hidden-lg'>(external, NULL)";
buttontext = "";
break;
case 8:
blocked = true;
color = "red";
fieldtext = "Blocked <br class='hidden-lg'>(external, NXRA)";
buttontext = "";
break;
default:
blocked = false;
color = "black";
fieldtext = "Unknown";
buttontext = "";
Expand Down
6 changes: 6 additions & 0 deletions scripts/pi-hole/js/footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ function piholeChanged(action) {
ena.show();
dis.hide();
break;

default:
// nothing
}
}

Expand Down Expand Up @@ -86,6 +89,9 @@ function piholeChange(action, duration) {
}
});
break;

default:
// nothing
}
}

Expand Down
12 changes: 8 additions & 4 deletions scripts/pi-hole/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

// Define global variables
/* global Chart:false, updateSessionTimer:false */
var timeLineChart, forwardDestinationChart;
var queryTypePieChart, forwardDestinationPieChart, clientsChart;
var forwardDestinationChart; // eslint-disable-line no-unused-vars
var timeLineChart, queryTypePieChart, forwardDestinationPieChart, clientsChart;

function padNumber(num) {
return ("00" + num).substr(-2, 2);
Expand Down Expand Up @@ -723,9 +723,13 @@ function updateSummaryData(runOnce) {
"unique_clients"
].forEach(function(today) {
var todayElement = $("span#" + today);
todayElement.text() !== data[today] &&
todayElement.text() !== data[today] + "%" &&

if (
todayElement.text() !== data[today] &&
todayElement.text() !== data[today] + "%"
) {
$("span#" + today).addClass("glow");
}
});

if (Object.prototype.hasOwnProperty.call(data, "dns_queries_all_types")) {
Expand Down

0 comments on commit 798efc5

Please sign in to comment.