Repository navigation
Expand file tree
/
Copy pathscript.js
More file actions
176 lines (148 loc) Β· 5.49 KB
/
Copy pathscript.js
File metadata and controls
176 lines (148 loc) Β· 5.49 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
// Wait for DOM to be fully loaded
document.addEventListener('DOMContentLoaded', function() {
// Initialize all features
initFunFacts();
initSocialLinks();
initProgressAnimation();
initAccessibility();
console.log('π iamshihab.dev - Coming Soon page loaded!');
});
// Fun facts interaction
function initFunFacts() {
const funFacts = document.querySelectorAll('.fun-fact');
funFacts.forEach((fact, index) => {
// Add staggered animation delay
fact.style.animationDelay = `${0.8 + (index * 0.1)}s`;
// Add click interaction
fact.addEventListener('click', function() {
this.style.transform = 'scale(1.05)';
setTimeout(() => {
this.style.transform = '';
}, 200);
});
// Add hover sound effect (visual only)
fact.addEventListener('mouseenter', function() {
this.style.animation = 'pulse 0.3s ease-in-out';
});
fact.addEventListener('animationend', function() {
this.style.animation = '';
});
});
}
// Social links enhancement
function initSocialLinks() {
const socialLinks = document.querySelectorAll('.social-link');
socialLinks.forEach(link => {
link.addEventListener('click', function(e) {
// Add click feedback
this.style.transform = 'scale(0.95)';
setTimeout(() => {
this.style.transform = '';
}, 150);
// Track outbound links (if analytics is added later)
trackOutboundLink(this.href);
});
// Add keyboard navigation
link.addEventListener('keydown', function(e) {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault();
this.click();
}
});
});
}
// Progress animation enhancement
function initProgressAnimation() {
const progressFill = document.querySelector('.progress-fill');
const progressText = document.querySelector('.progress-text');
if (progressFill && progressText) {
const messages = [
'Loading awesome content...',
'Compiling dad jokes...',
'Brewing coffee...',
'Debugging life...',
'Almost there...',
'Just a few more bugs to fix...',
'Convincing my code to work...',
'Bribing the internet gods...',
'Teaching Python to behave...',
'Negotiating with Java...',
'Drawing architecture diagrams...',
'Explaining microservices to stakeholders...',
'Blaming the previous developer (me)...',
'Googling "why is my code not working"...',
'Convincing stakeholders that "it works on my machine"...',
'Explaining why the bug is actually a feature...',
'Trying to remember what I was supposed to do...',
'Pretending to understand the requirements...',
'Adding more comments to hide the complexity...',
'Optimizing the optimization function...'
];
let messageIndex = 0;
// Change progress message every 3 seconds
setInterval(() => {
progressText.textContent = messages[messageIndex];
messageIndex = (messageIndex + 1) % messages.length;
}, 3000);
}
}
// Accessibility enhancements
function initAccessibility() {
// Add main content ID
const main = document.querySelector('main');
if (main) {
main.id = 'main';
}
// Add ARIA labels
const socialLinks = document.querySelectorAll('.social-link');
socialLinks.forEach(link => {
const text = link.querySelector('.social-text').textContent;
link.setAttribute('aria-label', `Visit ${text} profile`);
});
}
// Utility function for tracking outbound links
function trackOutboundLink(url) {
// This can be enhanced with actual analytics later
console.log('π Outbound link clicked:', url);
}
// Add animations
const style = document.createElement('style');
style.textContent = `
@keyframes pulse {
0% { transform: scale(1); }
50% { transform: scale(1.02); }
100% { transform: scale(1); }
}
`;
document.head.appendChild(style);
// Performance monitoring
window.addEventListener('load', function() {
// Log performance metrics
if ('performance' in window) {
const perfData = performance.getEntriesByType('navigation')[0];
console.log('β‘ Page load time:', Math.round(perfData.loadEventEnd - perfData.loadEventStart), 'ms');
}
// Add loading complete class
document.body.classList.add('loaded');
});
// Service Worker registration (for future PWA features)
if ('serviceWorker' in navigator) {
window.addEventListener('load', function() {
navigator.serviceWorker.register('/sw.js')
.then(function(registration) {
console.log('π§ Service Worker registered:', registration.scope);
})
.catch(function(error) {
console.log('π§ Service Worker registration failed:', error);
});
});
}
// Add some fun console messages
console.log(`
π¨ Welcome to iamshihab.dev!
π This is a coming soon page for Shihab Rahman.
π― The page is fully responsive and accessible.
π± Works great on all devices!
π If you're reading this, you're probably a developer too!
π€ Remember: The best code is the code that works
`);