diff --git a/.prettierignore b/.prettierignore
index dc6644bc5..f568baa07 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -6,4 +6,5 @@ sound/*
node_modules
css/balloon.css
css/fa.css
-css/style.min.css
\ No newline at end of file
+css/style.min.css
+list.json
\ No newline at end of file
diff --git a/README.md b/README.md
index 74f802a29..da31ef529 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,15 @@
+# monkeytype
+
+![](https://github.com/Miodec/monkeytype/blob/master/static/mtsocial.png?raw=true)
+
+
+
+
+
+
+
+
+
# about
Monkeytype is a minimalistic, customisable typing test, featuring many test modes, an account system to save your typing speed history and user configurable features like themes, a smooth caret and more.
diff --git a/src/js/commandline.js b/src/js/commandline.js
index d887336d0..e7a5a9f68 100644
--- a/src/js/commandline.js
+++ b/src/js/commandline.js
@@ -1769,8 +1769,11 @@ $("#commandInput input").keydown((e) => {
$("#commandLineWrapper #commandLine .suggestions").on("mouseover", (e) => {
$("#commandLineWrapper #commandLine .suggestions .entry").removeClass(
- "active"
+ "activeKeyboard"
);
+ if (isPreviewingTheme) {
+ previewTheme(config.theme, false);
+ }
let hoverId = $(e.target).attr("command");
try {
let list = currentCommands[currentCommands.length - 1];
@@ -2023,14 +2026,15 @@ function updateSuggestedCommands() {
function displayFoundCommands() {
$("#commandLine .suggestions").empty();
+ let commandsHTML = "";
let list = currentCommands[currentCommands.length - 1];
$.each(list.list, (index, obj) => {
if (obj.found && (obj.available !== undefined ? obj.available() : true)) {
- $("#commandLine .suggestions").append(
- '
' + obj.display + "
"
- );
+ commandsHTML +=
+ '' + obj.display + "
";
}
});
+ $("#commandLine .suggestions").html(commandsHTML);
if ($("#commandLine .suggestions .entry").length == 0) {
$("#commandLine .separator").css({ height: 0, margin: 0 });
} else {
diff --git a/src/js/layouts.js b/src/js/layouts.js
index 33587df37..0ca287e00 100644
--- a/src/js/layouts.js
+++ b/src/js/layouts.js
@@ -176,7 +176,7 @@ const layouts = {
prog_dvorak: {
keymapShowTopRow: true,
keys: [
- "$~", "[%", "[7", "{5", "}3", "(1", "=9", "*0", ")2", "+4", "]6", "!8", "#`",
+ "$~", "&%", "[7", "{5", "}3", "(1", "=9", "*0", ")2", "+4", "]6", "!8", "#`",
";:", ",<", ".>", "pP", "yY", "fF", "gG", "cC", "rR", "lL", "/?", "@^", "\\|",
"aA", "oO", "eE", "uU", "iI", "dD", "hH", "tT", "nN", "sS", "-_",
"\\|", "'\"", "qQ", "jJ", "kK", "xX", "bB", "mM", "wW", "vV", "zZ",
diff --git a/src/js/misc.js b/src/js/misc.js
index 5dad2a809..72f5326dc 100644
--- a/src/js/misc.js
+++ b/src/js/misc.js
@@ -542,7 +542,7 @@ function canBailOut() {
}
let simplePopups = {};
-
+window.simplePopups = simplePopups;
class SimplePopup {
constructor(
id,
diff --git a/src/js/script.js b/src/js/script.js
index 3ae1a8b29..9f8cf83ca 100644
--- a/src/js/script.js
+++ b/src/js/script.js
@@ -726,6 +726,20 @@ function punctuateWord(previousWord, currentWord, index, maxindex) {
) {
//1% chance to add quotes
word = `"${word}"`;
+ } else if (
+ Math.random() < 0.01 &&
+ getLastChar(previousWord) != "," &&
+ getLastChar(previousWord) != "."
+ ) {
+ //1% chance to add single quotes
+ word = `'${word}'`;
+ } else if (
+ Math.random() < 0.01 &&
+ getLastChar(previousWord) != "," &&
+ getLastChar(previousWord) != "."
+ ) {
+ //1% chance to add parentheses
+ word = `(${word})`;
} else if (Math.random() < 0.01) {
//1% chance to add a colon
word = word + ":";
@@ -843,14 +857,15 @@ function addWord() {
function showWords() {
$("#words").empty();
+ let wordsHTML = "";
for (let i = 0; i < wordsList.length; i++) {
- let w = "";
+ wordsHTML += "
";
for (let c = 0; c < wordsList[i].length; c++) {
- w += "" + wordsList[i].charAt(c) + "";
+ wordsHTML += "" + wordsList[i].charAt(c) + "";
}
- w += "
";
- $("#words").append(w);
+ wordsHTML += "
";
}
+ $("#words").html(wordsHTML);
$("#wordsWrapper").removeClass("hidden");
const wordHeight = $(document.querySelector(".word")).outerHeight(true);
@@ -3105,6 +3120,7 @@ function toggleResultWordsDisplay() {
async function loadWordsHistory() {
$("#resultWordsHistory .words").empty();
+ let wordsHTML = "";
for (let i = 0; i < inputHistory.length + 2; i++) {
let input = inputHistory[i];
let wordEl = "";
@@ -3215,8 +3231,9 @@ async function loadWordsHistory() {
wordEl += "";
} catch (e) {}
}
- $("#resultWordsHistory .words").append(wordEl);
+ wordsHTML += wordEl;
}
+ $("#resultWordsHistory .words").html(wordsHTML);
$("#showWordHistoryButton").addClass("loaded");
return true;
}
@@ -4243,6 +4260,11 @@ $(document).keydown((event) => {
}
}
+ //blocking firefox from going back in history with backspace
+ if (event.key === "Backspace") {
+ event.preventDefault();
+ }
+
//only for the typing test
if ($("#wordsInput").is(":focus")) {
const isBackspace =
diff --git a/static/index.html b/static/index.html
index 75fb3db43..2e5fcf0f9 100644
--- a/static/index.html
+++ b/static/index.html
@@ -3491,8 +3491,6 @@
-
-
diff --git a/static/languages/code_c.json b/static/languages/code_c.json
new file mode 100644
index 000000000..c929cdadc
--- /dev/null
+++ b/static/languages/code_c.json
@@ -0,0 +1,58 @@
+{
+ "name": "code_c",
+ "leftToRight": true,
+ "words": [
+ "int",
+ "char",
+ "unsigned",
+ "float",
+ "void",
+ "main",
+ "union",
+ "long",
+ "double",
+ "printf",
+ "sprintf",
+ "if",
+ "else",
+ "struct",
+ "fork",
+ "switch",
+ "for",
+ "define",
+ "return",
+ "include",
+ "case",
+ "&&",
+ "||",
+ "break",
+ "bool",
+ "static",
+ "public",
+ "enum",
+ "typedef",
+ "private",
+ "exit",
+ "",
+ "scanf",
+ "NULL",
+ "malloc",
+ "calloc",
+ "free",
+ "realloc",
+ "",
+ "fgets",
+ "strcmp",
+ "strcpy",
+ "fputs",
+ "stdout",
+ "EOF",
+ "getc",
+ "while",
+ "fclose",
+ "fopen",
+ "do",
+ "fscanf",
+ "extern"
+ ]
+}
diff --git a/static/languages/code_html.json b/static/languages/code_html.json
new file mode 100644
index 000000000..fcc4711bc
--- /dev/null
+++ b/static/languages/code_html.json
@@ -0,0 +1,335 @@
+{
+ "name": "code_html",
+ "leftToRight": true,
+ "words": [
+ "action",
+ "alt",
+ "class",
+ "fill",
+ "for",
+ "height",
+ "href",
+ "href",
+ "href",
+ "href",
+ "id",
+ "kind",
+ "max",
+ "media",
+ "method",
+ "min",
+ "name",
+ "src",
+ "src",
+ "src",
+ "srclang",
+ "srcset",
+ "stroke",
+ "stroke-width",
+ "style",
+ "stylesheet",
+ "stylesheet",
+ "title",
+ "type",
+ "type",
+ "value",
+ "width",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "",
+ "