added ascii funbox

This commit is contained in:
Jack 2020-08-18 17:54:00 +01:00
parent 01eaba1b72
commit 5dd37dd677
3 changed files with 23 additions and 1 deletions

View file

@ -47,6 +47,10 @@
"name": "58008",
"type": "script"
},
{
"name": "ascii",
"type": "script"
},
{
"name": "specials",
"type": "script"

View file

@ -333,3 +333,12 @@ function getSpecials() {
}
return ret;
}
function getASCII() {
let randLen = Math.floor(Math.random() * 10) + 1;
let ret = "";
for (let i = 0; i < randLen; i++) {
ret += String.fromCharCode(33 + Math.floor(Math.random() * 94));
}
return ret;
}

View file

@ -403,6 +403,9 @@ function initWords() {
} else if (activeFunBox === "specials") {
setPunctuation(false);
randomWord = getSpecials();
} else if (activeFunBox === "ascii") {
setPunctuation(false);
randomWord = getASCII();
}
if (config.punctuation && config.mode != "custom") {
@ -605,6 +608,8 @@ function addWord() {
randomWord = getNumbers();
} else if (activeFunBox === "specials") {
randomWord = getSpecials();
} else if (activeFunBox === "ascii") {
randomWord = getASCII();
}
if (config.punctuation && config.mode != "custom") {
@ -2398,7 +2403,11 @@ function changeMode(mode, nosave) {
$("#top .config .customText").addClass("hidden");
$("#top .config .punctuationMode").removeClass("hidden");
} else if (config.mode == "custom") {
if (activeFunBox === "58008" || activeFunBox === "gibberish") {
if (
activeFunBox === "58008" ||
activeFunBox === "gibberish" ||
activeFunBox === "ascii"
) {
activeFunBox = "none";
updateTestModesNotice();
}