Skip to content

Commit

Permalink
Merge pull request #1838 from pi-hole/tweak/trailing-commas-js
Browse files Browse the repository at this point in the history
Prettier improvements for easier reviews
  • Loading branch information
DL6ER authored Jun 23, 2021
2 parents a2c64d6 + 0d0a8db commit ca030bc
Show file tree
Hide file tree
Showing 20 changed files with 192 additions and 192 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"endOfLine": "auto",
"printWidth": 100,
"singleQuote": false,
"trailingComma": "none"
"trailingComma": "es5"
},
"xo": {
"envs": [
Expand Down
4 changes: 2 additions & 2 deletions scripts/pi-hole/js/auditlog.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,14 @@ function add(domain, list) {
list: list,
token: token,
action: list === "audit" ? "add_audit" : "add_domain",
comment: "Added from Audit Log"
comment: "Added from Audit Log",
},
success: function () {
updateTopLists();
},
error: function (jqXHR, exception) {
console.log(exception); // eslint-disable-line no-console
}
},
});
}

Expand Down
14 changes: 7 additions & 7 deletions scripts/pi-hole/js/customcname.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ $(function () {
ajax: {
url: "scripts/pi-hole/php/customcname.php",
data: { action: "get", token: token },
type: "POST"
type: "POST",
},
columns: [{}, {}, { orderable: false, searchable: false }],
columnDefs: [
Expand All @@ -62,12 +62,12 @@ $(function () {
'<span class="far fa-trash-alt"></span>' +
"</button>"
);
}
}
},
},
],
lengthMenu: [
[10, 25, 50, 100, -1],
[10, 25, 50, 100, "All"]
[10, 25, 50, 100, "All"],
],
order: [[0, "asc"]],
stateSave: true,
Expand All @@ -79,7 +79,7 @@ $(function () {
},
drawCallback: function () {
$(".deleteCustomCNAME").on("click", deleteCustomCNAME);
}
},
});
// Disable autocorrect in the search box
var input = document.querySelector("input[type=search]");
Expand Down Expand Up @@ -107,7 +107,7 @@ function addCustomCNAME() {
},
error: function () {
showAlert("error", "Error while adding this custom CNAME record");
}
},
});
}

Expand All @@ -130,6 +130,6 @@ function deleteCustomCNAME() {
error: function (jqXHR, exception) {
showAlert("error", "Error while deleting this custom CNAME record");
console.log(exception); // eslint-disable-line no-console
}
},
});
}
14 changes: 7 additions & 7 deletions scripts/pi-hole/js/customdns.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ $(function () {
ajax: {
url: "scripts/pi-hole/php/customdns.php",
data: { action: "get", token: token },
type: "POST"
type: "POST",
},
columns: [{}, { type: "ip-address" }, { orderable: false, searchable: false }],
columnDefs: [
Expand All @@ -62,12 +62,12 @@ $(function () {
'<span class="far fa-trash-alt"></span>' +
"</button>"
);
}
}
},
},
],
lengthMenu: [
[10, 25, 50, 100, -1],
[10, 25, 50, 100, "All"]
[10, 25, 50, 100, "All"],
],
order: [[0, "asc"]],
stateSave: true,
Expand All @@ -79,7 +79,7 @@ $(function () {
},
drawCallback: function () {
$(".deleteCustomDNS").on("click", deleteCustomDNS);
}
},
});
// Disable autocorrect in the search box
var input = document.querySelector("input[type=search]");
Expand Down Expand Up @@ -107,7 +107,7 @@ function addCustomDNS() {
},
error: function () {
showAlert("error", "Error while adding this custom DNS entry");
}
},
});
}

Expand All @@ -130,6 +130,6 @@ function deleteCustomDNS() {
error: function (jqXHR, exception) {
showAlert("error", "Error while deleting this custom DNS entry");
console.log(exception); // eslint-disable-line no-console
}
},
});
}
42 changes: 21 additions & 21 deletions scripts/pi-hole/js/db_graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,21 @@ $(function () {
Today: [moment().startOf("day"), moment()],
Yesterday: [
moment().subtract(1, "days").startOf("day"),
moment().subtract(1, "days").endOf("day")
moment().subtract(1, "days").endOf("day"),
],
"Last 7 Days": [moment().subtract(6, "days"), moment()],
"Last 30 Days": [moment().subtract(29, "days"), moment()],
"This Month": [moment().startOf("month"), moment()],
"Last Month": [
moment().subtract(1, "month").startOf("month"),
moment().subtract(1, "month").endOf("month")
moment().subtract(1, "month").endOf("month"),
],
"This Year": [moment().startOf("year"), moment()],
"All Time": [moment(0), moment()]
"All Time": [moment(0), moment()],
},
opens: "center",
showDropdowns: true,
autoUpdateInput: false
autoUpdateInput: false,
},
function (startt, endt) {
from = moment(startt).utc().valueOf() / 1000;
Expand Down Expand Up @@ -166,7 +166,7 @@ $(function () {
pointRadius: 1,
pointHoverRadius: 5,
data: [],
pointHitRadius: 5
pointHitRadius: 5,
},
{
label: "Permitted DNS Queries",
Expand All @@ -177,9 +177,9 @@ $(function () {
pointRadius: 1,
pointHoverRadius: 5,
data: [],
pointHitRadius: 5
}
]
pointHitRadius: 5,
},
],
},
options: {
tooltips: {
Expand Down Expand Up @@ -267,11 +267,11 @@ $(function () {
}

return data.datasets[tooltipItems.datasetIndex].label + ": " + tooltipItems.yLabel;
}
}
},
},
},
legend: {
display: false
display: false,
},
scales: {
xAxes: [
Expand All @@ -287,22 +287,22 @@ $(function () {
week: "MMM DD",
month: "MMM",
quarter: "MMM",
year: "YYYY MMM"
}
}
}
year: "YYYY MMM",
},
},
},
],
yAxes: [
{
stacked: true,
ticks: {
beginAtZero: true
}
}
]
beginAtZero: true,
},
},
],
},
maintainAspectRatio: false
}
maintainAspectRatio: false,
},
});
});

Expand Down
8 changes: 4 additions & 4 deletions scripts/pi-hole/js/db_lists.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,21 @@ $(function () {
Today: [moment().startOf("day"), moment()],
Yesterday: [
moment().subtract(1, "days").startOf("day"),
moment().subtract(1, "days").endOf("day")
moment().subtract(1, "days").endOf("day"),
],
"Last 7 Days": [moment().subtract(6, "days"), moment()],
"Last 30 Days": [moment().subtract(29, "days"), moment()],
"This Month": [moment().startOf("month"), moment()],
"Last Month": [
moment().subtract(1, "month").startOf("month"),
moment().subtract(1, "month").endOf("month")
moment().subtract(1, "month").endOf("month"),
],
"This Year": [moment().startOf("year"), moment()],
"All Time": [moment(0), moment()]
"All Time": [moment(0), moment()],
},
opens: "center",
showDropdowns: true,
autoUpdateInput: false
autoUpdateInput: false,
},
function (startt, endt) {
from = moment(startt).utc().valueOf() / 1000;
Expand Down
22 changes: 11 additions & 11 deletions scripts/pi-hole/js/db_queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,21 @@ $(function () {
Today: [moment().startOf("day"), moment()],
Yesterday: [
moment().subtract(1, "days").startOf("day"),
moment().subtract(1, "days").endOf("day")
moment().subtract(1, "days").endOf("day"),
],
"Last 7 Days": [moment().subtract(6, "days"), moment()],
"Last 30 Days": [moment().subtract(29, "days"), moment()],
"This Month": [moment().startOf("month"), moment()],
"Last Month": [
moment().subtract(1, "month").startOf("month"),
moment().subtract(1, "month").endOf("month")
moment().subtract(1, "month").endOf("month"),
],
"This Year": [moment().startOf("year"), moment()],
"All Time": [moment(0), moment()]
"All Time": [moment(0), moment()],
},
opens: "center",
showDropdowns: true,
autoUpdateInput: false
autoUpdateInput: false,
},
function (startt, endt) {
from = moment(startt).utc().valueOf() / 1000;
Expand Down Expand Up @@ -310,7 +310,7 @@ $(function () {
x[0] = x[0] * 1e6 + dataIndex++;
return x;
});
}
},
},
autoWidth: false,
processing: true,
Expand All @@ -327,26 +327,26 @@ $(function () {
}

return data;
}
},
},
{ width: "10%" },
{ width: "40%", render: $.fn.dataTable.render.text() },
{ width: "20%", type: "ip-address", render: $.fn.dataTable.render.text() },
{ width: "10%" },
{ width: "5%" }
{ width: "5%" },
],
lengthMenu: [
[10, 25, 50, 100, -1],
[10, 25, 50, 100, "All"]
[10, 25, 50, 100, "All"],
],
columnDefs: [
{
targets: -1,
data: null,
defaultContent: ""
}
defaultContent: "",
},
],
initComplete: reloadCallback
initComplete: reloadCallback,
});
$("#all-queries tbody").on("click", "button", function () {
var data = tableApi.row($(this).parents("tr")).data();
Expand Down
2 changes: 1 addition & 1 deletion scripts/pi-hole/js/debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function eventsource() {
$.ajax({
method: "GET",
url: "scripts/pi-hole/php/debug.php?IE&token=" + token + "&" + checked,
async: false
async: false,
}).done(function (data) {
ta.show();
ta.empty();
Expand Down
Loading

0 comments on commit ca030bc

Please sign in to comment.