|
1 | | -<!-- |
2 | | -<!DOCTYPE html> |
3 | | -<html lang="en"> |
4 | | -<head> |
5 | | - <meta charset="UTF-8" /> |
6 | | - <meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
7 | | -
|
8 | | - <!– Font Awesome –> |
9 | | - <link |
10 | | - rel="stylesheet" |
11 | | - href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" |
12 | | - /> |
13 | | -
|
14 | | - <!– Favicons –> |
15 | | - <link |
16 | | - rel="icon" type="image/png" |
17 | | - href="{{ '/assets/favicon-96x96.png' | relative_url }}" |
18 | | - sizes="96x96" |
19 | | - /> |
20 | | - <link |
21 | | - rel="icon" type="image/svg+xml" |
22 | | - href="{{ '/assets/favicon.svg' | relative_url }}" |
23 | | - /> |
24 | | - <link |
25 | | - rel="shortcut icon" |
26 | | - href="{{ '/assets/favicon.ico' | relative_url }}" |
27 | | - /> |
28 | | - <link |
29 | | - rel="apple-touch-icon" |
30 | | - sizes="180x180" |
31 | | - href="{{ '/assets/apple-touch-icon.png' | relative_url }}" |
32 | | - /> |
33 | | - <meta name="apple-mobile-web-app-title" content="Java" /> |
34 | | - <link |
35 | | - rel="manifest" |
36 | | - href="/JavaEvolution-Learning-Growing-Mastering/assets/site.webmanifest" |
37 | | - /> |
38 | | - <meta name="theme-color" content="#ffffff" /> |
39 | | -
|
40 | | - <title>{{ page.title }}</title> |
41 | | - <link |
42 | | - rel="stylesheet" |
43 | | - href="{{ '/assets/style.css' | relative_url }}" |
44 | | - /> |
45 | | -
|
46 | | - <script> |
47 | | - // Current timezone tracker |
48 | | - let currentZone = 'IST'; |
49 | | - let tapCount = 0; |
50 | | - let tapTimer = null; |
51 | | - const TAP_TIMEOUT = 300; // ms for double-tap detection |
52 | | - const SCROLL_THRESHOLD = 100; // px to hide theme/time container |
53 | | -
|
54 | | - // Sidebar toggle |
55 | | - function toggleSidebar(isHidden) { |
56 | | - const sidebar = document.getElementById('sidebar'); |
57 | | - const toggleBtn = document.querySelector('.toggle-btn'); |
58 | | - sidebar.classList.toggle('hidden', isHidden); |
59 | | - localStorage.setItem('sidebar-hidden', isHidden); |
60 | | - if (window.innerWidth > 768) { |
61 | | - toggleBtn.style.display = isHidden ? 'block' : 'none'; |
62 | | - } |
63 | | - } |
64 | | -
|
65 | | - // Handle tap/click events |
66 | | - function handleTap(event) { |
67 | | - const sidebar = document.getElementById('sidebar'); |
68 | | - const target = event.target; |
69 | | -
|
70 | | - if ( |
71 | | - target.closest('a') || |
72 | | - target.closest('button') || |
73 | | - target.closest('#sidebar') || |
74 | | - target.closest('#theme-time-container') || |
75 | | - target.closest('.tooltip') |
76 | | - ) { |
77 | | - return; |
78 | | - } |
79 | | -
|
80 | | - tapCount++; |
81 | | - if (tapCount === 1) { |
82 | | - tapTimer = setTimeout(() => { |
83 | | - if (!sidebar.classList.contains('hidden')) { |
84 | | - toggleSidebar(true); |
85 | | - } |
86 | | - tapCount = 0; |
87 | | - }, TAP_TIMEOUT); |
88 | | - } else if (tapCount === 2) { |
89 | | - clearTimeout(tapTimer); |
90 | | - if (sidebar.classList.contains('hidden')) { |
91 | | - toggleSidebar(false); |
92 | | - } |
93 | | - tapCount = 0; |
94 | | - } |
95 | | - } |
96 | | -
|
97 | | - // Dark mode toggle |
98 | | - function toggleDarkMode() { |
99 | | - const body = document.body; |
100 | | - body.classList.toggle('dark-mode'); |
101 | | - const isDark = body.classList.contains('dark-mode'); |
102 | | - localStorage.setItem('dark-mode', isDark); |
103 | | - const icon = document.querySelector('.dark-toggle i'); |
104 | | - icon.classList.remove('fa-moon', 'fa-sun'); |
105 | | - icon.classList.add(isDark ? 'fa-sun' : 'fa-moon'); |
106 | | - } |
107 | | -
|
108 | | - // Timezone toggle |
109 | | - function toggleTimezone() { |
110 | | - currentZone = currentZone === 'IST' ? 'GMT' : 'IST'; |
111 | | - document.getElementById('tz-toggle-btn').textContent = currentZone; |
112 | | - updateLiveTime(); |
113 | | - } |
114 | | -
|
115 | | - // Update live time |
116 | | - function updateLiveTime() { |
117 | | - const now = new Date(); |
118 | | - let date; |
119 | | - if (currentZone === 'GMT') { |
120 | | - date = new Date(now.getTime() + now.getTimezoneOffset() * 60000); |
121 | | - } else { |
122 | | - const utc = now.getTime() + now.getTimezoneOffset() * 60000; |
123 | | - date = new Date(utc + 5.5 * 3600000); |
124 | | - } |
125 | | - let h = date.getHours(); |
126 | | - const m = date.getMinutes().toString().padStart(2, '0'); |
127 | | - const s = date.getSeconds().toString().padStart(2, '0'); |
128 | | - const ampm = h >= 12 ? 'PM' : 'AM'; |
129 | | - h = h % 12 || 12; |
130 | | - document.getElementById('live-time').textContent = |
131 | | - `Time (${currentZone}): ${h}:${m}:${s} ${ampm}`; |
132 | | - } |
133 | | -
|
134 | | - // Handle scroll for theme/time container |
135 | | - function handleScroll() { |
136 | | - const themeTimeContainer = document.getElementById('theme-time-container'); |
137 | | - if (window.scrollY > SCROLL_THRESHOLD) { |
138 | | - themeTimeContainer.classList.add('hidden'); |
139 | | - } else { |
140 | | - themeTimeContainer.classList.remove('hidden'); |
141 | | - } |
142 | | - } |
143 | | -
|
144 | | - // On load: init dark mode, sidebar state, listeners, time, SW |
145 | | - window.onload = () => { |
146 | | - // Initialize dark mode |
147 | | - const isDark = localStorage.getItem('dark-mode') === 'true'; |
148 | | - const body = document.body; |
149 | | - if (isDark) { |
150 | | - body.classList.add('dark-mode'); |
151 | | - document.querySelector('.dark-toggle i').classList.replace('fa-moon', 'fa-sun'); |
152 | | - } |
153 | | -
|
154 | | - // Initialize sidebar state |
155 | | - const sidebar = document.getElementById('sidebar'); |
156 | | - const toggleBtn = document.querySelector('.toggle-btn'); |
157 | | - const isSidebarHidden = localStorage.getItem('sidebar-hidden') === 'true'; |
158 | | - sidebar.classList.toggle('hidden', isSidebarHidden); |
159 | | - if (window.innerWidth > 768) { |
160 | | - toggleBtn.style.display = isSidebarHidden ? 'block' : 'none'; |
161 | | - } else { |
162 | | - toggleBtn.style.display = 'block'; |
163 | | - } |
164 | | -
|
165 | | - // Add tap/click and scroll listeners |
166 | | - document.addEventListener('click', handleTap); |
167 | | - document.addEventListener('touchstart', handleTap, { passive: true }); |
168 | | - window.addEventListener('scroll', handleScroll, { passive: true }); |
169 | | -
|
170 | | - // Show tooltip on first visit |
171 | | - if (!localStorage.getItem('tooltip-shown')) { |
172 | | - setTimeout(() => { |
173 | | - const tooltip = document.getElementById('tooltip'); |
174 | | - tooltip.classList.add('visible'); |
175 | | - setTimeout(() => { |
176 | | - tooltip.classList.remove('visible'); |
177 | | - localStorage.setItem('tooltip-shown', 'true'); |
178 | | - }, 5000); |
179 | | - }, 1000); |
180 | | - } |
181 | | -
|
182 | | - updateLiveTime(); |
183 | | - setInterval(updateLiveTime, 1000); |
184 | | -
|
185 | | - if ('serviceWorker' in navigator) { |
186 | | - navigator.serviceWorker |
187 | | - .register('/JavaEvolution-Learning-Growing-Mastering/assets/sw.js') |
188 | | - .then(() => console.log('Service Worker Registered')) |
189 | | - .catch(err => console.error('SW registration failed', err)); |
190 | | - } |
191 | | - }; |
192 | | - </script> |
193 | | -</head> |
194 | | -
|
195 | | -<body> |
196 | | -<!– Dark Mode & Timezone Controls –> |
197 | | -<div id="theme-time-container"> |
198 | | - <button class="dark-toggle" onclick="toggleDarkMode()" aria-label="Toggle Dark Mode"> |
199 | | - <i class="fas fa-moon"></i> |
200 | | - </button> |
201 | | - <div id="time-zone-wrapper"> |
202 | | - <button id="tz-toggle-btn" class="time-toggle" onclick="toggleTimezone()" aria-label="Toggle Timezone">IST</button> |
203 | | - <span id="live-time">Time: Loading...</span> |
204 | | - </div> |
205 | | -</div> |
206 | | -
|
207 | | -<!– Onboarding Tooltip –> |
208 | | -<div id="tooltip" class="tooltip"> |
209 | | - Single tap to hide sidebar, double tap to show |
210 | | -</div> |
211 | | -
|
212 | | -<!– Collapsible Sidebar –> |
213 | | -<div id="sidebar" class="sidebar"> |
214 | | - <a href="{{ site.baseurl }}/" class="sidebar-link active"> |
215 | | - <i class="fas fa-home"></i> Home |
216 | | - </a> |
217 | | - <a href="{{ site.baseurl }}/content" class="sidebar-link"> |
218 | | - <i class="fas fa-book"></i> All Contents |
219 | | - </a> |
220 | | - <a |
221 | | - href="https://github.com/Someshdiwan/JavaEvolution-Learning-Growing-Mastering" |
222 | | - target="_blank" |
223 | | - class="sidebar-link" |
224 | | - > |
225 | | - <i class="fab fa-github"></i> GitHub Repo |
226 | | - </a> |
227 | | -</div> |
228 | | -
|
229 | | -<!– Toggle Button (Fallback) –> |
230 | | -<button class="toggle-btn" onclick="toggleSidebar(!document.getElementById('sidebar').classList.contains('hidden'))" aria-label="Toggle Sidebar"> |
231 | | - <i class="fas fa-bars"></i> |
232 | | -</button> |
233 | | -
|
234 | | -<!– Main Content –> |
235 | | -<div class="wrapper"> |
236 | | - <div class="content"> |
237 | | - <div class="fade-in"> |
238 | | - {{ content }} |
239 | | - </div> |
240 | | - </div> |
241 | | -</div> |
242 | | -</body> |
243 | | -</html> |
244 | | ---> |
245 | | - |
246 | 1 | <!DOCTYPE html> |
247 | 2 | <html lang="en"> |
248 | 3 | <head> |
|
0 commit comments