-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathscript.js
More file actions
130 lines (102 loc) · 3.98 KB
/
script.js
File metadata and controls
130 lines (102 loc) · 3.98 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
const section = document.querySelector("section"),
hireBtn = section.querySelector("#hireBtn"),
closeBtn = section.querySelectorAll("#close"),
textArea = section.querySelector("textarea");
hireBtn.addEventListener("click" , () =>{
section.classList.add("show");
});
closeBtn.forEach(cBtn => {
cBtn.addEventListener("click" , ()=>{
section.classList.remove("show");
textArea.value = "";
});
});
const cookiess = document.querySelector(".cookieshow")
const cookiesss = document.querySelector(".buttonn")
const cookiessss = document.querySelector(".button")
cookiess.addEventListener("click" , () =>{
cookieBox.classList.add("show");
});
cookiesss.addEventListener("click" , () =>{
cookieBox.classList.remove("show");
});
cookiessss.addEventListener("click" , () =>{
cookieBox.classList.remove("show");
});
const cookieBox = document.querySelector(".wrapper"),
buttons = document.querySelectorAll(".button");
const executeCodes = () => {
//if cookie contains codinglab it will be returned and below of this code will not run
if (document.cookie.includes("codinglab")) return;
cookieBox.classList.add("show");
buttons.forEach((button) => {
button.addEventListener("click", () => {
cookieBox.classList.remove("show");
//if button has acceptBtn id
if (button.id == "acceptBtn") {
//set cookies for 1 month. 60 = 1 min, 60 = 1 hours, 24 = 1 day, 30 = 30 days
document.cookie = "cookieBy= codinglab; max-age=" + 60 * 60 * 24 * 30;
}
});
});
};
//executeCodes function will be called on webpage load
window.addEventListener("load", executeCodes);
// Confirmation Modal
const shareButton = document.getElementById("shareButton");
const confirmationModal = document.getElementById("confirmationModal");
const closeModal = document.getElementById("closeModal");
const cancelButton = document.getElementById("cancelButton");
shareButton.addEventListener("click", () => {
confirmationModal.classList.add("active");
confirmationModal.classList.add("open");
confirmationModal.style.display = "block";
});
closeModal.addEventListener("click", () => {
confirmationModal.classList.add("slideOut");
setTimeout(() => {
confirmationModal.classList.remove("active", "slideOut");
confirmationModal.style.display = "none";
}, 500); // Wait for the animation to complete (500ms)
});
cancelButton.addEventListener("click", () => {
confirmationModal.classList.add("slideOut");
setTimeout(() => {
confirmationModal.classList.remove("open", "slideOut");
confirmationModal.style.display = "none";
}, 500); // Wait for the animation to complete (300ms)
});
window.addEventListener("click", (event) => {
if (event.target === confirmationModal) {
confirmationModal.classList.remove("open");
setTimeout(() => {
confirmationModal.classList.remove("active");
confirmationModal.style.display = "none";
}, 500); // Wait for the animation to complete (500ms)
}
});
// Subscription Modal
const subscribeButton = document.getElementById("subscribeButton");
const subscriptionModal = document.getElementById("subscriptionModal");
const closeSubscriptionModal = document.getElementById("closeSubscriptionModal");
subscribeButton.addEventListener("click", () => {
subscriptionModal.style.display = "block";
subscriptionModal.classList.add("active");
subscriptionModal.classList.add("open");
});
closeSubscriptionModal.addEventListener("click", () => {
subscriptionModal.classList.add("slideIns");
setTimeout(() => {
subscriptionModal.classList.remove("active", "slideIns");
subscriptionModal.style.display = "none";
}, 500);
});
window.addEventListener("click", (event) => {
if (event.target === subscriptionModal) {
subscriptionModal.classList.remove("open");
setTimeout(() => {
subscriptionModal.classList.remove("active");
subscriptionModal.style.display = "none";
}, 500);
}
});