summaryrefslogtreecommitdiff
path: root/src/SMAPI.Web/wwwroot/Content/js
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-04-09 16:01:32 -0400
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2022-04-09 16:01:32 -0400
commit07d07c79e00906f826cb6d3e7532f4a2ad2099ba (patch)
tree1b7c657d0f2f5b99217eeab17dda97d35decd9cf /src/SMAPI.Web/wwwroot/Content/js
parent26d29a1070e00b4edeaf3334d4c4d072d52a56ff (diff)
downloadSMAPI-07d07c79e00906f826cb6d3e7532f4a2ad2099ba.tar.gz
SMAPI-07d07c79e00906f826cb6d3e7532f4a2ad2099ba.tar.bz2
SMAPI-07d07c79e00906f826cb6d3e7532f4a2ad2099ba.zip
load raw data from JSON per discussion
This avoids loading the data synchronously as a JavaScript snippet, which improves performance when opening the page.
Diffstat (limited to 'src/SMAPI.Web/wwwroot/Content/js')
-rw-r--r--src/SMAPI.Web/wwwroot/Content/js/log-parser.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/SMAPI.Web/wwwroot/Content/js/log-parser.js b/src/SMAPI.Web/wwwroot/Content/js/log-parser.js
index 72cb4a11..5a12a521 100644
--- a/src/SMAPI.Web/wwwroot/Content/js/log-parser.js
+++ b/src/SMAPI.Web/wwwroot/Content/js/log-parser.js
@@ -162,8 +162,14 @@ smapi.logParser = function (state) {
}
}
+ // load raw log data
+ {
+ const dataElement = document.querySelector(state.dataElement);
+ state.data = JSON.parse(dataElement.textContent.trim());
+ }
+
// preprocess data for display
- state.messages = state.data?.messages || [];
+ state.messages = state.data.messages || [];
if (state.messages.length) {
const levels = state.data.logLevels;
const sections = state.data.sections;