Fix the gravity output to use the ${OVER} sequence

Signed-off-by: RD WebDesign <github@rdwebdesign.com.br>
This commit is contained in:
RD WebDesign
2023-10-07 03:07:08 -03:00
parent 549031d204
commit dfb76f509c

View File

@@ -47,9 +47,18 @@ function eventsource() {
// Enqueue the next data chunk into our target stream
controller.enqueue(value);
var string = new TextDecoder().decode(value);
// Remove ${OVER} from the string
string = string.replaceAll("\r", "\n");
ta.append(string);
// If a Carriage Return is found ...
if (string.indexOf("\r") === -1) {
ta.append(string);
} else {
// ... remove the last line from the output ...
ta.text(ta.text().substring(0, ta.text().lastIndexOf("\n")) + "\n");
// ... and append the new text to the end of the output,
// without ${OVER} ("CR + ESC[K") or Carriage Return.
ta.append(string.replaceAll("\r", "").replaceAll("\r", ""));
}
if (string.indexOf("Pi-hole blocking is") !== -1) {
alSuccess.show();
}