Skip to content

Commit

Permalink
Testing the back button
Browse files Browse the repository at this point in the history
  • Loading branch information
saravahdatipour committed Feb 3, 2025
1 parent 6c23789 commit 6210d03
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions webapp/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function init() {
}
const appNavigationHistory = []; // Track in-app navigation

function setWindow(window, back) {
function setWindow(window, back = false) {
$('[id^=window-]').addClass('hidden');
$('#window-' + window).removeClass('hidden');

Expand All @@ -45,16 +45,16 @@ function setWindow(window, back) {

if (appNavigationHistory.length > 1) {
backButton
.click(() => {
clearStatus();
appNavigationHistory.pop(); // Remove current page
const previousPage = appNavigationHistory[appNavigationHistory.length - 1]; // Get last page
setWindow(previousPage, false); // Go back
return false;
})
.removeClass('button-hidden');
.click(() => {
clearStatus();
appNavigationHistory.pop();
const previousPage = appNavigationHistory[appNavigationHistory.length - 1];
setWindow(previousPage, true);
return false;
})
.removeClass('button-hidden');
} else {
backButton.addClass('button-hidden'); // Hide when at the first page
backButton.addClass('button-hidden');
}

const submitButtonText = MESSAGES['submit-' + window];
Expand All @@ -68,7 +68,6 @@ function setWindow(window, back) {
}



function addEmail(e) {
const address = $('#email-form [id=email]').val().toLowerCase();

Expand Down

0 comments on commit 6210d03

Please sign in to comment.