-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
218 lines (175 loc) · 8.36 KB
/
main.js
File metadata and controls
218 lines (175 loc) · 8.36 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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
// Snowflake Animation System
function createSnowflakes() {
const container = document.getElementById('snowflakes-container');
const snowflakeCount = 50; // Number of snowflakes
for (let i = 0; i < snowflakeCount; i++) {
const snowflake = document.createElement('div');
snowflake.classList.add('snowflake');
// Random size between 2px and 8px
const size = Math.random() * 6 + 2;
snowflake.style.width = `${size}px`;
snowflake.style.height = `${size}px`;
// Random starting position
snowflake.style.left = `${Math.random() * 100}%`;
snowflake.style.top = `${Math.random() * 100}%`;
// Random opacity
snowflake.style.opacity = Math.random() * 0.7 + 0.3;
// Random animation duration and delay
const duration = Math.random() * 10 + 10; // 10-20 seconds
const delay = Math.random() * 5; // 0-5 seconds delay
// Apply animations
snowflake.style.animation =
`snowfall ${duration}s linear ${delay}s infinite,
sway ${Math.random() * 3 + 2}s ease-in-out ${delay}s infinite alternate`;
container.appendChild(snowflake);
}
}
// Remove snowflakes when theme changes to light (optional)
function updateSnowflakesTheme() {
const snowflakes = document.querySelectorAll('.snowflake');
const isLightTheme = document.documentElement.getAttribute('data-theme') === 'light';
snowflakes.forEach(snowflake => {
if (isLightTheme) {
snowflake.style.boxShadow = '0 0 8px rgba(33, 150, 243, 0.3)';
} else {
snowflake.style.boxShadow = '0 0 10px rgba(255, 255, 255, 0.5)';
}
});
}
// Initialize snowflakes
document.addEventListener('DOMContentLoaded', () => {
createSnowflakes();
});
const themeToggle = document.getElementById('themeToggle');
const htmlElement = document.documentElement;
const savedTheme = localStorage.getItem('theme') || 'dark';
htmlElement.setAttribute('data-theme', savedTheme);
themeToggle.addEventListener('click', () => {
const currentTheme = htmlElement.getAttribute('data-theme');
const newTheme = currentTheme === 'light' ? 'dark' : 'light';
htmlElement.setAttribute('data-theme', newTheme);
localStorage.setItem('theme', newTheme);
// Update snowflake theme
setTimeout(updateSnowflakesTheme, 100);
});
// Scroll animations
const observerOptions = {
threshold: 0.1,
rootMargin: '0px 0px -50px 0px'
};
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('visible');
}
});
}, observerOptions);
document.querySelectorAll('.animate-on-scroll').forEach(el => {
observer.observe(el);
});
// Header scroll effect
const header = document.getElementById('header');
window.addEventListener('scroll', () => {
if (window.scrollY > 50) {
header.classList.add('scrolled');
} else {
header.classList.remove('scrolled');
}
});
// Navigation active state
const navLinks = document.querySelectorAll('.nav-link');
function setActiveNavLink() {
const sections = document.querySelectorAll('section');
let currentSection = '';
sections.forEach(section => {
const sectionTop = section.offsetTop - 100;
const sectionHeight = section.clientHeight;
if (window.scrollY >= sectionTop && window.scrollY < sectionTop + sectionHeight) {
currentSection = section.getAttribute('id');
}
});
navLinks.forEach(link => {
link.classList.remove('active');
if (link.getAttribute('href') === `#${currentSection}`) {
link.classList.add('active');
}
});
}
window.addEventListener('scroll', setActiveNavLink);
// Smooth scrolling for anchor links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
if (this.getAttribute('href') === '#') return;
const targetId = this.getAttribute('href');
const targetElement = document.querySelector(targetId);
if (targetElement) {
e.preventDefault();
window.scrollTo({
top: targetElement.offsetTop - 80,
behavior: 'smooth'
});
// Update URL without jumping
history.pushState(null, null, targetId);
}
});
});
// FAQ Accordion
document.querySelectorAll('.faq-question').forEach(question => {
question.addEventListener('click', () => {
const item = question.parentElement;
const isActive = item.classList.contains('active');
// Close all other items
document.querySelectorAll('.faq-item').forEach(otherItem => {
otherItem.classList.remove('active');
});
// Toggle current item
if (!isActive) {
item.classList.add('active');
}
});
});
// Tawk.to Live Chat Functions
function openChat() {
if (typeof Tawk_API !== 'undefined') {
Tawk_API.maximize();
} else {
window.open('https://t.me/FlashKiss_1337', '_blank');
}
}
// Telegram Purchase Function
function buyPlan(planName, price, duration) {
const telegramUsername = '@FlashKiss_1337';
const message = `Hello! I want to purchase PlusParser subscription.
Plan: ${planName}
Price: $${price}
Duration: ${duration}
Please provide payment details.`;
const encodedMessage = encodeURIComponent(message);
const telegramUrl = `https://t.me/${telegramUsername.replace('@', '')}?text=${encodedMessage}`;
// Open Telegram with pre-filled message
window.open(telegramUrl, '_blank');
// Show confirmation message
alert(`Opening Telegram to contact ${telegramUsername}\n\nYou will send this message:\n\n${message}`);
}
// Initialize
document.addEventListener('DOMContentLoaded', () => {
setActiveNavLink();
// Add hover effects to cards
document.querySelectorAll('.feature-card, .pricing-card, .blog-card, .why-item').forEach(card => {
card.addEventListener('mouseenter', function() {
this.style.transition = 'all 0.3s cubic-bezier(0.4, 0, 0.2, 1)';
});
});
// Preload animations
setTimeout(() => {
document.querySelectorAll('.animate-on-scroll').forEach(el => {
if (el.getBoundingClientRect().top < window.innerHeight) {
el.classList.add('visible');
}
});
}, 100);
});
// DMCA Script
const dmcaScript = document.createElement('script');
dmcaScript.src = 'https://images.dmca.com/Badges/DMCABadgeHelper.min.js';
document.body.appendChild(dmcaScript);