-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
36 lines (31 loc) · 881 Bytes
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
function closeDialog() {
document.getElementById("twex-dialog").classList.add("hidden");
}
function openDialog() {
document.getElementById("twex-dialog").classList.remove("hidden");
}
function remindIn30Mins() {
var now = new Date();
now.setTime(now.getTime() + 30 * 60 * 1000);
document.cookie =
"_twex_snooze=true; expires=" + now.toUTCString() + "; path=/";
closeDialog();
}
function remindTomorrow() {
var now = new Date();
now.setHours(24, 0, 0, 0);
document.cookie =
"_twex_snooze=true; expires=" + now.toUTCString() + "; path=/";
closeDialog();
}
document.getElementById("twex-remind-30").onclick = remindIn30Mins;
document.getElementById("twex-remind-tomorrow").onclick = remindTomorrow;
if (
document.cookie
.split(";")
.some((item) => item.trim().startsWith("_twex_snooze=true"))
) {
closeDialog();
} else {
openDialog();
}