diff --git a/package.json b/package.json index c9d33791..b77b828a 100644 --- a/package.json +++ b/package.json @@ -23,13 +23,14 @@ "xo": "^0.29.0" }, "prettier": { + "arrowParens": "avoid", "bracketSpacing": true, + "endOfLine": "auto", "printWidth": 100, "singleQuote": false, "trailingComma": "none" }, "xo": { - "space": 2, "envs": [ "browser", "jquery" @@ -40,6 +41,7 @@ }, "esnext": false, "prettier": true, + "space": 2, "ignores": [ "**/vendor/**" ], @@ -56,11 +58,12 @@ "unicorn/filename-case": "off", "unicorn/no-for-loop": "off", "unicorn/no-zero-fractions": "off", - "unicorn/prevent-abbreviations": "off", "unicorn/prefer-includes": "off", "unicorn/prefer-node-append": "off", + "unicorn/prefer-number-properties": "off", "unicorn/prefer-query-selector": "off", "unicorn/prefer-string-slice": "off", + "unicorn/prevent-abbreviations": "off", "unicorn/string-content": "off" } } diff --git a/scripts/pi-hole/js/auditlog.js b/scripts/pi-hole/js/auditlog.js index 3850b5de..05189d6b 100644 --- a/scripts/pi-hole/js/auditlog.js +++ b/scripts/pi-hole/js/auditlog.js @@ -18,24 +18,20 @@ function escapeHtml(text) { "'": "'" }; - return text.replace(/[&<>"']/g, function(m) { + return text.replace(/[&<>"']/g, function (m) { return map[m]; }); } function updateTopLists() { - $.getJSON("api.php?topItems=audit", function(data) { + $.getJSON("api.php?topItems=audit", function (data) { if ("FTLnotrunning" in data) { return; } // Clear tables before filling them with data - $("#domain-frequency td") - .parent() - .remove(); - $("#ad-frequency td") - .parent() - .remove(); + $("#domain-frequency td").parent().remove(); + $("#ad-frequency td").parent().remove(); var domaintable = $("#domain-frequency").find("tbody:last"); var adtable = $("#ad-frequency").find("tbody:last"); var url, domain; @@ -105,10 +101,10 @@ function add(domain, list) { url: "scripts/pi-hole/php/add.php", method: "post", data: { domain: domain, list: list, token: token }, - success: function() { + success: function () { updateTopLists(); }, - error: function(jqXHR, exception) { + error: function (jqXHR, exception) { console.log(exception); } }); @@ -130,14 +126,12 @@ function auditUrl(url) { add(url, "audit"); } -$(document).ready(function() { +$(document).ready(function () { // Pull in data via AJAX updateTopLists(); - $("#domain-frequency tbody").on("click", "button", function() { - var url = $(this) - .parents("tr")[0] - .textContent.split(" ")[0]; + $("#domain-frequency tbody").on("click", "button", function () { + var url = $(this).parents("tr")[0].textContent.split(" ")[0]; if ($(this).context.textContent === " Blacklist") { blacklistUrl(url); } else { @@ -145,10 +139,8 @@ $(document).ready(function() { } }); - $("#ad-frequency tbody").on("click", "button", function() { - var url = $(this) - .parents("tr")[0] - .textContent.split(" ")[0]; + $("#ad-frequency tbody").on("click", "button", function () { + var url = $(this).parents("tr")[0].textContent.split(" ")[0]; if ($(this).context.textContent === " Whitelist") { whitelistUrl(url); } else { diff --git a/scripts/pi-hole/js/customdns.js b/scripts/pi-hole/js/customdns.js index 248eaa58..7f7d2343 100644 --- a/scripts/pi-hole/js/customdns.js +++ b/scripts/pi-hole/js/customdns.js @@ -36,7 +36,7 @@ function showAlert(type, message) { alertElement.delay(8000).fadeOut(2000); } -$(document).ready(function() { +$(document).ready(function () { $("#btnAdd").on("click", addCustomDNS); table = $("#customDNSTable").DataTable({ @@ -45,7 +45,7 @@ $(document).ready(function() { columnDefs: [ { targets: 2, - render: function(data, type, row) { + render: function (data, type, row) { return ( '