(function(){
const headline = document.getElementById('typing-headline');
const output = document.getElementById('typing-output');
const replayBtn = document.getElementById('replay-btn');
const speedRange = document.getElementById('speed-range');
// āĻāĻাāύে āĻāĻĒāύাāϰ āϞেāĻাāĻুāϞো āĻĻিāύ — āĻĒ্āϰāϤিāĻি āĻāĻāĻেāĻŽ āĻāĻ āĻāĻāĻা āĻĒুāϰো āϞাāĻāύ āĻŦা āĻĒ্āϝাāϰাāĻ্āϰাāĻĢ
const lines = [
"\u098f\u0995\u09a6\u09bf\u09a8 \u0986\u09ae\u09bf \u09aa\u09a6\u09cd\u09ae\u09be \u09a8\u09a6\u09c0\u09b0 \u09aa\u09be\u09dc\u09c7 \u09a8\u09be\u09ae\u09be\u099c \u09aa\u09dc\u099b\u09bf\u09b2\u09be\u09ae\u0964",
"\u098f\u0995\u099f\u09bf \u09ae\u09c7\u09df\u09c7 \u09a6\u09c2\u09b0 \u09a5\u09c7\u0995\u09c7 \u0986\u09ae\u09be\u09b0 \u09a8\u09be\u09ae\u09be\u099c \u09b2\u0995\u09cd\u09b7 \u0995\u09b0\u09b2\u09cb\u0964",
"\u09a4\u09be\u09b0\u09aa\u09b0 \u0986\u09ae\u09be\u09b0 \u09a8\u09bf\u0995\u099f\u09c7 \u099a\u09b2\u09c7 \u098f\u09b2\u09cb\u0964",
"\u09a4\u09be\u09b0\u09aa\u09b0 \u0985\u09aa\u09b2\u0995 \u099a\u09cb\u0996\u09c7 \u0986\u09ae\u09be\u09b0 \u09a8\u09be\u09ae\u09be\u099c \u09aa\u09dc\u09be \u09a6\u09c7\u0996\u09a4\u09bf\u099b\u09bf\u09b2\u09cb\u0964",
"\u09a8\u09be\u09ae\u09be\u099c \u09b6\u09c7\u09b7 \u0995\u09b0\u09c7 \u0986\u09ae\u09bf \u09ae\u09c7\u09df\u09c7\u099f\u09bf\u09b0 \u09a6\u09bf\u0995\u09c7 \u09a4\u09be\u0995\u09be\u09b2\u09be\u09ae\u0964",
"\u09ae\u09c7\u09df\u09c7\u099f\u09bf \u09ac\u09b2\u09b2\u0964 \u0986\u09aa\u09a8\u09bf \u0995\u09bf \u0995\u09b0\u09b2\u09c7\u09a8\u0964",
"\u0986\u09ae\u09bf \u09ac\u09b2\u09b2\u09be\u09ae \u09a8\u09be\u09ae\u09be\u099c \u09aa\u09dc\u09be\u09b2\u09be\u09ae\u0964",
"\u09ae\u09c7\u09df\u09c7\u099f\u09bf \u09ac\u09b2\u09b2\u0964 \u09a8\u09be\u09ae\u09be\u099c\u09c7\u09b0 \u09ae\u09a7\u09cd\u09af\u09c7 \u09b6\u09be\u09b9\u09be\u09a6\u09be\u09a4 \u0986\u0999\u09cd\u0997\u09c1\u09b2 \u0989\u0981\u099a\u09c1 \u0995\u09b0\u09b2\u09c7\u09a8 \u0995\u09c7\u09a8\u0964",
"\u0986\u09ae\u09bf \u09ac\u09b2\u09b2\u09be\u09ae\u0964 \u098f\u099f\u09be \u099c\u09c7\u09a8\u09c7 \u0986\u09aa\u09a8\u09be\u09b0 \u0995\u09cb\u09a8\u09cb \u09b2\u09be\u09ad \u09a8\u09c7\u0987\u0964",
"\u0986\u09aa\u09a8\u09bf \u09a4\u09cb \u09a8\u09be\u09ae\u09be\u099c \u09aa\u09dc\u09c7\u09a8 \u09ac\u09b2\u09c7 \u09ae\u09a8\u09c7 \u09b9\u09df\u09a8\u09be\u0964",
"\u09ae\u09c7\u09df\u09c7\u099f\u09bf \u09a4\u09be\u09b0\u09aa\u09b0 \u0985\u09a8\u09cd\u09af \u0995\u09a5\u09be\u09df \u09ae\u09a8\u09cb\u09af\u09bc\u09c7\u09be\u0997 \u09a6\u09bf\u09b2\u09cb\u0964",
"\u098f\u09a6\u09bf\u0995 \u09b8\u09c7\u09a6\u09bf\u0995\u09c7\u09b0 \u0995\u09bf\u099b\u09c1 \u0995\u09a5\u09be \u09ac\u09b2\u09c7 \u09ac\u09b2\u09b2\u0964",
"\u0986\u09ae\u09bf \u0986\u09b8\u09b2\u09c7 \u098f\u0996\u09a8\u09a8\u0995\u09be\u09b0 \u099a\u09c7\u09df\u09be\u09b0\u09ae\u09cd\u09af\u09be\u09a8 \u09ac\u09be\u09dc\u09bf\u09b0 \u0996\u09cb\u099c\u09c7 \u098f\u09b8\u09c7\u099b\u09bf\u09b2\u09be\u09ae\u0964",
"\u0986\u09aa\u09a8\u09bf \u0995\u09bf \u099a\u09c7\u09df\u09be\u09b0\u09ae\u09cd\u09af\u09be\u09a8 \u09ac\u09be\u09dc\u09bf \u099a\u09bf\u09a8\u09c7\u09a8\u0964",
"\u0986\u09ae\u09bf \u09ac\u09b2\u09b2\u09be\u09ae \u09a8\u09be \u0986\u09ae\u09bf \u099a\u09bf\u09a8\u09bf\u09a8\u09be\u0964",
"\u09a4\u09be\u09b0\u09aa\u09b0 \u09ae\u09c7\u09df\u09c7\u099f\u09bf \u099a\u09b2\u09c7 \u0997\u09c7\u09b2\u09cb\u0964",
];
// cursor āĻāϞিāĻŽেāύ্āĻ (āĻŦ্āϞিংāĻিং)
let cursor;
function makeCursor() {
cursor = document.createElement('span');
cursor.setAttribute('aria-hidden','true');
cursor.style.display = 'inline-block';
cursor.style.marginLeft = '4px';
cursor.style.width = '10px';
cursor.style.animation = 'blink 1s steps(2, start) infinite';
cursor.style.background = 'linear-gradient(180deg,#bfeebf,#7fe0ff)';
cursor.style.height = '1em';
cursor.style.verticalAlign = 'middle';
cursor.style.borderRadius = '2px';
return cursor;
}
// blink keyframes (inject once)
const style = document.createElement('style');
style.textContent = "@keyframes blink{50%{opacity:0}}";
document.head.appendChild(style);
// type one character at a time (returns Promise)
function typeText(targetEl, text, msPerChar) {
return new Promise(resolve => {
let i = 0;
targetEl.textContent = '';
function step() {
if (i <= text.length - 1) {
targetEl.textContent += text.charAt(i);
i++;
setTimeout(step, msPerChar);
} else {
resolve();
}
}
step();
});
}
// main routine: type all lines sequentially
let running = false;
async function runTyping() {
if (running) return;
running = true;
headline.setAttribute('aria-pressed','true');
output.innerHTML = ''; // clear
const cursorEl = makeCursor();
output.appendChild(cursorEl);
for (let idx = 0; idx < lines.length; idx++) {
// create paragraph container for this line
const p = document.createElement('p');
p.style.margin = '0 0 12px 0';
p.style.whiteSpace = 'pre-wrap';
output.insertBefore(p, cursorEl);
const speed = parseInt(speedRange.value,10); // smaller -> faster
const msPerChar = Math.max(6, Math.round(140 - speed)); // map range to ms
await typeText(p, lines[idx], msPerChar);
// āĻোāĻ āĻŦ্āϰেāĻ: āĻĒāϰāĻŦāϰ্āϤী āϞাāĻāύ āĻļুāϰু āĻšāĻā§াāϰ āĻāĻে āĻāĻāĻু āĻŦিāϰāϤি
await new Promise(r => setTimeout(r, 450));
}
// āϏāĻŦ āĻļেāώ āĻšāϞে cursor āĻŦাāύ্āϧাāϰি (āĻŦ্āϞিংāĻ)
if (cursorEl) cursorEl.style.opacity = '0.85';
headline.setAttribute('aria-pressed','false');
running = false;
}
// restart functionality
function restartTyping() {
running = false;
output.innerHTML = '';
runTyping();
}
// Attach events
headline.addEventListener('click', runTyping);
replayBtn.addEventListener('click', restartTyping);
// allow Enter/Space to trigger for keyboard users
headline.addEventListener('keydown', (e) => {
if (e.key === 'Enter' || e.key === ' ') {
e.preventDefault();
runTyping();
}
});
// accessibility: make headline focusable
headline.tabIndex = 0;
})();
About
āĻšৃāĻĻā§েāϰ āĻĒ্āϰāĻļাāύ্āϤি
This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
0 comments:
Post a Comment