Revert "Use timers variable for banner warnings"

This reverts commit 8b8a9d3ea6.
This commit is contained in:
bergware
2021-08-22 23:52:19 +02:00
parent 8b8a9d3ea6
commit 94a149e855

View File

@@ -234,7 +234,7 @@ function escapeQuotes(form) {
var bannerWarnings = [];
var currentBannerWarning = 0;
var timers.bannerWarning = null;
var bannerWarningInterval = null;
var osUpgradeWarning = false;
function addBannerWarning(text,warning=true,noDismiss=false) {
@@ -246,7 +246,11 @@ function addBannerWarning(text,warning=true,noDismiss=false) {
if (!noDismiss) text += "<a class='bannerDismiss' onclick='dismissBannerWarning("+arrayEntry+",&quot;"+cookieText+"&quot;)'></a>";
bannerWarnings[arrayEntry] = text;
} else return bannerWarnings.indexOf(text);
if (timers.bannerWarning==null) showBannerWarnings();
if (!bannerWarningInterval) {
showBannerWarnings();
bannerWarningInterval = setInterval(showBannerWarnings,10000);
}
return arrayEntry;
}
@@ -257,7 +261,6 @@ function dismissBannerWarning(entry,cookieText) {
function removeBannerWarning(entry) {
bannerWarnings[entry] = false;
clearTimeout(timers.bannerWarning);
showBannerWarnings();
}
@@ -273,13 +276,12 @@ function showBannerWarnings() {
var allWarnings = bannerFilterArray(Object.values(bannerWarnings));
if (allWarnings.length == 0) {
$(".upgrade_notice").hide();
timers.bannerWarning = null;
clearInterval(bannerWarningInterval);
return;
}
if (currentBannerWarning >= allWarnings.length) currentBannerWarning = 0;
$(".upgrade_notice").show().html(allWarnings[currentBannerWarning]);
currentBannerWarning++;
timers.bannerWarning = setTimeout(showBannerWarnings,10000);
}
function addRebootNotice(message="<?=_('You must reboot for changes to take effect')?>") {