mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-03-10 21:53:13 +08:00
added reset settings button
This commit is contained in:
parent
8d4fdc6b9a
commit
d6b177a16d
4 changed files with 47 additions and 0 deletions
|
@ -1803,6 +1803,15 @@ key {
|
|||
column-gap: 2rem;
|
||||
align-items: center;
|
||||
|
||||
.button.danger {
|
||||
background: #d00;
|
||||
color: #eee;
|
||||
&:hover {
|
||||
background: var(--main-color);
|
||||
color: var(--bg-color);
|
||||
}
|
||||
}
|
||||
|
||||
&.customTheme {
|
||||
grid-template-columns: 1fr 1fr 1fr 1fr;
|
||||
justify-items: stretch;
|
||||
|
|
|
@ -2331,6 +2331,29 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sectionGroupTitle" group="dangerSection">
|
||||
danger section
|
||||
<i class="fas fa-chevron-down"></i>
|
||||
</div>
|
||||
<div class="settingsGroup dangerSection">
|
||||
<div class="section resetSettings">
|
||||
<h1>reset settings</h1>
|
||||
<div class="text">
|
||||
Resets settings to the default (but doesn't touch your tags).
|
||||
Warning: you can't undo this action!
|
||||
</div>
|
||||
<div class="buttons">
|
||||
<div
|
||||
class="button off danger"
|
||||
id="resetSettingsButton"
|
||||
tabindex="0"
|
||||
onclick="this.blur();"
|
||||
>
|
||||
reset
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="page pageLogin hidden">
|
||||
|
|
|
@ -786,6 +786,13 @@ $(".pageSettings #loadCustomColorsFromPreset").click((e) => {
|
|||
}, 250);
|
||||
});
|
||||
|
||||
$("#resetSettingsButton").click((e) => {
|
||||
if (confirm("Press OK to confirm.")) {
|
||||
resetConfig();
|
||||
location.reload();
|
||||
}
|
||||
});
|
||||
|
||||
$(".pageSettings .sectionGroupTitle").click((e) => {
|
||||
let group = $(e.currentTarget).attr("group");
|
||||
$(`.pageSettings .settingsGroup.${group}`)
|
||||
|
|
|
@ -104,6 +104,14 @@ async function saveConfigToDB() {
|
|||
}
|
||||
}
|
||||
|
||||
function resetConfig() {
|
||||
config = {
|
||||
...defaultConfig
|
||||
};
|
||||
applyConfig();
|
||||
saveConfigToCookie();
|
||||
}
|
||||
|
||||
function saveActiveTagsToCookie() {
|
||||
let tags = [];
|
||||
|
||||
|
|
Loading…
Reference in a new issue