Only check the body

This commit is contained in:
bingus_violet 2024-05-31 01:16:50 -05:00
parent 221b63b7cf
commit 52f308e044

View file

@ -48,10 +48,9 @@ function timeFormatter(seconds) {
function converter(html) { function converter(html) {
var startTime = Date.now() var startTime = Date.now()
html = htmlMinifier.minify(html) html = html
var config = JSON.parse(fs.readFileSync(path.join(__dirname, 'config/config.json'))) var config = JSON.parse(fs.readFileSync(path.join(__dirname, 'config/config.json')))
reloads += 1
var statusText = "" var statusText = ""
@ -110,8 +109,10 @@ function converter(html) {
} }
replacers.ALL_KEYWORDS = "{" + Object.keys(replacers).join("}{") + "} " replacers.ALL_KEYWORDS = "{" + Object.keys(replacers).join("}{") + "} "
var bodyHTML = htmlMinifier.minify(html.substring(html.indexOf("<body>") + 6, html.lastIndexOf("</body>")))
var parsedHTML = himalaya.parse(html) var parsedHTML = himalaya.parse(bodyHTML)
function scanParsedHTML(json) { function scanParsedHTML(json) {
for (var i = 0; i < json.length; i++) { for (var i = 0; i < json.length; i++) {
@ -193,7 +194,9 @@ function converter(html) {
parsedHTML = highlighter(parsedHTML) parsedHTML = highlighter(parsedHTML)
html = himalaya.stringify(parsedHTML) parsedHTML = himalaya.stringify(parsedHTML)
html = html.substring(0, html.indexOf("<body>")) + parsedHTML + html.substring(html.indexOf("</body>") + 7)
html = html.replaceAll("{LOAD_TIME}", (Date.now() - startTime).toString() + "ms") html = html.replaceAll("{LOAD_TIME}", (Date.now() - startTime).toString() + "ms")