Skip to content
This repository has been archived by the owner on Oct 10, 2023. It is now read-only.

Commit

Permalink
Update oldsite/static/js/toggle.js
Browse files Browse the repository at this point in the history
Co-authored-by: Felix Fontein <[email protected]>
  • Loading branch information
oraNod and felixfontein authored Mar 27, 2023
1 parent ee8b0b4 commit 9ea951d
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions oldsite/static/js/toggle.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,9 @@ const currentPageName = currentPagePath.substring(currentPagePath.lastIndexOf('/

const pageToggle = document.getElementById('page-toggle');

if (pageToggle.hasAttribute('data-target')) {
const redirectPageName = pageToggle.getAttribute('data-target');
if (pageToggle) {
const redirectPageName = pageToggle.hasAttribute('data-target') ? pageToggle.getAttribute('data-target') : currentPageName;
pageToggle.addEventListener('click', function() {
window.location.href = '../' + redirectPageName;
});
} else {
pageToggle.addEventListener('click', function() {
window.location.href = '../' + currentPageName;
});
};
}

0 comments on commit 9ea951d

Please sign in to comment.