Skip to content

Commit

Permalink
fixup! frontend: add selfhosting view toggle
Browse files Browse the repository at this point in the history
Signed-off-by: Luca Zeuch <l-zeuch@email.de>
  • Loading branch information
l-zeuch committed Jan 1, 2025
1 parent b9d1100 commit 4cd427c
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions assets/js/custom.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
// Put your custom JS code here

// self-hosting view.

const storedSelfhost = localStorage.getItem('selfhost');

const getSelfhost = () => {
if (storedSelfhost) {
return storedSelfhost;
}

return 'no';
return localStorage.getItem('selfhost') || 'no';
};

const setSelfhost = function (selfhost) {
const setSelfhost = (selfhost) => {
localStorage.setItem('selfhost', selfhost);
document.documentElement.setAttribute('data-bs-selfhost', selfhost);
};

Expand All @@ -22,7 +16,6 @@ window.addEventListener('DOMContentLoaded', () => {
document.querySelectorAll('[data-bs-selfhost-value]').forEach((element) => {
element.addEventListener('click', (event) => {
const selfhost = element.getAttribute('data-bs-selfhost-value');
localStorage.setItem('selfhost', selfhost);
setSelfhost(selfhost);
});
}
Expand Down

0 comments on commit 4cd427c

Please sign in to comment.