44 < meta charset ="UTF-8 " />
55 < meta name ="viewport " content ="width=device-width, initial-scale=1.0 " />
66
7- <!-- Favicon and related assets -->
7+ <!-- Favicon and App Icons -->
88 < link rel ="icon " type ="image/png " href ="{{ '/assets/favicon-96x96.png' | relative_url }} " sizes ="96x96 " />
99 < link rel ="icon " type ="image/svg+xml " href ="{{ '/assets/favicon.svg' | relative_url }} " />
1010 < link rel ="shortcut icon " href ="{{ '/assets/favicon.ico' | relative_url }} " />
1111 < link rel ="apple-touch-icon " sizes ="180x180 " href ="{{ '/assets/apple-touch-icon.png' | relative_url }} " />
1212 < meta name ="apple-mobile-web-app-title " content ="Java " />
1313
14- <!-- Use the correct manifest for GitHub Pages project path -->
14+ <!-- Manifest: Use only one link, adjust for GitHub Pages project path -->
1515 < link rel ="manifest " href ="/JavaEvolution-Learning-Growing-Mastering/assets/site.webmanifest ">
1616 < meta name ="theme-color " content ="#ffffff ">
1717
1818 < title > {{ page.title }}</ title >
1919 < link rel ="stylesheet " href ="{{ "/assets/style.css" | relative_url }}">
2020
2121 < script >
22- // --- Sidebar Toggle Function ---
22+ // Sidebar Toggle Function
2323 function toggleSidebar ( ) {
2424 const sidebar = document . getElementById ( "sidebar" ) ;
2525 sidebar . classList . toggle ( "hidden" ) ;
2626 }
2727
28- // --- Auto- hide Sidebar if Clicked Outside ---
28+ // Function to hide sidebar if clicked outside
2929 function hideSidebarIfClickedOutside ( event ) {
3030 const sidebar = document . getElementById ( "sidebar" ) ;
3131 const toggleBtn = document . querySelector ( ".toggle-btn" ) ;
3636 }
3737 }
3838
39- // --- Dark Mode Toggle ---
39+ // Dark Mode Toggle Function
4040 const toggleDarkMode = ( ) => {
4141 document . body . classList . toggle ( 'dark-mode' ) ;
4242 localStorage . setItem ( 'dark-mode' , document . body . classList . contains ( 'dark-mode' ) ) ;
4343 } ;
4444
45- // --- Live Time Update Function ---
45+ // Live Time Update Function (includes GMT offset)
4646 function updateLiveTime ( ) {
4747 const now = new Date ( ) ;
4848 let hours = now . getHours ( ) ;
4949 const minutes = now . getMinutes ( ) . toString ( ) . padStart ( 2 , '0' ) ;
5050 const seconds = now . getSeconds ( ) . toString ( ) . padStart ( 2 , '0' ) ;
5151 const ampm = hours >= 12 ? 'PM' : 'AM' ;
52- hours = hours % 12 || 12 ; // convert to 12-hour format
52+ hours = hours % 12 || 12 ;
5353 const timeString = `${ hours } :${ minutes } :${ seconds } ${ ampm } ` ;
5454
55- // Calculate GMT offset (JavaScript returns offset in minutes; negative means ahead of UTC )
55+ // Compute offset (JS returns minutes behind UTC; here we negate to get GMT+ for IST )
5656 const offset = - now . getTimezoneOffset ( ) ;
5757 const offsetHours = Math . floor ( Math . abs ( offset ) / 60 ) ;
5858 const offsetMinutes = Math . abs ( offset ) % 60 ;
6262 document . getElementById ( 'live-time' ) . textContent = `Time: ${ timeString } ${ offsetString } ` ;
6363 }
6464
65- // --- Service Worker Registration ---
65+ // Service Worker Registration (ensure sw.js is at the correct path)
6666 if ( "serviceWorker" in navigator ) {
6767 navigator . serviceWorker . register ( "/JavaEvolution-Learning-Growing-Mastering/assets/sw.js" )
6868 . then ( ( ) => console . log ( "✅ Service Worker Registered" ) )
6969 . catch ( err => console . error ( "SW registration failed" , err ) ) ;
7070 }
7171
72- // --- Initialize on DOMContentLoaded ---
72+ // Initialization on DOMContentLoaded
7373 window . addEventListener ( 'DOMContentLoaded' , ( ) => {
74- // Initialize dark mode from localStorage
74+ // Dark mode initialization
7575 if ( localStorage . getItem ( 'dark-mode' ) === 'true' ) {
7676 document . body . classList . add ( 'dark-mode' ) ;
7777 }
78+ // Attach click listener for sidebar auto-hide
79+ document . addEventListener ( 'click' , hideSidebarIfClickedOutside ) ;
7880
7981 // Start live time updates
8082 updateLiveTime ( ) ;
8183 setInterval ( updateLiveTime , 1000 ) ;
82-
83- // Auto-hide sidebar on click outside
84- document . addEventListener ( 'click' , hideSidebarIfClickedOutside ) ;
8584 } ) ;
8685 </ script >
8786</ head >
8887< body >
89- <!-- Dark Mode Toggle Button (top-right) -->
88+ <!-- Dark Mode Toggle Button -->
9089< button onclick ="toggleDarkMode() " class ="dark-toggle "> 🌓</ button >
9190
91+ <!-- Place the Time Container under the dark mode toggle -->
92+ < div id ="time-location-container ">
93+ < div id ="live-time "> Time: Loading...</ div >
94+ </ div >
95+
9296< div class ="wrapper ">
9397 <!-- Sidebar Navigation -->
9498 < div id ="sidebar " class ="sidebar ">
97101
98102 <!-- Content Area -->
99103 < div class ="content ">
100- <!-- (Optional: Sidebar Toggle Button, if needed ) -->
104+ <!-- Sidebar Toggle Button (keep if you want manual control ) -->
101105 < button class ="toggle-btn " onclick ="toggleSidebar() "> ☰</ button >
102-
103- <!-- Live Time Container (placed below the dark mode toggle) -->
104- < div id ="live-time " class ="fade-in " style ="text-align: center; margin: 1rem 0; ">
105- Time: Loading...
106- </ div >
107-
108- <!-- Main Content -->
109106 < div class ="fade-in ">
110107 {{ content }}
111108 </ div >
112109 </ div >
113110</ div >
114111</ body >
115- </ html >
112+ </ html >
0 commit comments