Skip to content
This repository was archived by the owner on Nov 27, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

</head>
<body>
<script src="js/dark-mode.js"></script>
<script src="theme-switcher.js"></script>
<div class="mx-auto" style="width: 80%; margin: 5%">

<h1>SOC Programs</h1>
Expand All @@ -32,6 +34,7 @@ <h1>SOC Programs</h1>
</thead>
</tr>
<tr>
<button id="theme-toggle-button" onclick="switchMode()">Dark Mode</button>
<td><a href="https://developers.google.com/season-of-docs/">Season of Docs</a></td>
<td>Yes</td>
<td><a href="https://developers.google.com/season-of-docs/docs/timeline">timeline</a></td>
Expand Down
21 changes: 21 additions & 0 deletions js/dark-mode.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//Switch to dark mode and update dark mode const
function switchMode() {
document.body.classList.toggle('dark');
const isDarkMode = document.body.classList.contains('dark');
document.cookie = `darkMode=${isDarkMode ? 1 : 0}; expires=Fri, 31 Dec 9999 23:59:59 GMT; path=/`;
}

// Function to get the value of a cookie by name
function getCookie(name) {
const value = `; ${document.cookie}`;
const parts = value.split(`; ${name}=`);
if (parts.length === 2) return parts.pop().split(';').shift();
}

// Check for the dark mode preference in the cookie
const darkModeCookie = getCookie('darkMode');

// Apply dark mode if the cookie value is '1' (for dark mode)
if (darkModeCookie === '1') {
document.body.classList.add('dark');
}
24 changes: 24 additions & 0 deletions vend/bootstrap/css/bootstrap.min.css

Large diffs are not rendered by default.