Added elipsis support to I'm a text

This commit is contained in:
2026-02-18 19:35:12 +00:00
parent 1e4ae4b3d3
commit 39967a9ba1

13
main.js
View File

@ -3,13 +3,14 @@ const hellos = ['Hewwo!', 'Hello!', 'Awoo!'];
const imaTypingSpeed = 75; const imaTypingSpeed = 75;
const imaDeletingSpeed = 50; const imaDeletingSpeed = 50;
const imaElipsisDelay = 750;
const imaGapTime = 1500; const imaGapTime = 1500;
const imaTexts = shuffle([ const imaTexts = shuffle([
'I\'m a $dumbass$.dog', 'I\'m a $dumbass$.dog',
'I\'m a $network engineer', 'I\'m a $network engineer',
'I\'m an $Arch Linux user', 'I\'m an $Arch Linux user',
'I\'m a $programmer', 'I\'m a $programmer',
'I\'m a $furry', 'I\'m a $furry...$ duh',
'I\'m a $massive nerd', 'I\'m a $massive nerd',
'I\'m a $Home Assistant addict', 'I\'m a $Home Assistant addict',
'I\'m a $House M.D. enjoyer', 'I\'m a $House M.D. enjoyer',
@ -113,10 +114,18 @@ window.addEventListener('load', (e) => {
} }
imaCharIdx++; imaCharIdx++;
let nextTime = imaTypingSpeed;
if (imaTexts[imaSelection].slice(imaCharIdx, imaCharIdx+3) == '...') {
nextTime = imaElipsisDelay;
}
nextTime *= !controlChar;
if (imaCharIdx >= imaTexts[imaSelection].length) { if (imaCharIdx >= imaTexts[imaSelection].length) {
setTimeout(deleteFunc, imaGapTime); setTimeout(deleteFunc, imaGapTime);
} else { } else {
setTimeout(typeFunc, imaTypingSpeed*!controlChar); setTimeout(typeFunc, nextTime);
} }
}; };