diff options
author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-04-09 16:01:32 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-04-09 16:01:32 -0400 |
commit | 07d07c79e00906f826cb6d3e7532f4a2ad2099ba (patch) | |
tree | 1b7c657d0f2f5b99217eeab17dda97d35decd9cf /src/SMAPI.Web/wwwroot/Content/js | |
parent | 26d29a1070e00b4edeaf3334d4c4d072d52a56ff (diff) | |
download | SMAPI-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.js | 8 |
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; |