Remove monkey power level from settings, add and rename levels

This commit is contained in:
Otard95 2021-06-03 21:34:06 +02:00
parent 8d9d2fd85a
commit 8ed3a9e1a8
3 changed files with 9 additions and 59 deletions

View file

@ -16,7 +16,6 @@ import * as PaceCaret from "./pace-caret";
import * as UI from "./ui";
import * as CommandlineLists from "./commandline-lists";
import * as BackgroundFilter from "./custom-background-filter";
import * as Settings from "./settings";
import LayoutList from "./layouts";
export let localStorageConfig = null;
@ -123,7 +122,7 @@ let defaultConfig = {
customBackgroundFilter: [0, 1, 1, 1, 1],
customLayoutfluid: "qwerty#dvorak#colemak",
monkeyPowerUnlocked: false,
monkeyPowerLevel: 9001,
monkeyPowerLevel: ">9000",
};
function isConfigKeyValid(name) {
@ -1486,21 +1485,17 @@ export function setCustomBackgroundFilter(array, nosave) {
if (!nosave) saveToLocalStorage();
}
export function setMonkeyPowerUnlocked(val, nosave) {
if (val !== true) val = false;
config.monkeyPowerUnlocked = val;
if (val) setMonkeyPowerLevel(9001);
Settings.groups.monkeyPowerLevel?.updateButton();
$(".section.monkeyPowerLevel")[val ? "removeClass" : "addClass"]("hidden");
export function setMonkeyPowerLevel(level, nosave) {
if (!["off", "mellow", "high", "ultra", ">9000"].includes(level))
level = "off";
config.monkeyPowerLevel = level;
if (!nosave) saveToLocalStorage();
}
export function setMonkeyPowerLevel(level, nosave) {
level = parseInt(level);
if (![1, 2, 9001].includes(level)) level = 0;
config.monkeyPowerLevel = level;
export function setMonkeyPowerUnlocked(val, nosave) {
if (val !== true) val = false;
config.monkeyPowerUnlocked = val;
if (val) setMonkeyPowerLevel(">9000");
if (!nosave) saveToLocalStorage();
}

View file

@ -287,10 +287,6 @@ async function initGroups() {
// "customLayoutfluid",
// UpdateConfig.setCustomLayoutfluid
// );
groups.monkeyPowerLevel = new SettingsGroup(
"monkeyPowerLevel",
UpdateConfig.setMonkeyPowerLevel
);
}
async function fillSettingsPage() {

View file

@ -3210,47 +3210,6 @@
<h1>keymap layout</h1>
<div class="buttons"></div>
</div>
<div class="section monkeyPowerLevel hidden" section="">
<h1>monkey power level</h1>
<div class="text">
Is the power to much? You can tone it down.
</div>
<div class="buttons">
<div
class="button"
monkeyPowerLevel="0"
tabindex="0"
onclick="this.blur();"
>
off
</div>
<div
class="button"
monkeyPowerLevel="1"
tabindex="0"
onclick="this.blur();"
>
lvl 1
</div>
<div
class="button"
monkeyPowerLevel="2"
tabindex="0"
onclick="this.blur();"
>
lvl 2
</div>
<div
class="button"
style="white-space: nowrap"
monkeyPowerLevel="9001"
tabindex="0"
onclick="this.blur();"
>
lvl 9001
</div>
</div>
</div>
<div class="sectionSpacer"></div>
</div>