1010 document . documentElement . setAttribute ( 'data-theme' , 'night' ) ;
1111 }
1212 } ) ( ) ;
13+ document . addEventListener ( 'DOMContentLoaded' , function ( ) {
14+ const btn = document . getElementById ( 'themeToggle' ) ;
15+ if ( ! btn ) {
16+ console . error ( 'themeToggle button not found' ) ;
17+ return ;
18+ }
19+
20+ const icon = btn . querySelector ( 'i' ) ;
21+ const STORAGE_KEY = 'bibliodrift_theme' ;
22+
23+ function applyTheme ( theme ) {
24+ if ( theme === 'night' ) {
25+ document . documentElement . setAttribute ( 'data-theme' , 'night' ) ;
26+ if ( icon ) icon . className = 'fa-solid fa-sun' ;
27+ } else {
28+ document . documentElement . removeAttribute ( 'data-theme' ) ;
29+ if ( icon ) icon . className = 'fa-solid fa-moon' ;
30+ }
31+
32+ localStorage . setItem ( STORAGE_KEY , theme ) ;
33+ if ( typeof restoreTheme === 'function' ) restoreTheme ( ) ;
34+ }
35+
36+ const savedTheme = localStorage . getItem ( STORAGE_KEY ) || 'light' ;
37+ applyTheme ( savedTheme ) ;
38+
39+ btn . addEventListener ( 'click' , function ( ) {
40+ const current =
41+ document . documentElement . getAttribute ( 'data-theme' ) === 'night'
42+ ? 'night'
43+ : 'light' ;
44+
45+ const next = current === 'night' ? 'light' : 'night' ;
46+ applyTheme ( next ) ;
47+ } ) ;
48+ } ) ;
1349 </ script >
1450 < script src ="https://cdnjs.cloudflare.com/ajax/libs/localforage/1.10.0/localforage.min.js "> </ script >
1551 < script src ="https://unpkg.com/dexie/dist/dexie.js "> </ script >
5389</ head >
5490
5591< body class ="library-page ">
92+ < div id ="sc-glow-outer "> </ div >
93+ < div id ="sc-glow-mid "> </ div >
94+ < div id ="sc-glow-inner "> </ div >
95+ < div id ="sc-dot "> </ div >
5696
5797 < header >
5898 < a href ="app.html " class ="logo ">
@@ -702,8 +742,7 @@ <h3>Reader Reviews</h3>
702742 < div id ="ambientPanel " class ="ambient-panel ">
703743 < h3 style ="color: var(--text-main) !important; "> Ambient Sanctuary</ h3 >
704744 < div class ="ambient-option ">
705- < span style ="color: var(--text-main) !important; "> < i class ="fa-solid fa-cloud-rain "> </ i > Rainy
706- Evening</ span >
745+ < span style ="color: var(--text-main) !important; "> < i class ="fa-solid fa-cloud-rain "> </ i > Rainy Evening</ span >
707746 < label class ="switch ">
708747 < input type ="checkbox " id ="rainToggle ">
709748 < span class ="slider "> </ span >
@@ -717,8 +756,42 @@ <h3 style="color: var(--text-main) !important;">Ambient Sanctuary</h3>
717756 </ label >
718757 </ div >
719758 < div class ="ambient-option ">
720- < span style ="color: var(--text-main) !important; "> < i class ="fa-solid fa-water "> </ i > Calm Ocean
721- Waves</ span >
759+ < span style ="color: var(--text-main) !important; "> < i class ="fa-solid fa-rocket "> </ i > Space Drift</ span >
760+ < label class ="switch ">
761+ < input type ="checkbox " id ="spaceToggle ">
762+ < span class ="slider "> </ span >
763+ </ label >
764+ </ div >
765+ < div class ="ambient-option ">
766+ < span style ="color: var(--text-main) !important; "> < i class ="fa-solid fa-train "> </ i > Night Train</ span >
767+ < label class ="switch ">
768+ < input type ="checkbox " id ="trainToggle ">
769+ < span class ="slider "> </ span >
770+ </ label >
771+ </ div >
772+ < div class ="ambient-option ">
773+ < span style ="color: var(--text-main) !important; "> < i class ="fa-solid fa-tree "> </ i > Forest Cabin</ span >
774+ < label class ="switch ">
775+ < input type ="checkbox " id ="forestToggle ">
776+ < span class ="slider "> </ span >
777+ </ label >
778+ </ div >
779+ < div class ="ambient-option ">
780+ < span style ="color: var(--text-main) !important; "> < i class ="fa-solid fa-wand-sparkles "> </ i > Magic Realm</ span >
781+ < label class ="switch ">
782+ < input type ="checkbox " id ="magicToggle ">
783+ < span class ="slider "> </ span >
784+ </ label >
785+ </ div >
786+ < div class ="ambient-option ">
787+ < span style ="color: var(--text-main) !important; "> < i class ="fa-solid fa-torii-gate "> </ i > Wisteria Night</ span >
788+ < label class ="switch ">
789+ < input type ="checkbox " id ="animeToggle ">
790+ < span class ="slider "> </ span >
791+ </ label >
792+ </ div >
793+ < div class ="ambient-option ">
794+ < span style ="color: var(--text-main) !important; "> < i class ="fa-solid fa-water "> </ i > Calm Ocean Waves</ span >
722795 < label class ="switch ">
723796 < input type ="checkbox " id ="oceanToggle ">
724797 < span class ="slider "> </ span >
0 commit comments