-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #62 from botlabs-gg/selfhosting-view
frontend: add selfhosting view toggle
- Loading branch information
Showing
8 changed files
with
84 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,22 @@ | ||
// Put your custom JS code here | ||
|
||
// self-hosting view. | ||
const getSelfhost = () => { | ||
return localStorage.getItem('selfhost') || 'no'; | ||
}; | ||
|
||
const setSelfhost = (selfhost) => { | ||
localStorage.setItem('selfhost', selfhost); | ||
document.documentElement.setAttribute('data-selfhost', selfhost); | ||
}; | ||
|
||
setSelfhost(getSelfhost()); | ||
|
||
window.addEventListener('DOMContentLoaded', () => { | ||
document.querySelectorAll('[data-selfhost-value]').forEach((element) => { | ||
element.addEventListener('click', (event) => { | ||
const selfhost = element.getAttribute('data-selfhost-value'); | ||
setSelfhost(selfhost); | ||
}); | ||
} | ||
)}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{{/* wraps the inner content in a div with a class of "selfhosting", such that it can be conditionally hidden by some JS code. */}} | ||
<div class="selfhosting"> | ||
{{ .Inner | $.Page.RenderString }} | ||
</div> |