-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscripts.js
More file actions
319 lines (275 loc) · 10.2 KB
/
scripts.js
File metadata and controls
319 lines (275 loc) · 10.2 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
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
// Email copy function
function Copy() {
// Copy email to clipboard
const email = 'ratthewrobin@gmail.com';
if (navigator.clipboard && navigator.clipboard.writeText) {
navigator.clipboard.writeText(email).then(() => {
showNotification('Email copied!');
}).catch(() => {
// Fallback for older browsers
fallbackCopy(email);
});
} else {
// Fallback for older browsers
fallbackCopy(email);
}
}
// Fallback copy method
function fallbackCopy(text) {
const textArea = document.createElement('textarea');
textArea.value = text;
textArea.style.position = 'fixed';
textArea.style.opacity = '0';
document.body.appendChild(textArea);
textArea.select();
try {
document.execCommand('copy');
showNotification('Email copied!');
} catch (err) {
showNotification('Failed to copy. Email: ' + text);
}
document.body.removeChild(textArea);
}
// Show notification
function showNotification(message) {
// Remove existing notification if any
const existing = document.querySelector('.notification');
if (existing) {
existing.remove();
}
const notification = document.createElement('div');
notification.textContent = message;
notification.classList.add('notification');
document.body.appendChild(notification);
// Remove notification after 2 seconds
setTimeout(() => {
notification.style.animation = 'slideIn 0.3s ease reverse';
setTimeout(() => {
notification.remove();
}, 300);
}, 2000);
}
// Copy Bitcoin address
function copyBTC() {
const btcAddress = 'bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh';
if (navigator.clipboard && navigator.clipboard.writeText) {
navigator.clipboard.writeText(btcAddress).then(() => {
showNotification('Bitcoin address copied!');
}).catch(() => {
fallbackCopy(btcAddress);
});
} else {
fallbackCopy(btcAddress);
}
}
// Add smooth scroll for anchor links
document.addEventListener('DOMContentLoaded', function() {
// Smooth scroll for anchor links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
const href = this.getAttribute('href');
if (href !== '#' && href.length > 1) {
e.preventDefault();
const target = document.querySelector(href);
if (target) {
target.scrollIntoView({
behavior: 'smooth',
block: 'start'
});
}
}
});
});
// Add retro click sound effect (optional - can be removed if not needed)
document.querySelectorAll('.retro-link, .nav-link').forEach(link => {
link.addEventListener('click', function() {
// Visual feedback
this.style.transform = 'scale(0.95)';
setTimeout(() => {
this.style.transform = '';
}, 100);
});
});
// Interactive Canvas
const canvas = document.getElementById('interactiveCanvas');
if (canvas) {
const ctx = canvas.getContext('2d');
let hue = 0;
function draw() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.fillStyle = `hsl(${hue}, 70%, 50%)`;
ctx.fillRect(0, 0, canvas.width, canvas.height);
// Add some pattern
ctx.fillStyle = 'rgba(0, 0, 0, 0.2)';
for (let i = 0; i < 5; i++) {
ctx.fillRect(i * 40, i * 20, 20, 20);
}
}
canvas.addEventListener('click', function(e) {
hue = (hue + 30) % 360;
draw();
});
// Animate on load
draw();
// Subtle animation
setInterval(() => {
hue = (hue + 0.5) % 360;
draw();
}, 100);
}
// Typing Effect
const typingText = document.getElementById('typingText');
if (typingText) {
const text = "Welcome to Matt's Site";
let i = 0;
typingText.textContent = '';
function typeWriter() {
if (i < text.length) {
typingText.textContent += text.charAt(i);
i++;
setTimeout(typeWriter, 100);
} else {
// Start blinking after typing
typingText.classList.add('blink-text');
}
}
setTimeout(typeWriter, 500);
}
// Particle System
const particleCanvas = document.getElementById('particleCanvas');
if (particleCanvas) {
const ctx = particleCanvas.getContext('2d');
particleCanvas.width = window.innerWidth;
particleCanvas.height = window.innerHeight;
const particles = [];
const particleCount = 50;
class Particle {
constructor() {
this.x = Math.random() * particleCanvas.width;
this.y = Math.random() * particleCanvas.height;
this.vx = (Math.random() - 0.5) * 0.5;
this.vy = (Math.random() - 0.5) * 0.5;
this.size = Math.random() * 2 + 1;
}
update() {
this.x += this.vx;
this.y += this.vy;
if (this.x < 0 || this.x > particleCanvas.width) this.vx *= -1;
if (this.y < 0 || this.y > particleCanvas.height) this.vy *= -1;
}
draw() {
ctx.fillStyle = 'rgba(0, 255, 0, 0.3)';
ctx.beginPath();
ctx.arc(this.x, this.y, this.size, 0, Math.PI * 2);
ctx.fill();
}
}
// Create particles
for (let i = 0; i < particleCount; i++) {
particles.push(new Particle());
}
// Draw connections
function drawConnections() {
for (let i = 0; i < particles.length; i++) {
for (let j = i + 1; j < particles.length; j++) {
const dx = particles[i].x - particles[j].x;
const dy = particles[i].y - particles[j].y;
const distance = Math.sqrt(dx * dx + dy * dy);
if (distance < 150) {
ctx.strokeStyle = `rgba(0, 255, 0, ${0.2 * (1 - distance / 150)})`;
ctx.lineWidth = 0.5;
ctx.beginPath();
ctx.moveTo(particles[i].x, particles[i].y);
ctx.lineTo(particles[j].x, particles[j].y);
ctx.stroke();
}
}
}
}
function animate() {
ctx.clearRect(0, 0, particleCanvas.width, particleCanvas.height);
particles.forEach(particle => {
particle.update();
particle.draw();
});
drawConnections();
requestAnimationFrame(animate);
}
animate();
window.addEventListener('resize', () => {
particleCanvas.width = window.innerWidth;
particleCanvas.height = window.innerHeight;
});
}
// Cursor Trail Effect
const cursorTrail = document.getElementById('cursorTrail');
if (cursorTrail) {
let trail = [];
const trailLength = 20;
document.addEventListener('mousemove', (e) => {
trail.push({ x: e.clientX, y: e.clientY, time: Date.now() });
if (trail.length > trailLength) {
trail.shift();
}
updateTrail();
});
function updateTrail() {
cursorTrail.innerHTML = '';
trail.forEach((point, index) => {
const dot = document.createElement('div');
const size = (index / trailLength) * 10 + 2;
const opacity = index / trailLength;
dot.style.cssText = `
position: fixed;
left: ${point.x}px;
top: ${point.y}px;
width: ${size}px;
height: ${size}px;
background: #0f0;
border-radius: 50%;
pointer-events: none;
opacity: ${opacity};
transform: translate(-50%, -50%);
z-index: 9999;
transition: all 0.1s;
`;
cursorTrail.appendChild(dot);
});
}
setInterval(() => {
trail = trail.filter(point => Date.now() - point.time < 200);
updateTrail();
}, 50);
}
// Web API Info
function updateAPIInfo() {
const screenInfo = document.getElementById('screenInfo');
const browserInfo = document.getElementById('browserInfo');
const onlineStatus = document.getElementById('onlineStatus');
const currentTime = document.getElementById('currentTime');
if (screenInfo) {
screenInfo.textContent = `${window.screen.width}x${window.screen.height}`;
}
if (browserInfo) {
const ua = navigator.userAgent;
let browser = 'Unknown';
if (ua.includes('Chrome')) browser = 'Chrome';
else if (ua.includes('Firefox')) browser = 'Firefox';
else if (ua.includes('Safari')) browser = 'Safari';
else if (ua.includes('Edge')) browser = 'Edge';
browserInfo.textContent = browser;
}
if (onlineStatus) {
onlineStatus.textContent = navigator.onLine ? 'Yes' : 'No';
onlineStatus.style.color = navigator.onLine ? '#0f0' : '#f00';
}
if (currentTime) {
const updateTime = () => {
currentTime.textContent = new Date().toLocaleTimeString();
};
updateTime();
setInterval(updateTime, 1000);
}
}
updateAPIInfo();
});