Remove guard on whitspace

We can just trim instead
This commit is contained in:
Zedifus 2022-10-22 19:24:06 +01:00
parent a2a8b6449f
commit f3e41861d2

View File

@ -126,12 +126,12 @@
// Return/Enter key press otherwise bail
if (e.keyCode !== 13) return;
let word = document.getElementById("searchbox").value
let word = document.getElementById("searchbox").value;
document.getElementById("searchbox").value = "";
word = word.toLowerCase();
word = word.replace(/[`'"]/gi, " ")
safe_word = sanitize(word)
word = word.replace(/[`'"]/gi, " ");
let safe_word = sanitize(word).trimLeft();
if (word.includes("\\n")) {
window.alert("Nice try...");
@ -143,11 +143,6 @@
return;
}
if (safe_word.startsWith(" ")) {
window.alert("Illegal first character");
return;
}
// Display filtered word
words.push(word);
$("#ignored-words").append(