mirror of
https://github.com/pi-hole/web.git
synced 2025-12-24 04:38:28 +00:00
@@ -6,9 +6,9 @@
|
||||
* Please see LICENSE file for your rights under this license. */
|
||||
|
||||
function eventsource() {
|
||||
var alInfo = $("#alInfo");
|
||||
var alSuccess = $("#alSuccess");
|
||||
var ta = $("#output");
|
||||
const alInfo = $("#alInfo");
|
||||
const alSuccess = $("#alSuccess");
|
||||
const ta = $("#output");
|
||||
|
||||
ta.html("");
|
||||
ta.show();
|
||||
@@ -37,10 +37,10 @@ function eventsource() {
|
||||
|
||||
// Enqueue the next data chunk into our target stream
|
||||
controller.enqueue(value);
|
||||
var string = new TextDecoder().decode(value);
|
||||
const string = new TextDecoder().decode(value);
|
||||
parseLines(ta, string);
|
||||
|
||||
if (string.indexOf("Done.") !== -1) {
|
||||
if (string.includes("Done.")) {
|
||||
alSuccess.show();
|
||||
}
|
||||
|
||||
@@ -53,13 +53,13 @@ function eventsource() {
|
||||
.catch(error => console.error(error)); // eslint-disable-line no-console
|
||||
}
|
||||
|
||||
$("#gravityBtn").on("click", function () {
|
||||
$("#gravityBtn").on("click", () => {
|
||||
$("#gravityBtn").prop("disabled", true);
|
||||
eventsource();
|
||||
});
|
||||
|
||||
// Handle hiding of alerts
|
||||
$(function () {
|
||||
$(() => {
|
||||
$("[data-hide]").on("click", function () {
|
||||
$(this)
|
||||
.closest("." + $(this).attr("data-hide"))
|
||||
@@ -68,8 +68,8 @@ $(function () {
|
||||
|
||||
// Do we want to start updating immediately?
|
||||
// gravity?go
|
||||
var searchString = globalThis.location.search.substring(1);
|
||||
if (searchString.indexOf("go") !== -1) {
|
||||
const searchString = globalThis.location.search.substring(1);
|
||||
if (searchString.includes("go")) {
|
||||
$("#gravityBtn").prop("disabled", true);
|
||||
eventsource();
|
||||
}
|
||||
@@ -80,7 +80,7 @@ function parseLines(ta, str) {
|
||||
// We want to split the text before an "OVER" escape sequence to allow overwriting previous line when needed
|
||||
|
||||
// Splitting the text on "\r"
|
||||
var lines = str.split(/(?=\r)/g);
|
||||
const lines = str.split(/(?=\r)/g);
|
||||
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
if (lines[i][0] === "\r") {
|
||||
|
||||
Reference in New Issue
Block a user