mirror of
https://github.com/janishutz/libreevent.git
synced 2025-11-25 21:34:24 +00:00
update website to be almost complete
This commit is contained in:
27
website/dist/templates/helper.js
vendored
Normal file
27
website/dist/templates/helper.js
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
let theme = localStorage.getItem( 'theme' ) ?? '';
|
||||
if ( window.matchMedia( '(prefers-color-scheme: dark)' ).matches || theme === '☼' ) {
|
||||
document.documentElement.classList.add( 'dark' );
|
||||
document.getElementById( 'themeSelector' ).innerHTML = '☼';
|
||||
theme = '☼';
|
||||
} else {
|
||||
document.documentElement.classList.add( 'light' );
|
||||
document.getElementById( 'themeSelector' ).innerHTML = '☽';
|
||||
theme = '☽';
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
function changeTheme () {
|
||||
if ( theme === '☼' ) {
|
||||
document.documentElement.classList.remove( 'dark' );
|
||||
document.documentElement.classList.add( 'light' );
|
||||
localStorage.setItem( 'theme', '☽' );
|
||||
document.getElementById( 'themeSelector' ).innerHTML = '☽';
|
||||
theme = '☽';
|
||||
} else if ( theme === '☽' ) {
|
||||
document.documentElement.classList.remove( 'light' );
|
||||
document.documentElement.classList.add( 'dark' );
|
||||
localStorage.setItem( 'theme', '☼' );
|
||||
document.getElementById( 'themeSelector' ).innerHTML = '☼';
|
||||
theme = '☼';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user