Work on settings #655 🔃
This commit is contained in:
@@ -563,6 +563,22 @@ function debugTimer () {
|
|||||||
$('#pageTitle').html (new Date().getSeconds());
|
$('#pageTitle').html (new Date().getSeconds());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// -----------------------------------------------------------------------------
|
||||||
|
function secondsSincePageLoad() {
|
||||||
|
// Get the current time
|
||||||
|
var currentTime = Date.now();
|
||||||
|
|
||||||
|
// Get the time when the page was loaded
|
||||||
|
var pageLoadTime = performance.timeOrigin;
|
||||||
|
|
||||||
|
// Calculate the difference in milliseconds
|
||||||
|
var timeDifference = currentTime - pageLoadTime;
|
||||||
|
|
||||||
|
// Convert milliseconds to seconds
|
||||||
|
var secondsAgo = Math.floor(timeDifference / 1000);
|
||||||
|
|
||||||
|
return secondsAgo;
|
||||||
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// Open url in new tab
|
// Open url in new tab
|
||||||
|
|||||||
@@ -813,27 +813,34 @@ while ($row = $result -> fetchArray (SQLITE3_ASSOC)) {
|
|||||||
|
|
||||||
fileModificationTime = <?php echo filemtime($confPath)*1000;?>;
|
fileModificationTime = <?php echo filemtime($confPath)*1000;?>;
|
||||||
|
|
||||||
console.log(appState["settingsImported"]*1000)
|
// console.log(appState["settingsImported"]*1000)
|
||||||
importedMiliseconds = parseInt((appState["settingsImported"]*1000));
|
importedMiliseconds = parseInt((appState["settingsImported"]*1000));
|
||||||
|
|
||||||
humanReadable = (new Date(importedMiliseconds)).toLocaleString("en-UK", { timeZone: "<?php echo $timeZone?>" });
|
humanReadable = (new Date(importedMiliseconds)).toLocaleString("en-UK", { timeZone: "<?php echo $timeZone?>" });
|
||||||
|
|
||||||
console.log(humanReadable.replaceAll('"', ''))
|
// console.log(humanReadable.replaceAll('"', ''))
|
||||||
|
|
||||||
// check if displayed settings are outdated
|
// check if displayed settings are outdated
|
||||||
// if(fileModificationTime > importedMiliseconds)
|
|
||||||
if(appState["showSpinner"] || fileModificationTime > importedMiliseconds)
|
if(appState["showSpinner"] || fileModificationTime > importedMiliseconds)
|
||||||
{
|
{
|
||||||
|
|
||||||
showSpinner("settings_old")
|
showSpinner("settings_old")
|
||||||
|
|
||||||
setTimeout("handleLoadingDialog()", 1000);
|
setTimeout("handleLoadingDialog()", 1000);
|
||||||
|
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
// chekc if the app is initialized and hide the spinner
|
// check if the app is initialized and hide the spinner
|
||||||
if(isAppInitialized())
|
if(isAppInitialized())
|
||||||
{
|
{
|
||||||
hideSpinner()
|
hideSpinner()
|
||||||
|
|
||||||
|
// reload page if outdated information might be displayed
|
||||||
|
if(secondsSincePageLoad() > 3)
|
||||||
|
{
|
||||||
|
clearCache()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user