From 727fdd5ac683c26addb4d4f23775dc43250005ec Mon Sep 17 00:00:00 2001 From: Bofh Date: Sat, 17 Dec 2022 23:04:31 +0100 Subject: [PATCH] Improve html2text function + Fix css nth-child not numbered correctly --- css/base.php | 2 +- js/base.php | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/css/base.php b/css/base.php index 4ff0f8d..346711d 100644 --- a/css/base.php +++ b/css/base.php @@ -228,7 +228,7 @@ table.fields tr.verified td .fa.fa-check::before { margin-top: .5em; word-break: break-all; } -.item table.fields tr > td:nth-child(1) { +.item table.fields tr > td:nth-child(2) { word-break: break-all; } .item.suspended .card { diff --git a/js/base.php b/js/base.php index e6524c9..7cf17a8 100644 --- a/js/base.php +++ b/js/base.php @@ -137,12 +137,14 @@ function isVisible(element) { } function html2text(html) { - html = html.replaceAll('>', '> '); + html = html.replace(/<\/(p|div|br)\/?>/g, function (m){ return m+' ' }); + html = html.replace(/\s+/g, ' '); var e = document.createElement('div'); e.innerHTML = html; - const result = e.innerText; + var result = e.innerText; + result = result.replace(/\s+/g, ' '); e.remove(); - return result; + return result.trim(); } function JSON_to_URLEncoded(element,key,list) {