Merge pull request #349 from typerqeo/reset-settings

added reset settings button
This commit is contained in:
Jack 2020-09-10 23:35:09 +01:00 committed by GitHub
commit 3e0ad59c6c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 49 additions and 0 deletions

View file

@ -1819,6 +1819,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;

View file

@ -2332,6 +2332,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">

View file

@ -786,6 +786,15 @@ $(".pageSettings #loadCustomColorsFromPreset").click((e) => {
}, 250);
});
$("#resetSettingsButton").click((e) => {
if (confirm("Press OK to confirm.")) {
resetConfig();
setTimeout(() => {
location.reload();
},1000)
}
});
$(".pageSettings .sectionGroupTitle").click((e) => {
let group = $(e.currentTarget).attr("group");
$(`.pageSettings .settingsGroup.${group}`)

View file

@ -104,6 +104,14 @@ async function saveConfigToDB() {
}
}
function resetConfig() {
config = {
...defaultConfig
};
applyConfig();
saveConfigToCookie();
}
function saveActiveTagsToCookie() {
let tags = [];