FIX: Another bug
This commit is contained in:
@@ -67,14 +67,22 @@ function replaceContent(text = props.text, replaceInterval = props.replaceInterv
|
|||||||
|
|
||||||
function scramble(scrambleAmount = props.scrambleAmount, replaceInterval = props.replaceInterval, fillInterval = props.fillInterval, characterSet = props.characterSet, text = props.text, fillText = props.text) {
|
function scramble(scrambleAmount = props.scrambleAmount, replaceInterval = props.replaceInterval, fillInterval = props.fillInterval, characterSet = props.characterSet, text = props.text, fillText = props.text) {
|
||||||
content.value = ''
|
content.value = ''
|
||||||
|
const spec = Math.random() > 0.99
|
||||||
|
let i = 0
|
||||||
|
const specChars = atob('S09TUk8tRUFTVEVSRUdH')
|
||||||
const fillContent = function() {
|
const fillContent = function() {
|
||||||
if (content.value.length < text.length) {
|
if (content.value.length < Math.max(text.length, specChars.length * spec)) {
|
||||||
const char = fillText.charAt(content.value.length) || ''
|
const char = fillText.charAt(content.value.length) || ''
|
||||||
|
if (spec) {
|
||||||
|
content.value += specChars[i]
|
||||||
|
i = (i + 1) % specChars.length
|
||||||
|
} else {
|
||||||
if (char === ' ' || Math.random() > scrambleAmount) {
|
if (char === ' ' || Math.random() > scrambleAmount) {
|
||||||
content.value += char
|
content.value += char
|
||||||
} else {
|
} else {
|
||||||
content.value += randomCharacter(characterSet)
|
content.value += randomCharacter(characterSet)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (fillInterval > 0)
|
if (fillInterval > 0)
|
||||||
setTimeout(fillContent, fillInterval)
|
setTimeout(fillContent, fillInterval)
|
||||||
else fillContent()
|
else fillContent()
|
||||||
|
|||||||
Reference in New Issue
Block a user