Merge pull request #230 from OctahedronV2/layoutfluid

Added layoutfluid challenge to the funbox
This commit is contained in:
Jack 2020-08-03 19:12:24 +01:00 committed by GitHub
commit b14f70251d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 42 additions and 7 deletions

View file

@ -1,5 +0,0 @@
{
"projects": {
"default": "project-id"
}
}

View file

@ -2369,4 +2369,4 @@ key {
.r5 {
display: grid;
grid-template-columns: 4fr 7.5fr 4fr;
}
}

View file

@ -26,8 +26,13 @@
"name": "rAnDoMcAsE",
"type": "script"
},
{
"name": "layoutfluid",
"type": "script"
},
{
"name": "earthquake",
"type": "style"
}
]
]

View file

@ -239,6 +239,15 @@ function activateFunbox(funbox, mode) {
config.keymapMode = "off";
setActiveKeymapModeButton();
restartTest();
} else if (funbox === "layoutfluid") {
config.keymapMode = "on";
changeKeymapMode("next");
setActiveKeymapModeButton();
changeLayout("qwerty");
setActiveLayoutButton();
changeKeymapLayout("qwerty");
setActiveKeymapLayoutButton();
restartTest();
}
activeFunBox = funbox;
}
@ -2019,6 +2028,23 @@ function startTest() {
wpmHistory.push(wpmAndRaw.wpm);
rawHistory.push(wpmAndRaw.raw);
if (activeFunBox === "layoutfluid") {
const layouts = ["qwerty", "dvorak", "colemak"];
let index = 0;
if (config.mode === "time") {
index = Math.floor(time / (config.time / 3));
} else if (config.mode === "words") {
index = Math.floor(inputHistory.length / (outof / 3));
}
if (config.layout !== layouts[index]) {
showNotification(`--- !!! ${layouts[index]} !!! ---`, 3000);
}
changeLayout(layouts[index]);
changeKeymapLayout(layouts[index]);
updateHighlightedKeymapKey();
setActiveLayoutButton();
}
// console.timeEnd("livewpm");
keypressPerSecond.push(currentKeypressCount);
currentKeypressCount = 0;
@ -2154,6 +2180,15 @@ function restartTest(withSameWordset = false) {
if (config.keymapMode !== "off") {
showKeymap();
}
if (activeFunBox === "layoutfluid") {
changeLayout("qwerty");
setActiveLayoutButton();
changeKeymapLayout("qwerty");
setActiveKeymapLayoutButton();
updateHighlightedKeymapKey();
}
$("#result").addClass("hidden");
$("#testModesNotice").removeClass("hidden").css({
opacity: 1,