JS: Enforce camelcase.

It's a common convention to use camelcase for variable names.

Signed-off-by: XhmikosR <xhmikosr@gmail.com>
This commit is contained in:
XhmikosR
2020-05-22 10:47:50 +03:00
parent 0cd6f2113c
commit 0fa7de82b0
12 changed files with 154 additions and 153 deletions

View File

@@ -212,40 +212,40 @@ $(document).ready(function () {
title: function (tooltipItem) {
var label = tooltipItem[0].xLabel;
var time = new Date(label);
var from_date =
var fromDate =
time.getFullYear() +
"-" +
padNumber(time.getMonth() + 1) +
"-" +
padNumber(time.getDate());
var from_time =
var fromTime =
padNumber(time.getHours()) +
":" +
padNumber(time.getMinutes()) +
":" +
padNumber(time.getSeconds());
time = new Date(time.valueOf() + 1000 * interval);
var until_date =
var untilDate =
time.getFullYear() +
"-" +
padNumber(time.getMonth() + 1) +
"-" +
padNumber(time.getDate());
var until_time =
var untilTime =
padNumber(time.getHours()) +
":" +
padNumber(time.getMinutes()) +
":" +
padNumber(time.getSeconds());
if (from_date === until_date) {
if (fromDate === untilDate) {
// Abbreviated form for intervals on the same day
// We split title in two lines on small screens
if ($(window).width() < 992) {
until_time += "\n";
untilTime += "\n";
}
return ("Queries from " + from_time + " to " + until_time + " on " + from_date).split(
return ("Queries from " + fromTime + " to " + untilTime + " on " + fromDate).split(
"\n "
);
}
@@ -253,18 +253,18 @@ $(document).ready(function () {
// Full tooltip for intervals spanning more than one day
// We split title in two lines on small screens
if ($(window).width() < 992) {
from_date += "\n";
fromDate += "\n";
}
return (
"Queries from " +
from_date +
fromDate +
" " +
from_time +
fromTime +
" to " +
until_date +
untilDate +
" " +
until_time
untilTime
).split("\n ");
},
label: function (tooltipItems, data) {

View File

@@ -93,7 +93,7 @@ function piholeChange(action, duration) {
}
}
function check_messages() {
function checkMessages() {
$.getJSON("api_db.php?status", function (data) {
if ("message_count" in data && data.message_count > 0) {
var title;
@@ -122,16 +122,16 @@ $(document).ready(function () {
$("#cookieInfo").show();
}
var checkbox_theme = $("#checkbox_theme").text();
var checkboxTheme = $("#checkbox_theme").text();
$("input").icheck({
checkboxClass: "icheckbox_" + checkbox_theme,
radioClass: "iradio_" + checkbox_theme,
checkboxClass: "icheckbox_" + checkboxTheme,
radioClass: "iradio_" + checkboxTheme,
increaseArea: "20%"
});
// Run check immediately after page loading ...
check_messages();
checkMessages();
// ... and once again with five seconds delay
setTimeout(check_messages, 5000);
setTimeout(checkMessages, 5000);
});
// Handle Enable/Disable

View File

@@ -32,10 +32,11 @@ function eventsource() {
}
// Detect ${OVER}
if (e.data.indexOf("<------") !== -1) {
var newString = "<------";
if (e.data.indexOf(newString) !== -1) {
ta.text(ta.text().substring(0, ta.text().lastIndexOf("\n")) + "\n");
var new_string = e.data.replace("<------", "");
ta.append(new_string);
ta.append(e.data.replace(newString, ""));
} else {
ta.append(e.data);
}

View File

@@ -11,7 +11,7 @@ var table;
var groups = [];
var token = $("#token").text();
function get_groups() {
function getGroups() {
$.post(
"scripts/pi-hole/php/groups.php",
{ action: "get_groups", token: token },
@@ -26,8 +26,8 @@ function get_groups() {
$(document).ready(function () {
$("#btnAdd").on("click", addAdlist);
utils.bsSelect_defaults();
get_groups();
utils.bsSelectDefaults();
getGroups();
});
function initTable() {
@@ -96,13 +96,13 @@ function initTable() {
var selectEl = $("#multiselect_" + data.id, row);
// Add all known groups
for (var i = 0; i < groups.length; i++) {
var data_sub = "";
var dataSub = "";
if (!groups[i].enabled) {
data_sub = 'data-subtext="(disabled)"';
dataSub = 'data-subtext="(disabled)"';
}
selectEl.append(
$("<option " + data_sub + "/>")
$("<option " + dataSub + "/>")
.val(groups[i].id)
.text(groups[i].name)
);
@@ -270,25 +270,25 @@ function editAdlist() {
var address = tr.find("#address_" + id).text();
var done = "edited";
var not_done = "editing";
var notDone = "editing";
switch (elem) {
case "status_" + id:
if (status === 0) {
done = "disabled";
not_done = "disabling";
notDone = "disabling";
} else if (status === 1) {
done = "enabled";
not_done = "enabling";
notDone = "enabling";
}
break;
case "comment_" + id:
done = "edited comment of";
not_done = "editing comment of";
notDone = "editing comment of";
break;
case "multiselect_" + id:
done = "edited groups of";
not_done = "editing groups of";
notDone = "editing groups of";
break;
default:
alert("bad element or invalid data-id!");
@@ -324,7 +324,7 @@ function editAdlist() {
utils.showAlert(
"error",
"",
"Error while " + not_done + " adlist with ID " + id,
"Error while " + notDone + " adlist with ID " + id,
Number(response.message)
);
}
@@ -334,7 +334,7 @@ function editAdlist() {
utils.showAlert(
"error",
"",
"Error while " + not_done + " adlist with ID " + id,
"Error while " + notDone + " adlist with ID " + id,
jqXHR.responseText
);
console.log(exception);

View File

@@ -11,7 +11,7 @@ var table;
var groups = [];
var token = $("#token").text();
function reload_client_suggestions() {
function reloadClientSuggestions() {
$.post(
"scripts/pi-hole/php/groups.php",
{ action: "get_unconfigured_clients", token: token },
@@ -45,7 +45,7 @@ function reload_client_suggestions() {
);
}
function get_groups() {
function getGroups() {
$.post(
"scripts/pi-hole/php/groups.php",
{ action: "get_groups", token: token },
@@ -60,9 +60,9 @@ function get_groups() {
$(document).ready(function () {
$("#btnAdd").on("click", addClient);
reload_client_suggestions();
utils.bsSelect_defaults();
get_groups();
reloadClientSuggestions();
utils.bsSelectDefaults();
getGroups();
$("#select").on("change", function () {
$("#ip-custom").val("");
@@ -99,7 +99,7 @@ function initTable() {
utils.datetime(data.date_modified) +
"\nDatabase ID: " +
data.id;
var ip_name =
var ipName =
'<code id="ip_' +
data.id +
'" title="' +
@@ -108,7 +108,7 @@ function initTable() {
data.ip +
"</code>";
if (data.name !== null && data.name.length > 0)
ip_name +=
ipName +=
'<br><code id="name_' +
data.id +
'" title="' +
@@ -116,7 +116,7 @@ function initTable() {
'" class="breakall">' +
data.name +
"</code>";
$("td:eq(0)", row).html(ip_name);
$("td:eq(0)", row).html(ipName);
$("td:eq(1)", row).html('<input id="comment_' + data.id + '" class="form-control">');
var commentEl = $("#comment_" + data.id, row);
@@ -130,13 +130,13 @@ function initTable() {
var selectEl = $("#multiselect_" + data.id, row);
// Add all known groups
for (var i = 0; i < groups.length; i++) {
var data_sub = "";
var dataSub = "";
if (!groups[i].enabled) {
data_sub = 'data-subtext="(disabled)"';
dataSub = 'data-subtext="(disabled)"';
}
selectEl.append(
$("<option " + data_sub + "/>")
$("<option " + dataSub + "/>")
.val(groups[i].id)
.text(groups[i].name)
);
@@ -291,7 +291,7 @@ function addClient() {
utils.enableAll();
if (response.success) {
utils.showAlert("success", "fas fa-plus", "Successfully added client", ip);
reload_client_suggestions();
reloadClientSuggestions();
table.ajax.reload(null, false);
} else {
utils.showAlert("error", "", "Error while adding new client", response.message);
@@ -315,28 +315,28 @@ function editClient() {
var comment = tr.find("#comment_" + id).val();
var done = "edited";
var not_done = "editing";
var notDone = "editing";
switch (elem) {
case "multiselect_" + id:
done = "edited groups of";
not_done = "editing groups of";
notDone = "editing groups of";
break;
case "comment_" + id:
done = "edited comment of";
not_done = "editing comment of";
notDone = "editing comment of";
break;
default:
alert("bad element or invalid data-id!");
return;
}
var ip_name = ip;
var ipName = ip;
if (name.length > 0) {
ip_name += " (" + name + ")";
ipName += " (" + name + ")";
}
utils.disableAll();
utils.showAlert("info", "", "Editing client...", ip_name);
utils.showAlert("info", "", "Editing client...", ipName);
$.ajax({
url: "scripts/pi-hole/php/groups.php",
method: "post",
@@ -351,17 +351,12 @@ function editClient() {
success: function (response) {
utils.enableAll();
if (response.success) {
utils.showAlert(
"success",
"fas fa-pencil-alt",
"Successfully " + done + " client",
ip_name
);
utils.showAlert("success", "fas fa-pencil-alt", "Successfully " + done + " client", ipName);
table.ajax.reload(null, false);
} else {
utils.showAlert(
"error",
"Error while " + not_done + " client with ID " + id,
"Error while " + notDone + " client with ID " + id,
response.message
);
}
@@ -371,7 +366,7 @@ function editClient() {
utils.showAlert(
"error",
"",
"Error while " + not_done + " client with ID " + id,
"Error while " + notDone + " client with ID " + id,
jqXHR.responseText
);
console.log(exception);
@@ -385,13 +380,13 @@ function deleteClient() {
var ip = tr.find("#ip_" + id).text();
var name = tr.find("#name_" + id).text();
var ip_name = ip;
var ipName = ip;
if (name.length > 0) {
ip_name += " (" + name + ")";
ipName += " (" + name + ")";
}
utils.disableAll();
utils.showAlert("info", "", "Deleting client...", ip_name);
utils.showAlert("info", "", "Deleting client...", ipName);
$.ajax({
url: "scripts/pi-hole/php/groups.php",
method: "post",
@@ -400,9 +395,9 @@ function deleteClient() {
success: function (response) {
utils.enableAll();
if (response.success) {
utils.showAlert("success", "far fa-trash-alt", "Successfully deleted client ", ip_name);
utils.showAlert("success", "far fa-trash-alt", "Successfully deleted client ", ipName);
table.row(tr).remove().draw(false).ajax.reload(null, false);
reload_client_suggestions();
reloadClientSuggestions();
} else {
utils.showAlert("error", "", "Error while deleting client with ID " + id, response.message);
}

View File

@@ -129,7 +129,7 @@ function validateIPv6CIDR(ip) {
return ipv6validator.test(ip);
}
function bsSelect_defaults() {
function bsSelectDefaults() {
// set bootstrap-select defaults
var pickerDEFAULTS = $.fn.selectpicker.Constructor.DEFAULTS;
pickerDEFAULTS.noneSelectedText = "none selected";
@@ -157,6 +157,6 @@ window.utils = (function () {
enableAll: enableAll,
validateIPv4CIDR: validateIPv4CIDR,
validateIPv6CIDR: validateIPv6CIDR,
bsSelect_defaults: bsSelect_defaults
bsSelectDefaults: bsSelectDefaults
};
})();

View File

@@ -13,7 +13,7 @@ var token = $("#token").text();
var GETDict = {};
var showtype = "all";
function get_groups() {
function getGroups() {
$.post(
"scripts/pi-hole/php/groups.php",
{ action: "get_groups", token: token },
@@ -55,8 +55,8 @@ $(document).ready(function () {
$("#add2black, #add2white").on("click", addDomain);
utils.bsSelect_defaults();
get_groups();
utils.bsSelectDefaults();
getGroups();
});
function initTable() {
@@ -100,9 +100,9 @@ function initTable() {
"</code>"
);
var whitelist_options = "";
var whitelistOptions = "";
if (showtype === "all" || showtype === "white") {
whitelist_options =
whitelistOptions =
'<option value="0"' +
(data.type === 0 ? " selected" : "") +
">Exact whitelist</option>" +
@@ -111,9 +111,9 @@ function initTable() {
">Regex whitelist</option>";
}
var blacklist_options = "";
var blacklistOptions = "";
if (showtype === "all" || showtype === "black") {
blacklist_options =
blacklistOptions =
'<option value="1"' +
(data.type === 1 ? " selected " : " ") +
">Exact blacklist</option>" +
@@ -126,8 +126,8 @@ function initTable() {
'<select id="type_' +
data.id +
'" class="form-control">' +
whitelist_options +
blacklist_options +
whitelistOptions +
blacklistOptions +
"</select>"
);
var typeEl = $("#type_" + data.id, row);
@@ -161,13 +161,13 @@ function initTable() {
var selectEl = $("#multiselect_" + data.id, row);
// Add all known groups
for (var i = 0; i < groups.length; i++) {
var data_sub = "";
var dataSub = "";
if (!groups[i].enabled) {
data_sub = 'data-subtext="(disabled)"';
dataSub = 'data-subtext="(disabled)"';
}
selectEl.append(
$("<option " + data_sub + "/>")
$("<option " + dataSub + "/>")
.val(groups[i].id)
.text(groups[i].name)
);
@@ -307,17 +307,17 @@ function addDomain() {
var action = this.id;
var tabHref = $('a[data-toggle="tab"][aria-expanded="true"]').attr("href");
var wildcardEl = $("#wildcard_checkbox");
var wildcard_checked = wildcardEl.prop("checked");
var wildcardChecked = wildcardEl.prop("checked");
var type;
// current tab's inputs
var domain_regex, domainEl, commentEl;
var domainRegex, domainEl, commentEl;
if (tabHref === "#tab_domain") {
domain_regex = "domain";
domainRegex = "domain";
domainEl = $("#new_domain");
commentEl = $("#new_domain_comment");
} else if (tabHref === "#tab_regex") {
domain_regex = "regex";
domainRegex = "regex";
domainEl = $("#new_regex");
commentEl = $("#new_regex_comment");
}
@@ -326,31 +326,31 @@ function addDomain() {
var comment = commentEl.val();
utils.disableAll();
utils.showAlert("info", "", "Adding " + domain_regex + "...", domain);
utils.showAlert("info", "", "Adding " + domainRegex + "...", domain);
if (domain.length > 0) {
// strip "*." if specified by user in wildcard mode
if (domain_regex === "domain" && wildcard_checked && domain.startsWith("*.")) {
if (domainRegex === "domain" && wildcardChecked && domain.startsWith("*.")) {
domain = domain.substr(2);
}
// determine list type
if (domain_regex === "domain" && action === "add2black" && wildcard_checked) {
if (domainRegex === "domain" && action === "add2black" && wildcardChecked) {
type = "3W";
} else if (domain_regex === "domain" && action === "add2black" && !wildcard_checked) {
} else if (domainRegex === "domain" && action === "add2black" && !wildcardChecked) {
type = "1";
} else if (domain_regex === "domain" && action === "add2white" && wildcard_checked) {
} else if (domainRegex === "domain" && action === "add2white" && wildcardChecked) {
type = "2W";
} else if (domain_regex === "domain" && action === "add2white" && !wildcard_checked) {
} else if (domainRegex === "domain" && action === "add2white" && !wildcardChecked) {
type = "0";
} else if (domain_regex === "regex" && action === "add2black") {
} else if (domainRegex === "regex" && action === "add2black") {
type = "3";
} else if (domain_regex === "regex" && action === "add2white") {
} else if (domainRegex === "regex" && action === "add2white") {
type = "2";
}
} else {
utils.enableAll();
utils.showAlert("warning", "", "Warning", "Please specify a " + domain_regex);
utils.showAlert("warning", "", "Warning", "Please specify a " + domainRegex);
return;
}
@@ -368,18 +368,18 @@ function addDomain() {
success: function (response) {
utils.enableAll();
if (response.success) {
utils.showAlert("success", "fas fa-plus", "Successfully added " + domain_regex, domain);
utils.showAlert("success", "fas fa-plus", "Successfully added " + domainRegex, domain);
domainEl.val("");
commentEl.val("");
wildcardEl.prop("checked", false);
table.ajax.reload(null, false);
} else {
utils.showAlert("error", "", "Error while adding new " + domain_regex, response.message);
utils.showAlert("error", "", "Error while adding new " + domainRegex, response.message);
}
},
error: function (jqXHR, exception) {
utils.enableAll();
utils.showAlert("error", "", "Error while adding new " + domain_regex, jqXHR.responseText);
utils.showAlert("error", "", "Error while adding new " + domainRegex, jqXHR.responseText);
console.log(exception);
}
});
@@ -399,41 +399,41 @@ function editDomain() {
var rowData = table.row(tr).data();
var groups = table.column(5).visible() ? tr.find("#multiselect_" + id).val() : rowData.groups;
var domain_regex;
var domainRegex;
if (type === "0" || type === "1") {
domain_regex = "domain";
domainRegex = "domain";
} else if (type === "2" || type === "3") {
domain_regex = "regex";
domainRegex = "regex";
}
var done = "edited";
var not_done = "editing";
var notDone = "editing";
switch (elem) {
case "status_" + id:
if (status === 0) {
done = "disabled";
not_done = "disabling";
notDone = "disabling";
} else if (status === 1) {
done = "enabled";
not_done = "enabling";
notDone = "enabling";
}
break;
case "name_" + id:
done = "edited name of";
not_done = "editing name of";
notDone = "editing name of";
break;
case "comment_" + id:
done = "edited comment of";
not_done = "editing comment of";
notDone = "editing comment of";
break;
case "type_" + id:
done = "edited type of";
not_done = "editing type of";
notDone = "editing type of";
break;
case "multiselect_" + id:
done = "edited groups of";
not_done = "editing groups of";
notDone = "editing groups of";
break;
default:
alert("bad element or invalid data-id!");
@@ -441,7 +441,7 @@ function editDomain() {
}
utils.disableAll();
utils.showAlert("info", "", "Editing " + domain_regex + "...", name);
utils.showAlert("info", "", "Editing " + domainRegex + "...", name);
$.ajax({
url: "scripts/pi-hole/php/groups.php",
method: "post",
@@ -461,7 +461,7 @@ function editDomain() {
utils.showAlert(
"success",
"fas fa-pencil-alt",
"Successfully " + done + " " + domain_regex,
"Successfully " + done + " " + domainRegex,
domain
);
table.ajax.reload(null, false);
@@ -469,7 +469,7 @@ function editDomain() {
utils.showAlert(
"error",
"",
"Error while " + not_done + " " + domain_regex + " with ID " + id,
"Error while " + notDone + " " + domainRegex + " with ID " + id,
response.message
);
},
@@ -478,7 +478,7 @@ function editDomain() {
utils.showAlert(
"error",
"",
"Error while " + not_done + " " + domain_regex + " with ID " + id,
"Error while " + notDone + " " + domainRegex + " with ID " + id,
jqXHR.responseText
);
console.log(exception);
@@ -492,15 +492,15 @@ function deleteDomain() {
var domain = tr.find("#domain_" + id).text();
var type = tr.find("#type_" + id).val();
var domain_regex;
var domainRegex;
if (type === "0" || type === "1") {
domain_regex = "domain";
domainRegex = "domain";
} else if (type === "2" || type === "3") {
domain_regex = "regex";
domainRegex = "regex";
}
utils.disableAll();
utils.showAlert("info", "", "Deleting " + domain_regex + "...", domain);
utils.showAlert("info", "", "Deleting " + domainRegex + "...", domain);
$.ajax({
url: "scripts/pi-hole/php/groups.php",
method: "post",
@@ -512,7 +512,7 @@ function deleteDomain() {
utils.showAlert(
"success",
"far fa-trash-alt",
"Successfully deleted " + domain_regex,
"Successfully deleted " + domainRegex,
domain
);
table.row(tr).remove().draw(false).ajax.reload(null, false);
@@ -520,7 +520,7 @@ function deleteDomain() {
utils.showAlert(
"error",
"",
"Error while deleting " + domain_regex + " with ID " + id,
"Error while deleting " + domainRegex + " with ID " + id,
response.message
);
}
@@ -530,7 +530,7 @@ function deleteDomain() {
utils.showAlert(
"error",
"",
"Error while deleting " + domain_regex + " with ID " + id,
"Error while deleting " + domainRegex + " with ID " + id,
jqXHR.responseText
);
console.log(exception);

View File

@@ -178,25 +178,25 @@ function editGroup() {
var desc = tr.find("#desc_" + id).val();
var done = "edited";
var not_done = "editing";
var notDone = "editing";
switch (elem) {
case "status_" + id:
if (status === 0) {
done = "disabled";
not_done = "disabling";
notDone = "disabling";
} else if (status === 1) {
done = "enabled";
not_done = "enabling";
notDone = "enabling";
}
break;
case "name_" + id:
done = "edited name of";
not_done = "editing name of";
notDone = "editing name of";
break;
case "desc_" + id:
done = "edited description of";
not_done = "editing description of";
notDone = "editing description of";
break;
default:
alert("bad element or invalid data-id!");
@@ -225,7 +225,7 @@ function editGroup() {
utils.showAlert(
"error",
"",
"Error while " + not_done + " group with ID " + id,
"Error while " + notDone + " group with ID " + id,
response.message
);
}
@@ -235,7 +235,7 @@ function editGroup() {
utils.showAlert(
"error",
"",
"Error while " + not_done + " group with ID " + id,
"Error while " + notDone + " group with ID " + id,
jqXHR.responseText
);
console.log(exception);

View File

@@ -9,7 +9,7 @@
var token = $("#token").text();
function render_timestamp(data, type) {
function renderTimestamp(data, type) {
// Display and search content
if (type === "display" || type === "filter") {
return utils.datetime(data);
@@ -23,7 +23,7 @@ function multline(input) {
return input.split(",").join("\n");
}
function render_message(data, type, row) {
function renderMessage(data, type, row) {
// Display and search content
switch (row.type) {
case "REGEX":
@@ -73,9 +73,9 @@ $(document).ready(function () {
order: [[0, "asc"]],
columns: [
{ data: "id", visible: false },
{ data: "timestamp", width: "8%", render: render_timestamp },
{ data: "timestamp", width: "8%", render: renderTimestamp },
{ data: "type", width: "8%" },
{ data: "message", orderable: false, render: render_message },
{ data: "message", orderable: false, render: renderMessage },
{ data: "blob1", visible: false },
{ data: "blob2", visible: false },
{ data: "blob3", visible: false },

View File

@@ -69,29 +69,29 @@ $(document).ready(function () {
var color,
iconClasses,
lastQuery = parseInt(data.lastQuery);
var network_recent = $(".network-recent").css("background-color");
var network_old = $(".network-old").css("background-color");
var network_older = $(".network-older").css("background-color");
var network_never = $(".network-never").css("background-color");
var networkRecent = $(".network-recent").css("background-color");
var networkOld = $(".network-old").css("background-color");
var networkOlder = $(".network-older").css("background-color");
var networkNever = $(".network-never").css("background-color");
if (lastQuery > 0) {
var diff = getTimestamp() - lastQuery;
if (diff <= 86400) {
// Last query came in within the last 24 hours (24*60*60 = 86400)
// Color: light-green to light-yellow
var ratio = Number(diff) / 86400;
var lightgreen = parseColor(network_recent);
var lightyellow = parseColor(network_old);
var lightgreen = parseColor(networkRecent);
var lightyellow = parseColor(networkOld);
color = rgbToHex(mixColors(ratio, lightgreen, lightyellow));
iconClasses = "fas fa-check";
} else {
// Last query was longer than 24 hours ago
// Color: light-orange
color = network_older;
color = networkOlder;
iconClasses = "fas fa-question";
}
} else {
// This client has never sent a query to Pi-hole, color light-red
color = network_never;
color = networkNever;
iconClasses = "fas fa-check";
}

View File

@@ -137,26 +137,26 @@ $(document).ready(function () {
tableApi = $("#all-queries").DataTable({
rowCallback: function (row, data) {
// DNSSEC status
var dnssec_status;
var dnssecStatus;
switch (data[5]) {
case "1":
dnssec_status = '<br><span class="text-green">SECURE</span>';
dnssecStatus = '<br><span class="text-green">SECURE</span>';
break;
case "2":
dnssec_status = '<br><span class="text-orange">INSECURE</span>';
dnssecStatus = '<br><span class="text-orange">INSECURE</span>';
break;
case "3":
dnssec_status = '<br><span class="text-red">BOGUS</span>';
dnssecStatus = '<br><span class="text-red">BOGUS</span>';
break;
case "4":
dnssec_status = '<br><span class="text-red">ABANDONED</span>';
dnssecStatus = '<br><span class="text-red">ABANDONED</span>';
break;
case "5":
dnssec_status = '<br><span class="text-orange">UNKNOWN</span>';
dnssecStatus = '<br><span class="text-orange">UNKNOWN</span>';
break;
default:
// No DNSSEC
dnssec_status = "";
dnssecStatus = "";
}
// Query status
@@ -178,14 +178,14 @@ $(document).ready(function () {
case "2":
blocked = false;
colorClass = "text-green";
fieldtext = "OK <br class='hidden-lg'>(forwarded)" + dnssec_status;
fieldtext = "OK <br class='hidden-lg'>(forwarded)" + dnssecStatus;
buttontext =
'<button type="button" class="btn btn-default btn-sm text-red"><i class="fa fa-ban"></i> Blacklist</button>';
break;
case "3":
blocked = false;
colorClass = "text-green";
fieldtext = "OK <br class='hidden-lg'>(cached)" + dnssec_status;
fieldtext = "OK <br class='hidden-lg'>(cached)" + dnssecStatus;
buttontext =
'<button type="button" class="btn btn-default btn-sm text-red"><i class="fa fa-ban"></i> Blacklist</button>';
break;
@@ -281,9 +281,9 @@ $(document).ready(function () {
);
$("td:eq(4)", row).off(); // Release any possible previous onClick event handlers
$("td:eq(4)", row).click(function () {
var new_tab = window.open("groups-domains.php?domainid=" + data[9], "_blank");
if (new_tab) {
new_tab.focus();
var newTab = window.open("groups-domains.php?domainid=" + data[9], "_blank");
if (newTab) {
newTab.focus();
}
});
$("td:eq(4)", row).addClass("text-underline pointer");
@@ -296,9 +296,9 @@ $(document).ready(function () {
}
if (isCNAME) {
var CNAME_domain = data[8];
var CNAMEDomain = data[8];
// Add domain in CNAME chain causing the query to have been blocked
$("td:eq(2)", row).text(domain + "\n(blocked " + CNAME_domain + ")");
$("td:eq(2)", row).text(domain + "\n(blocked " + CNAMEDomain + ")");
} else {
$("td:eq(2)", row).text(domain);
}
@@ -519,10 +519,10 @@ $(document).ready(function () {
input.setAttribute("autocapitalize", "off");
input.setAttribute("spellcheck", false);
var chkbox_data = localStorage.getItem("query_log_filter_chkbox");
if (chkbox_data !== null) {
var chkboxData = localStorage.getItem("query_log_filter_chkbox");
if (chkboxData !== null) {
// Restore checkbox state
$("#autofilter").prop("checked", chkbox_data === "true");
$("#autofilter").prop("checked", chkboxData === "true");
} else {
// Initialize checkbox
$("#autofilter").prop("checked", true);