mirror of
https://github.com/pi-hole/web.git
synced 2025-12-24 12:48:29 +00:00
@@ -6,9 +6,9 @@
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
/* global utils:false, apiFailure:false */
|
||||
var GETDict = {};
|
||||
let GETDict = {};
|
||||
|
||||
$(function () {
|
||||
$(() => {
|
||||
GETDict = utils.parseQueryString();
|
||||
if (GETDict.domain !== undefined) {
|
||||
$("input[id^='domain']").val(GETDict.domain);
|
||||
@@ -31,23 +31,23 @@ function doSearch() {
|
||||
return;
|
||||
}
|
||||
|
||||
var verb = partial ? "partially" : "exactly";
|
||||
const verb = partial ? "partially" : "exactly";
|
||||
|
||||
$.ajax({
|
||||
method: "GET",
|
||||
url: document.body.dataset.apiurl + "/search/" + encodeURIComponent(q),
|
||||
async: false,
|
||||
data: {
|
||||
partial: partial,
|
||||
N: N,
|
||||
partial,
|
||||
N,
|
||||
},
|
||||
})
|
||||
.done(function (data) {
|
||||
.done(data => {
|
||||
ta.empty();
|
||||
ta.show();
|
||||
|
||||
const res = data.search;
|
||||
var result = "";
|
||||
let result = "";
|
||||
const numDomains = res.domains.length;
|
||||
result =
|
||||
"Found " +
|
||||
@@ -91,7 +91,7 @@ function doSearch() {
|
||||
}
|
||||
|
||||
// Group results in res.gravity by res.gravity[].address
|
||||
var grouped = {};
|
||||
const grouped = {};
|
||||
for (const list of res.gravity) {
|
||||
if (grouped[list.address + "_" + list.type] === undefined) {
|
||||
grouped[list.address + "_" + list.type] = [];
|
||||
@@ -190,13 +190,13 @@ function doSearch() {
|
||||
|
||||
ta.append(result);
|
||||
})
|
||||
.fail(function (data) {
|
||||
.fail(data => {
|
||||
apiFailure(data);
|
||||
});
|
||||
}
|
||||
|
||||
// Handle enter key
|
||||
$("#domain").on("keypress", function (e) {
|
||||
$("#domain").on("keypress", e => {
|
||||
if (e.which === 13) {
|
||||
// Enter was pressed, and the input has focus
|
||||
doSearch();
|
||||
@@ -204,6 +204,6 @@ $("#domain").on("keypress", function (e) {
|
||||
});
|
||||
|
||||
// Handle search buttons
|
||||
$("button[id='btnSearch']").on("click", function () {
|
||||
$("button[id='btnSearch']").on("click", () => {
|
||||
doSearch();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user