Skip to content

Commit fb1126a

Browse files
committed
Final Updated
Time: 5:00 AM Date: 7-04-2025 Signed-off-by: Someshdiwan <[email protected]>
1 parent df5a17c commit fb1126a

File tree

1 file changed

+18
-36
lines changed

1 file changed

+18
-36
lines changed

site/_layouts/default.html

Lines changed: 18 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,22 @@
66
<title>{{ page.title }}</title>
77
<link rel="stylesheet" href="{{ "/assets/style.css" | relative_url }}" />
88
<script>
9+
// Sidebar Toggle Function
910
function toggleSidebar() {
1011
const sidebar = document.getElementById("sidebar");
1112
sidebar.classList.toggle("hidden");
1213
}
1314

15+
// Dark Mode Toggle Function
1416
const toggleDarkMode = () => {
1517
document.body.classList.toggle("dark-mode");
16-
localStorage.setItem("dark-mode", document.body.classList.contains("dark-mode"));
18+
localStorage.setItem(
19+
"dark-mode",
20+
document.body.classList.contains("dark-mode")
21+
);
1722
};
1823

24+
// Handle Sidebar Visibility Based on Screen Size
1925
function handleSidebarVisibility() {
2026
const sidebar = document.getElementById("sidebar");
2127
if (window.matchMedia("(max-width: 768px)").matches) {
@@ -25,55 +31,31 @@
2531
}
2632
}
2733

28-
function updateTime() {
29-
const now = new Date();
30-
let hours = now.getHours();
31-
const minutes = now.getMinutes().toString().padStart(2, "0");
32-
const seconds = now.getSeconds().toString().padStart(2, "0");
33-
const ampm = hours >= 12 ? "PM" : "AM";
34-
hours = hours % 12 || 12;
35-
const timeString = `${hours}:${minutes}:${seconds} ${ampm}`;
36-
37-
const offset = now.getTimezoneOffset();
38-
const offsetHours = Math.floor(Math.abs(offset) / 60);
39-
const offsetMinutes = Math.abs(offset) % 60;
40-
const offsetSign = offset > 0 ? "-" : "+";
41-
const offsetString = `GMT${offsetSign}${offsetHours.toString().padStart(2, "0")}:${offsetMinutes.toString().padStart(2, "0")}`;
42-
43-
const fullTimeString = `⏰ Time: ${timeString} ${offsetString}`;
44-
document.getElementById("time-display").textContent = fullTimeString;
45-
}
46-
34+
// Initialize on Load
4735
window.onload = () => {
4836
handleSidebarVisibility();
4937
if (localStorage.getItem("dark-mode") === "true") {
5038
document.body.classList.add("dark-mode");
5139
}
52-
updateTime();
53-
setInterval(updateTime, 1000);
54-
setTimeout(() => {
55-
const sidebar = document.getElementById("sidebar");
56-
if (!sidebar.classList.contains("hidden")) {
57-
sidebar.classList.add("hidden");
58-
}
59-
}, 10000);
6040
};
6141

42+
// Update on Resize
6243
window.addEventListener("resize", handleSidebarVisibility);
6344
</script>
6445
</head>
6546
<body>
47+
<!-- Dark Mode Toggle Button -->
48+
<button onclick="toggleDarkMode()" class="dark-toggle">🌓</button>
49+
6650
<div class="wrapper">
67-
<div id="sidebar" class="sidebar">
68-
{% include nav.html %}
69-
</div>
51+
<!-- Sidebar Navigation -->
52+
<div id="sidebar" class="sidebar">{% include nav.html %}</div>
53+
54+
<!-- Content Area -->
7055
<div class="content">
71-
<div id="time-display"></div>
56+
<!-- Sidebar Toggle Button -->
7257
<button class="toggle-btn" onclick="toggleSidebar()"></button>
73-
<button class="toggle-btn" id="dark-mode-toggle" onclick="toggleDarkMode()">🌓</button>
74-
<div class="fade-in">
75-
{{ content }}
76-
</div>
58+
<div class="fade-in">{{ content }}</div>
7759
</div>
7860
</div>
7961
</body>

0 commit comments

Comments
 (0)