From eafc22c36e5a9688fa4901ed284876e72c08644f Mon Sep 17 00:00:00 2001 From: Vuong BUI <37221772+vuong-buihv@users.noreply.github.com> Date: Wed, 25 Nov 2020 20:50:45 +0100 Subject: [PATCH 1/6] Punctuation mode updated * single quotes '' * parentheses () * braces {} * brackets [] --- src/js/script.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/js/script.js b/src/js/script.js index 3ae1a8b29..ed5efc594 100644 --- a/src/js/script.js +++ b/src/js/script.js @@ -726,6 +726,34 @@ 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 && + getLastChar(previousWord) != "," && + getLastChar(previousWord) != "." + ) { + //1% chance to add braces + word = `{${word}}`; + } else if ( + Math.random() < 0.01 && + getLastChar(previousWord) != "," && + getLastChar(previousWord) != "." + ) { + //1% chance to add brackets + word = `[${word}]`; } else if (Math.random() < 0.01) { //1% chance to add a colon word = word + ":"; From 69c32a4e750e5cb0ade66ef0c6b39ed19f4f964e Mon Sep 17 00:00:00 2001 From: Vuong BUI <37221772+vuong-buihv@users.noreply.github.com> Date: Fri, 27 Nov 2020 21:51:56 +0100 Subject: [PATCH 2/6] Removed {} and [] from the punctuation mode --- src/js/script.js | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/js/script.js b/src/js/script.js index ed5efc594..7b9758415 100644 --- a/src/js/script.js +++ b/src/js/script.js @@ -740,20 +740,6 @@ function punctuateWord(previousWord, currentWord, index, maxindex) { ) { //1% chance to add parentheses word = `(${word})`; - } else if ( - Math.random() < 0.01 && - getLastChar(previousWord) != "," && - getLastChar(previousWord) != "." - ) { - //1% chance to add braces - word = `{${word}}`; - } else if ( - Math.random() < 0.01 && - getLastChar(previousWord) != "," && - getLastChar(previousWord) != "." - ) { - //1% chance to add brackets - word = `[${word}]`; } else if (Math.random() < 0.01) { //1% chance to add a colon word = word + ":"; From 90ef5d223f479102422197ddc34d90a9a0e8f37f Mon Sep 17 00:00:00 2001 From: Nullaferius Date: Sat, 28 Nov 2020 06:05:35 +0300 Subject: [PATCH 3/6] Update turkish.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed hâl to hal because you need to press shift+3+a to type that char which makes it practically very difficult for these kind of tests and also we most commonly type that word "hal". --- static/languages/turkish.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/languages/turkish.json b/static/languages/turkish.json index 47aa538c6..b4485e3db 100644 --- a/static/languages/turkish.json +++ b/static/languages/turkish.json @@ -77,7 +77,7 @@ "yeni", "önce", "başka", - "hâl", + "hal", "orta", "su", "girmek", From 2cfe0fb2ffc80a145df375e5604bd7ccee8a9e10 Mon Sep 17 00:00:00 2001 From: typer Date: Sat, 28 Nov 2020 18:40:07 -0800 Subject: [PATCH 4/6] improved showWords() performance by batching appends --- src/js/script.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/js/script.js b/src/js/script.js index 3ae1a8b29..3c9229875 100644 --- a/src/js/script.js +++ b/src/js/script.js @@ -843,14 +843,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); From b34ed3f22bbecda9c78938855b0d8af6f3157b12 Mon Sep 17 00:00:00 2001 From: typer Date: Sat, 28 Nov 2020 19:27:43 -0800 Subject: [PATCH 5/6] improved loadWordsHistory() performance by batching appends --- src/js/script.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/js/script.js b/src/js/script.js index 3c9229875..115d1d892 100644 --- a/src/js/script.js +++ b/src/js/script.js @@ -3106,6 +3106,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 = ""; @@ -3216,8 +3217,9 @@ async function loadWordsHistory() { wordEl += ""; } catch (e) {} } - $("#resultWordsHistory .words").append(wordEl); + wordsHTML += wordEl; } + $("#resultWordsHistory .words").html(wordsHTML); $("#showWordHistoryButton").addClass("loaded"); return true; } From 24828801da3bbb04288dd692492883ba788164aa Mon Sep 17 00:00:00 2001 From: typer Date: Sat, 28 Nov 2020 19:27:54 -0800 Subject: [PATCH 6/6] improved single list command line performance by batching appends --- src/js/commandline.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/js/commandline.js b/src/js/commandline.js index d887336d0..21c031bc7 100644 --- a/src/js/commandline.js +++ b/src/js/commandline.js @@ -2023,14 +2023,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 {