-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontentScript.js
66 lines (58 loc) · 1.45 KB
/
contentScript.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
var countdownElement = document.createElement("div");
countdownElement.id = "countdown";
document.body.appendChild(countdownElement);
var countdown = 6;
var countdownInterval = setInterval(function () {
countdown--;
countdownElement.textContent = countdown;
if (countdown === 0) {
clearInterval(countdownInterval);
document.body.removeChild(countdownElement);
restorePageContent();
}
}, 1000);
var overlayElement = document.createElement("div");
overlayElement.id = "overlay";
document.body.appendChild(overlayElement);
// Add styles for the countdown animation and overlay
var styles = `
#countdown {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 48px;
font-weight: bold;
color: #fff;
animation: countdown-animation 1s linear infinite;
z-index: 9999;
}
@keyframes countdown-animation {
0% {
opacity: 1;
}
50% {
opacity: 0.5;
}
100% {
opacity: 1;
}
}
#overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.8);
z-index: 9998;
}
`;
var styleElement = document.createElement("style");
styleElement.textContent = styles;
document.head.appendChild(styleElement);
function restorePageContent() {
countdownElement.style.display = "none";
overlayElement.style.display = "none";
// Add logic to restore the original page content visibility if needed
}