-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
215 lines (177 loc) · 7.35 KB
/
script.js
File metadata and controls
215 lines (177 loc) · 7.35 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
// Mobile Navigation Toggle
const hamburger = document.getElementById('hamburger');
const navLinks = document.getElementById('navLinks');
hamburger.addEventListener('click', () => {
hamburger.classList.toggle('active');
navLinks.classList.toggle('active');
});
// Close mobile menu when clicking on a link
const navLinkItems = document.querySelectorAll('.nav-links a');
navLinkItems.forEach(link => {
link.addEventListener('click', () => {
hamburger.classList.remove('active');
navLinks.classList.remove('active');
});
});
// Smooth scrolling for anchor links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
const target = document.querySelector(this.getAttribute('href'));
if (target) {
target.scrollIntoView({
behavior: 'smooth',
block: 'start'
});
}
});
});
// Add scroll animation to cards
const observerOptions = {
threshold: 0.1,
rootMargin: '0px 0px -50px 0px'
};
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.style.opacity = '1';
entry.target.style.transform = 'translateY(0)';
}
});
}, observerOptions);
// all content cards
document.querySelectorAll('.content-card, .feature-card, .review-card').forEach(card => {
card.style.opacity = '0';
card.style.transform = 'translateY(30px)';
card.style.transition = 'opacity 0.6s ease, transform 0.6s ease';
observer.observe(card);
});
// Floating elements animation delay
const floatingElements = document.querySelectorAll('.floating-element');
floatingElements.forEach((element, index) => {
element.style.animationDelay = `-${index}s`;
});
const slides = document.querySelectorAll(".slide");
const prevBtn = document.querySelector(".prev");
const nextBtn = document.querySelector(".next");
const dots = document.querySelectorAll(".dot");
let index = 0;
function showSlide(i) {
if (i < 0) index = slides.length - 1;
else if (i >= slides.length) index = 0;
else index = i;
document.querySelector(".slides").style.transform = `translateX(-${index * 100}%)`;
dots.forEach(dot => dot.classList.remove("active"));
dots[index].classList.add("active");
}
prevBtn.addEventListener("click", () => showSlide(index - 1));
nextBtn.addEventListener("click", () => showSlide(index + 1));
dots.forEach((dot, i) => dot.addEventListener("click", () => showSlide(i)));
//timing for how fast the img will change
setInterval(() => {
showSlide(index + 1);
}, 3000);
showSlide(index);
//Contact us sticky button
const contactButton = document.getElementById('contactButton');
const contactMenu = document.getElementById('contactMenu');
const overlay = document.getElementById('overlay');
let isOpen = false;
contactButton.addEventListener('click', function() {
isOpen = !isOpen;
if (isOpen) {
contactButton.classList.add('active');
contactMenu.classList.add('show');
overlay.classList.add('show');
contactButton.innerHTML = '✕';
} else {
closeMenu();
}
});
overlay.addEventListener('click', function() {
if (isOpen) {
closeMenu();
}
});
function closeMenu() {
isOpen = false;
contactButton.classList.remove('active');
contactMenu.classList.remove('show');
overlay.classList.remove('show');
contactButton.innerHTML = 'Contact Us';
}
function handleSocialClick(platform) {
// actual URLs to your social media pages
if (platform === 'discord') {
// Discord server invite link
window.open('https://discord.gg/CzcBvRanMz', '_blank');
} else if (platform === 'reddit') {
// Reddit community link
window.open('https://www.reddit.com/user/KeyDifference4178/', '_blank');
}
// Close the menu after clicking
closeMenu();
}
// Close menu when pressing Escape key
document.addEventListener('keydown', function(e) {
if (e.key === 'Escape' && isOpen) {
closeMenu();
}
});
// Elements
const wisdomButton = document.getElementById('wisdomButton');
const wisdomPopup = document.getElementById('wisdomPopup');
const closeBtn = document.getElementById('closeBtn');
const wisdomText = document.getElementById('wisdomText');
const playButton = document.getElementById('playButton');
const profilePic = document.getElementById('profilePic');
const myAudio = document.getElementById('master-oggways-audio');
const pauseButton = document.getElementById('pauseButton');
const messageNotification = document.getElementById('messageNotification');
// Toggle popup
function togglePopup() {
wisdomPopup.classList.toggle('active');
if (wisdomPopup.classList.contains('active')) {
// Hide the notification when popup opens
messageNotification.classList.add('hidden');
// Show random wisdom
const randomQuote = wisdomQuotes[Math.floor(Math.random() * wisdomQuotes.length)];
wisdomText.textContent = randomQuote;
}
}
// Event listeners
wisdomButton.addEventListener('click', togglePopup);
closeBtn.addEventListener('click', function() {
wisdomPopup.classList.remove('active');
// Don't show notification again after closing
});
// Play button
playButton.addEventListener('click', function() {
console.log('Play button clicked!');
if (myAudio.paused) {
myAudio.play();
} else {
myAudio.currentTime = 0;
myAudio.play();
}
// Visual feedback
playButton.style.transform = 'scale(0.80)';
setTimeout(() => {
playButton.style.transform = 'scale(1)';
}, 150);
});
// Pause button
pauseButton.addEventListener('click', function () {
myAudio.pause();
// Visual feedback
pauseButton.style.transform = 'scale(0.80)';
setTimeout(() => {
pauseButton.style.transform = 'scale(1)';
}, 150);
});
// Close popup when clicking outside
document.addEventListener('click', function(event) {
if (!wisdomPopup.contains(event.target) && !wisdomButton.contains(event.target)) {
wisdomPopup.classList.remove('active');
}
});