New Update notification only show once a week

This commit is contained in:
Ibnu Maksum 2024-07-05 21:42:43 +07:00
parent 8a33cd9a89
commit 10eb6d1735
No known key found for this signature in database
GPG Key ID: 7FC82848810579E5

View File

@ -385,21 +385,24 @@
var latestVersion = data.version; var latestVersion = data.version;
if (localVersion !== latestVersion) { if (localVersion !== latestVersion) {
$('#version').html('Latest Version: ' + latestVersion); $('#version').html('Latest Version: ' + latestVersion);
Swal.fire({ if(getCookie(latestVersion) != 'done'){
icon: 'info', Swal.fire({
title: "New Version Available\nVersion: "+latestVersion, icon: 'info',
toast: true, title: "New Version Available\nVersion: "+latestVersion,
position: 'bottom-right', toast: true,
showConfirmButton: true, position: 'bottom-right',
showCloseButton: true, showConfirmButton: true,
timer: 30000, showCloseButton: true,
confirmButtonText: '<a href="{$_url}community#latestVersion" style="color: white;">Update Now</a>', timer: 30000,
timerProgressBar: true, confirmButtonText: '<a href="{$_url}community#latestVersion" style="color: white;">Update Now</a>',
didOpen: (toast) => { timerProgressBar: true,
toast.addEventListener('mouseenter', Swal.stopTimer) didOpen: (toast) => {
toast.addEventListener('mouseleave', Swal.resumeTimer) toast.addEventListener('mouseenter', Swal.stopTimer)
} toast.addEventListener('mouseleave', Swal.resumeTimer)
}); }
});
setCookie(latestVersion, 'done', 7);
}
} }
}); });
}); });