Fix a bug causing the /weighted-settings page to fail to detect a change in the source JSON file
This commit is contained in:
parent
dd5e5dcda7
commit
d36637ed13
|
@ -3,12 +3,12 @@ window.addEventListener('load', () => {
|
|||
let settingHash = localStorage.getItem('weighted-settings-hash');
|
||||
if (!settingHash) {
|
||||
// If no hash data has been set before, set it now
|
||||
localStorage.setItem('weighted-settings-hash', md5(results));
|
||||
localStorage.setItem('weighted-settings-hash', md5(JSON.stringify(results)));
|
||||
localStorage.removeItem('weighted-settings');
|
||||
settingHash = md5(results);
|
||||
settingHash = md5(JSON.stringify(results));
|
||||
}
|
||||
|
||||
if (settingHash !== md5(results)) {
|
||||
if (settingHash !== md5(JSON.stringify(results))) {
|
||||
const userMessage = document.getElementById('user-message');
|
||||
userMessage.innerText = "Your settings are out of date! Click here to update them! Be aware this will reset " +
|
||||
"them all to default.";
|
||||
|
@ -45,7 +45,7 @@ const resetSettings = () => {
|
|||
|
||||
const fetchSettingData = () => new Promise((resolve, reject) => {
|
||||
fetch(new Request(`${window.location.origin}/static/generated/weighted-settings.json`)).then((response) => {
|
||||
try{ resolve(response.json()); }
|
||||
try{ response.json().then((jsonObj) => resolve(jsonObj)); }
|
||||
catch(error){ reject(error); }
|
||||
});
|
||||
});
|
||||
|
|
|
@ -213,6 +213,7 @@ html{
|
|||
|
||||
#weighted-settings #user-message.visible{
|
||||
display: block;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#weighted-settings h1{
|
||||
|
|
Loading…
Reference in New Issue