1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-05 19:42:38 +02:00
This commit is contained in:
Daniel Neto 2023-09-11 10:54:09 -03:00
parent 7343b9c3b3
commit 8fc17ef501
7 changed files with 42 additions and 4 deletions

View file

@ -1165,7 +1165,7 @@ function avideoAlert(title, msg, type) {
avideoAlertHTMLText(title, msg, type);
}
function avideoAlertOnce(title, msg, type, uid) {
function avideoAlertWithCookie(title, msg, type, uid, expires) {
var cookieName = 'avideoAlertOnce' + uid;
if (!Cookies.get(cookieName)) {
var span = document.createElement("span");
@ -1180,13 +1180,30 @@ function avideoAlertOnce(title, msg, type, uid) {
if (okay) {
Cookies.set(cookieName, 1, {
path: '/',
expires: 365
expires: expires
});
}
});
}
}
function avideoAlertOnce(title, msg, type, uid) {
avideoAlertWithCookie(title, msg, type, uid, 365);
}
function avideoAlertOnceADay(title, msg, type, uid) {
// Calculate time until midnight
var now = new Date();
var midnight = new Date(now);
midnight.setHours(24, 0, 0, 0);
var timeUntilMidnight = (midnight - now) / 1000 / 60 / 60; // time in hours
// Call the main function with the calculated expiration
avideoAlertWithCookie(title, msg, type, uid, timeUntilMidnight / 24); // Convert time from hours to a fraction of a day
}
async function avideoConfirm(msg) {
var span = document.createElement("span");
span.innerHTML = msg;