-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
244 lines (205 loc) · 8.32 KB
/
script.js
File metadata and controls
244 lines (205 loc) · 8.32 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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
// Visitor Counter
let visitorCount = localStorage.getItem('visitorCount') || 156234;
document.querySelector('.visitor-count').textContent = `Visitors: ${visitorCount}`;
localStorage.setItem('visitorCount', parseInt(visitorCount) + 1);
// Online Users Counter (Random fluctuation)
function updateOnlineUsers() {
const baseCount = 42;
const randomFluctuation = Math.floor(Math.random() * 10) - 5;
document.getElementById('onlineCount').textContent = baseCount + randomFluctuation;
}
setInterval(updateOnlineUsers, 5000);
// Download Button Animation and Functionality
document.querySelectorAll('.download-btn').forEach(button => {
button.addEventListener('click', function(e) {
e.preventDefault();
const downloadUrl = this.getAttribute('data-download-url');
// Create a temporary link element
const link = document.createElement('a');
link.href = downloadUrl;
link.download = 'rickroll.jpg'; // Specify the name for the downloaded file
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
this.classList.add('downloading');
this.textContent = 'DOWNLOADING...';
setTimeout(() => {
this.textContent = 'DOWNLOADED!';
setTimeout(() => {
this.textContent = 'DOWNLOAD';
this.classList.remove('downloading');
}, 2000);
}, 3000);
});
});
// Search Functionality
const searchInput = document.querySelector('.search-input');
const cheatEntries = document.querySelectorAll('.cheat-entry');
searchInput.addEventListener('input', function(e) {
const searchTerm = e.target.value.toLowerCase();
cheatEntries.forEach(entry => {
const gameTitle = entry.querySelector('.game-title').textContent.toLowerCase();
const cheatCode = entry.querySelector('.cheat-code').textContent.toLowerCase();
const cheatEffect = entry.querySelector('.cheat-effect').textContent.toLowerCase();
if (gameTitle.includes(searchTerm) ||
cheatCode.includes(searchTerm) ||
cheatEffect.includes(searchTerm)) {
entry.style.display = 'block';
} else {
entry.style.display = 'none';
}
});
});
// Matrix Rain Effect
function createMatrixRain() {
const canvas = document.createElement('canvas');
canvas.style.position = 'fixed';
canvas.style.top = '0';
canvas.style.left = '0';
canvas.style.zIndex = '-1';
canvas.style.opacity = '0.1';
document.body.appendChild(canvas);
const ctx = canvas.getContext('2d');
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
const matrix = "ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789@#$%^&*()*&^%";
const drops = [];
const fontSize = 10;
const columns = canvas.width / fontSize;
for(let i = 0; i < columns; i++) {
drops[i] = 1;
}
function draw() {
ctx.fillStyle = 'rgba(0, 0, 0, .05)';
ctx.fillRect(0, 0, canvas.width, canvas.height);
ctx.fillStyle = '#0F0';
ctx.font = fontSize + 'px monospace';
for(let i = 0; i < drops.length; i++) {
const text = matrix[Math.floor(Math.random() * matrix.length)];
ctx.fillText(text, i * fontSize, drops[i] * fontSize);
if(drops[i] * fontSize > canvas.height && Math.random() > .95) {
drops[i] = 0;
}
drops[i]++;
}
}
setInterval(draw, 35);
}
// Dial-up Sound Effect (Optional)
function playDialupSound() {
const audio = new Audio('dialup.mp3');
audio.volume = 0.2;
const playButton = document.createElement('button');
playButton.textContent = '🔊 Connect';
playButton.className = 'dial-up-button';
playButton.onclick = () => audio.play();
document.body.appendChild(playButton);
}
// Initialize Everything
document.addEventListener('DOMContentLoaded', function() {
addConstructionGifs();
createMatrixRain();
updateOnlineUsers();
// playDialupSound(); // Uncomment if you want the dial-up sound
});
// Add "Best Viewed in Netscape" Counter
const browserNote = document.querySelector('.browser-note');
let noteVisible = true;
setInterval(() => {
noteVisible = !noteVisible;
browserNote.style.visibility = noteVisible ? 'visible' : 'hidden';
}, 1000);
// Add random glitch effect to titles
const glitchTexts = document.querySelectorAll('.glitch');
setInterval(() => {
glitchTexts.forEach(text => {
if(Math.random() > 0.95) {
text.style.transform = `translate(${Math.random()*4-2}px, ${Math.random()*4-2}px)`;
setTimeout(() => {
text.style.transform = 'translate(0, 0)';
}, 100);
}
});
}, 50);
// Smooth scrolling for navigation
document.querySelectorAll('.main-nav a').forEach(anchor => {
anchor.addEventListener('click', function(e) {
e.preventDefault();
const targetId = this.getAttribute('href');
const targetSection = document.querySelector(targetId);
if (targetSection) {
// Add offset for fixed header if needed
const offset = 80; // Adjust this value based on your header height
const targetPosition = targetSection.offsetTop - offset;
window.scrollTo({
top: targetPosition,
behavior: 'smooth'
});
}
});
});
// Add active state to navigation buttons
window.addEventListener('scroll', function() {
const sections = document.querySelectorAll('section, header');
const navButtons = document.querySelectorAll('.main-nav a');
let currentSection = '';
sections.forEach(section => {
const sectionTop = section.offsetTop;
const sectionHeight = section.clientHeight;
if (pageYOffset >= sectionTop - 150 && pageYOffset < sectionTop + sectionHeight) {
currentSection = section.getAttribute('id');
}
});
navButtons.forEach(button => {
button.classList.remove('active');
if (button.getAttribute('href') === `#${currentSection}`) {
button.classList.add('active');
}
});
});
// Motivational Quotes
const quotes = [
"Believe in yourself and all that you are.",
"The only way to do great work is to love what you do.",
"Success is not the key to happiness. Happiness is the key to success.",
"Your limitation—it's only your imagination.",
"Push yourself, because no one else is going to do it for you.",
"Great things never come from comfort zones.",
"Dream it. Wish it. Do it.",
"Success doesn’t just find you. You have to go out and get it.",
"The harder you work for something, the greater you’ll feel when you achieve it.",
"Dream bigger. Do bigger."
];
// Function to change the quote
function changeQuote() {
const quoteElement = document.querySelector('.motivational-quote');
const randomIndex = Math.floor(Math.random() * quotes.length);
quoteElement.textContent = quotes[randomIndex];
}
// Initialize the quote change
setInterval(changeQuote, 5000); // Change quote every 5 seconds
document.addEventListener('DOMContentLoaded', changeQuote); // Change quote on page load
// Make navigation sticky
const nav = document.querySelector('.main-nav');
const navTop = nav.offsetTop;
function stickyNavigation() {
if (window.scrollY >= navTop) {
document.body.style.paddingTop = nav.offsetHeight + 'px';
nav.classList.add('sticky');
} else {
document.body.style.paddingTop = 0;
nav.classList.remove('sticky');
}
}
window.addEventListener('scroll', stickyNavigation);
// Clipboard functionality for copying cheats
document.querySelectorAll('.copy-btn').forEach(button => {
button.addEventListener('click', function() {
const cheatCode = this.getAttribute('data-clipboard-text');
navigator.clipboard.writeText(cheatCode).then(() => {
alert('Cheat copied to clipboard: ' + cheatCode);
}).catch(err => {
console.error('Failed to copy: ', err);
});
});
});