Skip to content

Commit

Permalink
Settings scroll back to top on page change
Browse files Browse the repository at this point in the history
  • Loading branch information
Levminer committed Dec 3, 2021
1 parent aec765b commit a41051a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
4 changes: 2 additions & 2 deletions app/settings/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ <h5 class="mx-3 flex flex-row m-0 font-bold build-content text-center">You are r
</div>

<!-- header -->
<div class="mx-auto rounded-2xl bg-gray-700 w-3/5 text-center mt-40">
<div id="header" class="mx-auto rounded-2xl bg-gray-700 w-3/5 text-center mt-40">
<img src="../../img/header.png" class="h-16 w-16 relative top-5" />
<h2>Settings</h2>
<h4>You can configure the app settings here.</h4>
Expand Down Expand Up @@ -277,7 +277,7 @@ <h4>Uses GPU for smoother experience. Enable this option if you experience frame
</div>
<h3>Clear data</h3>
<h4>Clear password, 2FA codes and all other settings. Be careful.</h4>
<button class="buttoni" id="but1" onclick="reset()">
<button class="buttoni" id="but1" onclick="clearData()">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" />
</svg>
Expand Down
18 changes: 14 additions & 4 deletions app/settings/src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,12 @@ const toggleWindowCaptureSwitch = () => {
}
}

// ? reset
const reset = () => {
/**
* Clear all data
*/
const clearData = () => {
dialog
.showMessageBox({
.showMessageBox(currentWindow, {
title: "Authme",
buttons: ["Yes", "No"],
defaultId: 1,
Expand All @@ -271,7 +273,7 @@ const reset = () => {
.then((result) => {
if (result.response === 0) {
dialog
.showMessageBox({
.showMessageBox(currentWindow, {
title: "Authme",
buttons: ["Yes", "No"],
defaultId: 1,
Expand Down Expand Up @@ -705,6 +707,8 @@ const menu = (evt, name) => {
document.querySelector(".experimental").disabled = false
document.querySelector(".codes").disabled = false

window.location = `${`${window.location}`.replace(/#[A-Za-z0-9_]*$/, "")}#header`

shortcut = true

ipc.send("shortcuts")
Expand All @@ -718,6 +722,8 @@ const menu = (evt, name) => {
document.querySelector(".experimental").disabled = false
document.querySelector(".codes").disabled = false

window.location = `${`${window.location}`.replace(/#[A-Za-z0-9_]*$/, "")}#header`

if (shortcut === true) {
ipc.send("shortcuts")

Expand All @@ -733,6 +739,8 @@ const menu = (evt, name) => {
document.querySelector(".shortcuts").disabled = false
document.querySelector(".codes").disabled = false

window.location = `${`${window.location}`.replace(/#[A-Za-z0-9_]*$/, "")}#header`

if (shortcut === true) {
ipc.send("shortcuts")

Expand All @@ -748,6 +756,8 @@ const menu = (evt, name) => {
document.querySelector(".shortcuts").disabled = false
document.querySelector(".codes").disabled = true

window.location = `${`${window.location}`.replace(/#[A-Za-z0-9_]*$/, "")}#header`

if (shortcut === true) {
ipc.send("shortcuts")

Expand Down

0 comments on commit a41051a

Please sign in to comment.