setings improvements/JS rewrite

This commit is contained in:
Jokob-sk
2023-07-25 08:09:04 +10:00
parent cd164793cc
commit 35a0a91a02
2 changed files with 169 additions and 2 deletions

View File

@@ -96,6 +96,28 @@ function deleteAllCookies() {
}
// -----------------------------------------------------------------------------
// Get language string
// -----------------------------------------------------------------------------
function cacheStrings()
{
$.get('api/table_language_strings.json', function(res) {
data = res["data"];
data.forEach((langString) => {
// console.log(langString)
setCache(`pia_lang_${langString.String_Key}`, langString.String_Value, expirationMinutes='1440') // expire in a day
});
})
}
function getString (key) {
return getCache(`pia_lang_${key}`)
}
// -----------------------------------------------------------------------------
// Modal dialog handling
// -----------------------------------------------------------------------------
@@ -369,6 +391,9 @@ function navigateToDeviceWithIp (ip) {
});
}
// initialize
cacheStrings()
console.log("init pialert_common.js")