()
| 154 | } |
| 155 | |
| 156 | function layoutfluid(): void { |
| 157 | if (timerDebug) console.time("layoutfluid"); |
| 158 | if (Config.funbox.includes("layoutfluid") && Config.mode === "time") { |
| 159 | const layouts = Config.customLayoutfluid; |
| 160 | const switchTime = Config.time / layouts.length; |
| 161 | const time = Time.get(); |
| 162 | const index = Math.floor(time / switchTime); |
| 163 | const layout = layouts[index]; |
| 164 | const flooredSwitchTimes = []; |
| 165 | |
| 166 | for (let i = 1; i < layouts.length; i++) { |
| 167 | flooredSwitchTimes.push(Math.floor(switchTime * i)); |
| 168 | } |
| 169 | |
| 170 | if (flooredSwitchTimes.includes(time + 3)) { |
| 171 | LayoutfluidFunboxTimer.show(); |
| 172 | LayoutfluidFunboxTimer.updateTime(3, layouts[index + 1] as string); |
| 173 | } else if (flooredSwitchTimes.includes(time + 2)) { |
| 174 | LayoutfluidFunboxTimer.updateTime(2, layouts[index + 1] as string); |
| 175 | } else if (flooredSwitchTimes.includes(time + 1)) { |
| 176 | LayoutfluidFunboxTimer.updateTime(1, layouts[index + 1] as string); |
| 177 | } |
| 178 | |
| 179 | if (Config.layout !== layout && layout !== undefined) { |
| 180 | LayoutfluidFunboxTimer.hide(); |
| 181 | setConfig("layout", layout as Layout, { |
| 182 | nosave: true, |
| 183 | }); |
| 184 | setConfig("keymapLayout", layout as KeymapLayout, { |
| 185 | nosave: true, |
| 186 | }); |
| 187 | |
| 188 | if (Config.keymapMode === "next") { |
| 189 | setTimeout(() => { |
| 190 | highlight( |
| 191 | TestWords.words.getCurrentText().charAt(getCurrentInput().length), |
| 192 | ); |
| 193 | }, 1); |
| 194 | } |
| 195 | } |
| 196 | } |
| 197 | if (timerDebug) console.timeEnd("layoutfluid"); |
| 198 | } |
| 199 | |
| 200 | function checkIfFailed( |
| 201 | wpmAndRaw: { wpm: number; raw: number }, |
no test coverage detected