-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscript.js
More file actions
48 lines (42 loc) · 1.33 KB
/
script.js
File metadata and controls
48 lines (42 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Check and apply saved theme preference on page load
document.addEventListener('DOMContentLoaded', () => {
const savedTheme = localStorage.getItem('theme');
if (savedTheme === 'dark') {
document.body.classList.add('dark-mode');
}
});
// Theme toggle functionality
document.getElementById('theme-toggle').addEventListener('click', function() {
document.body.classList.toggle('dark-mode');
// Save the current theme preference
if (document.body.classList.contains('dark-mode')) {
localStorage.setItem('theme', 'dark');
} else {
localStorage.setItem('theme', 'light');
}
});
// Smooth scrolling for internal links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function(e) {
e.preventDefault();
document.querySelector(this.getAttribute('href')).scrollIntoView({
behavior: 'smooth'
});
});
});
function changelog() {
const modal = document.getElementById('changelog-modal');
modal.style.display = 'flex';
}
function closeChangelog() {
const modal = document.getElementById('changelog-modal');
modal.style.display = 'none';
}
function extension() {
const modal = document.getElementById('extension-modal');
modal.style.display = 'flex';
}
function closeExtension() {
const modal = document.getElementById('extension-modal');
modal.style.display = 'none';
}