-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
138 lines (118 loc) · 4.21 KB
/
Copy pathscript.js
File metadata and controls
138 lines (118 loc) · 4.21 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
131
132
133
134
135
136
137
138
function toggleFAQ(element) {
const answer = element.querySelector(".faq-answer");
const icon = element.querySelector("span");
const isOpen = answer.classList.contains("max-h-[200px]");
document.querySelectorAll(".faq-answer").forEach(el => {
el.classList.remove("max-h-[200px]", "opacity-100");
el.classList.add("max-h-0", "opacity-0");
});
document.querySelectorAll(".faq-answer + span").forEach(i => {
i.classList.remove("rotate-45");
});
if (!isOpen) {
answer.classList.remove("max-h-0", "opacity-0");
answer.classList.add("max-h-[200px]", "opacity-100");
icon.classList.add("rotate-45");
} else {
answer.classList.add("max-h-0", "opacity-0");
icon.classList.remove("rotate-45");
}
}
function getQueryParam(param) {
const urlParams = new URLSearchParams(window.location.search);
return urlParams.get(param);
}
document.addEventListener("DOMContentLoaded", function () {
const mode = getQueryParam('mode');
if (mode === 'signup') {
document.getElementById('signin-form').style.display = 'none';
document.getElementById('signup-form').style.display = 'block';
} else {
document.getElementById('signin-form').style.display = 'block';
document.getElementById('signup-form').style.display = 'none';
}
updatePrices(pricingMonthly, '/mo');
if (localStorage.getItem('mode') === 'dark') {
enableDarkMode();
} else {
disableDarkMode();
}
});
const toggle = document.getElementById('pricing-toggle');
const toggleLabel = document.getElementById('toggle-label');
const pricingCards = document.querySelectorAll('.price-card');
const pricingMonthly = [9, 29, 99];
const pricingYearly = [90, 290, 990];
toggle.addEventListener('change', () => {
if (toggle.checked) {
toggleLabel.textContent = 'Yearly';
updatePrices(pricingYearly, '/yr');
} else {
toggleLabel.textContent = 'Monthly';
updatePrices(pricingMonthly, '/mo');
}
});
function updatePrices(prices, period) {
pricingCards.forEach((card, index) => {
const priceElement = card.querySelector('.pmo span');
const periodElement = card.querySelector('.pmo');
priceElement.textContent = `$${prices[index]}`;
periodElement.innerHTML = periodElement.innerHTML.replace(/\/mo|\/yr/, period);
});
}
document.addEventListener("DOMContentLoaded", function () {
const modeToggle = document.getElementById('mode-toggle');
const modeLabel = document.getElementById('mode-label');
const logoImg = document.querySelector('.logo img');
const userIcon = document.getElementById('user-icon');
const tagLine = document.querySelectorAll('.tagline');
const service = document.getElementById('service');
const pricetext = document.getElementById('price-cont');
const faq = document.getElementById('faq-text');
const toggleLabel = document.getElementById('toggle-label');
function enableDarkMode() {
document.body.classList.add('dark-mode');
modeToggle.checked = true;
modeLabel.textContent = 'Dark Mode';
if (logoImg) logoImg.src = 'img/log-dark.png';
if (userIcon) userIcon.src = 'img/user-dark.png';
tagLine.forEach(el => el.style.color = '#fff');
if (service) service.style.color = '#00ABE4';
if (pricetext) pricetext.style.color = '#00ABE4';
if (toggleLabel) toggleLabel.style.color = '#3B82F6';
if (faq) faq.style.color = '#00ABE4';
}
function disableDarkMode() {
document.body.classList.remove('dark-mode');
modeToggle.checked = false;
modeLabel.textContent = 'Light Mode';
if (logoImg) logoImg.src = 'img/logo.png';
if (userIcon) userIcon.src = 'img/user.png';
logoImg.style.height = '120px';
logoImg.style.position = 'absolute';
logoImg.style.top = '10px';
logoImg.style.left = '10px';
}
modeToggle.addEventListener('change', () => {
if (modeToggle.checked) {
enableDarkMode();
} else {
disableDarkMode();
}
});
enableDarkMode();
});
const scrollToTopBtn = document.getElementById('scrollToTopBtn');
window.addEventListener('scroll', () => {
if (window.scrollY > 200) {
scrollToTopBtn.classList.add('show');
} else {
scrollToTopBtn.classList.remove('show');
}
});
scrollToTopBtn.addEventListener('click', () => {
window.scrollTo({
top: 0,
behavior: 'smooth'
});
});