Skip to content

Commit 4868a68

Browse files
authored
Add files via upload
1 parent 7847100 commit 4868a68

1 file changed

Lines changed: 51 additions & 2 deletions

File tree

‎misc.html‎

Lines changed: 51 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,17 @@
1818
img-src 'self' data:;
1919
">
2020
<style>
21+
22+
.header-cursor {
23+
color: var(--accent);
24+
margin-left: 4px;
25+
animation: opacityBlink 1s step-end infinite;
26+
}
27+
@keyframes opacityBlink {
28+
0%, 100% { opacity: 1; }
29+
50% { opacity: 0; }
30+
}
31+
2132
.typing-section-wrapper { max-width: 1000px; margin: 0 auto; width: 90%; }
2233

2334
.dashboard-wrapper {
@@ -217,7 +228,9 @@
217228
<h2 class="section-title hacker-text" data-value="> misc">&gt; misc</h2>
218229

219230
<div style="margin-bottom: 3rem;">
220-
<h3 style="color: var(--text-primary); margin-bottom: 0.5rem; font-size: 1.8rem;">Can You Type Faster Than Me?</h3>
231+
<h3 style="color: var(--text-primary); margin-bottom: 0.5rem; font-size: 1.8rem; display: flex; align-items: center;">
232+
<span id="animated-header-text"></span><span class="header-cursor">_</span>
233+
</h3>
221234
<p style="color: var(--text-secondary); line-height: 1.6;">
222235
My best recorded pace so far is <strong id="daniel-score-text" style="color: #ffd700;">... WPM</strong><span id="daniel-date-text" style="opacity: 0.7; font-size: 0.9em;"></span>.
223236
Beat my score to forever earn a spot on my digital Hall of Fame. <br><br>Note: High scores are published to the performance graph below.
@@ -787,11 +800,47 @@ <h2 class="malware-title">Are You Still Browsing?</h2>
787800
performanceChart.update();
788801
}
789802

803+
async function typeHeaderTypoEffect() {
804+
const textSpan = document.getElementById('animated-header-text');
805+
if (!textSpan) return;
806+
807+
const part1 = "Can Yo Type Fster THan";
808+
const deletes = 16; // Deletes "ster THan"
809+
const part2 = "u Type Faster Than Me?";
810+
811+
// 1. Type the mistake out normally
812+
for (let i = 0; i < part1.length; i++) {
813+
textSpan.textContent += part1[i];
814+
// Random delay between 40ms and 90ms for realistic human pacing
815+
await new Promise(r => setTimeout(r, Math.random() * 50 + 40));
816+
}
817+
818+
// 2. Pause (The "Wait, I messed up" realization)
819+
await new Promise(r => setTimeout(r, 600));
820+
821+
// 3. Mash the backspace key
822+
for (let i = 0; i < deletes; i++) {
823+
textSpan.textContent = textSpan.textContent.slice(0, -1);
824+
// Fast backspace speed
825+
await new Promise(r => setTimeout(r, 30));
826+
}
827+
828+
// 4. Slight pause before correcting
829+
await new Promise(r => setTimeout(r, 300));
830+
831+
// 5. Type the correct ending
832+
for (let i = 0; i < part2.length; i++) {
833+
textSpan.textContent += part2[i];
834+
await new Promise(r => setTimeout(r, Math.random() * 50 + 40));
835+
}
836+
}
837+
790838
restartBtn.addEventListener('click', initTest);
791839
window.onload = async () => {
792840
await fetchDanielScore();
793841
initTest();
794842
initChart();
843+
typeHeaderTypoEffect();
795844
};
796845
</script>
797846
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/gsap.min.js"></script>
@@ -954,7 +1003,7 @@ <h2 class="malware-title">Are You Still Browsing?</h2>
9541003
}, 30);
9551004
};
9561005
});
957-
1006+
9581007
</script>
9591008
</body>
9601009
</html>

0 commit comments

Comments
 (0)