From 123e9f5465ac3f0e6fcf5c468bab79d088e1196c Mon Sep 17 00:00:00 2001 From: SeerLite Date: Fri, 18 Dec 2020 13:40:32 -0300 Subject: [PATCH 1/6] Add language selector concept --- index.html | 7 ++++++- main.js | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index effbf72..77c21b2 100644 --- a/index.html +++ b/index.html @@ -58,13 +58,18 @@ + diff --git a/main.js b/main.js index e8f7db5..74fe1b8 100644 --- a/main.js +++ b/main.js @@ -307,6 +307,7 @@ function setLanguage(_lang) { } setText(); + hideLanguageCenter(); } else { console.error(`language ${lang} is undefine`); } @@ -391,6 +392,29 @@ function getCookie(cname) { return ''; } +showAllLanguages(); +function showAllLanguages() { + fetch(`texts/random.json`) + .then(response => { + if (response.status === 200) { + response + .text() + .then(body => { + let languages = JSON.parse(body); + let keys = Object.keys(languages); + let i; + for (i = 0; i < keys.length; i++) { + let language = document.createElement('div'); + language.setAttribute('class', 'language-button') + language.setAttribute('onClick', `setLanguage('${keys[i]}')`) + language.textContent = keys[i]; + document.getElementById('language-area').appendChild(language); + } + }) + } + }) +} + showAllThemes(); function showAllThemes(){ fetch(`themes/theme-list.json`) @@ -446,6 +470,16 @@ document.getElementById('show-themes').addEventListener('keydown', (e) => { } }); +function showLanguageCenter() { + document.getElementById('language-center').classList.remove('hidden'); + document.getElementById('command-center').classList.add('hidden'); +} + +function hideLanguageCenter() { + document.getElementById('language-center').classList.add('hidden'); + document.getElementById('command-center').classList.remove('hidden'); +} + function showThemeCenter() { document.getElementById('theme-center').classList.remove('hidden'); document.getElementById('command-center').classList.add('hidden'); From 795392e13b461c8b4b43b17ff9e558a3f10c7fb1 Mon Sep 17 00:00:00 2001 From: SeerLite Date: Fri, 18 Dec 2020 15:10:21 -0300 Subject: [PATCH 2/6] Refactor CSS a bit and style language menu An attempt to simplify general elements by selecting with classes instead of IDs. --- index.html | 6 +++--- style.css | 14 +++++--------- themes/1976.css | 5 ++--- themes/8008.css | 4 ++-- themes/9009.css | 4 ++-- themes/Leviathan.css | 5 ++--- themes/aurora.css | 4 ++-- themes/burgundy.css | 4 ++-- themes/carbon.css | 4 ++-- themes/dark.css | 4 ++-- themes/denim.css | 4 ++-- themes/dots.css | 4 ++-- themes/dracula.css | 4 ++-- themes/eclipse.css | 4 ++-- themes/godspeed.css | 5 ++--- themes/gruvbox.css | 4 ++-- themes/handarbeit.css | 4 ++-- themes/honeywell.css | 5 ++--- themes/hyperfuse.css | 4 ++-- themes/kobayashi.css | 5 ++--- themes/light.css | 4 ++-- themes/mizu.css | 4 ++-- themes/moderndolch.css | 4 ++-- themes/monokai.css | 4 ++-- themes/mrsleeves.css | 4 ++-- themes/nautilus.css | 4 ++-- themes/nord.css | 4 ++-- themes/oblivion.css | 4 ++-- themes/olivia.css | 4 ++-- themes/phantom.css | 4 ++-- themes/rama.css | 4 ++-- themes/sakura.css | 4 ++-- themes/serika.css | 4 ++-- themes/solarizeddark.css | 4 ++-- themes/solarizedlight.css | 4 ++-- themes/spacecadet.css | 5 ++--- themes/theme-list.json | 2 +- themes/vilebloom.css | 4 ++-- themes/yuri.css | 4 ++-- 39 files changed, 81 insertions(+), 91 deletions(-) diff --git a/index.html b/index.html index 77c21b2..aa61760 100644 --- a/index.html +++ b/index.html @@ -50,7 +50,7 @@
WPM: XX / ACC: XX
-
+
@@ -60,11 +60,11 @@
From addee90570087459dd11382d9a3483a7873bdc4d Mon Sep 17 00:00:00 2001 From: SeerLite Date: Sat, 19 Dec 2020 16:00:26 -0300 Subject: [PATCH 4/6] Rename class "area" to "center-area" --- index.html | 6 +++--- style.css | 4 ++-- themes/1976.css | 2 +- themes/8008.css | 2 +- themes/9009.css | 2 +- themes/Leviathan.css | 2 +- themes/aurora.css | 2 +- themes/burgundy.css | 2 +- themes/carbon.css | 2 +- themes/dark.css | 2 +- themes/denim.css | 2 +- themes/dots.css | 2 +- themes/dracula.css | 2 +- themes/eclipse.css | 2 +- themes/godspeed.css | 2 +- themes/gruvbox.css | 2 +- themes/handarbeit.css | 2 +- themes/honeywell.css | 2 +- themes/hyperfuse.css | 2 +- themes/kobayashi.css | 2 +- themes/light.css | 2 +- themes/mizu.css | 2 +- themes/moderndolch.css | 2 +- themes/monokai.css | 2 +- themes/mrsleeves.css | 2 +- themes/nautilus.css | 2 +- themes/nord.css | 2 +- themes/oblivion.css | 2 +- themes/olivia.css | 2 +- themes/phantom.css | 2 +- themes/rama.css | 2 +- themes/sakura.css | 2 +- themes/serika.css | 2 +- themes/solarizeddark.css | 2 +- themes/solarizedlight.css | 2 +- themes/spacecadet.css | 2 +- themes/vilebloom.css | 2 +- themes/yuri.css | 2 +- 38 files changed, 41 insertions(+), 41 deletions(-) diff --git a/index.html b/index.html index c59ed29..ffaab3b 100644 --- a/index.html +++ b/index.html @@ -50,7 +50,7 @@
WPM: XX / ACC: XX
-
+
@@ -60,11 +60,11 @@