This repository was archived by the owner on Aug 25, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
103 lines (84 loc) · 2.94 KB
/
script.js
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
document.addEventListener("DOMContentLoaded", function () {
// Add your JavaScript code that interacts with the DOM here
});
// Clarity tracking code
(function (c, l, a, r, i, t, y) {
c[a] = c[a] || function () {
(c[a].q = c[a].q || []).push(arguments)
};
t = l.createElement(r);
t.async = 1;
t.src = "https://www.clarity.ms/tag/" + i;
y = l.getElementsByTagName(r)[0];
y.parentNode.insertBefore(t, y);
})(window, document, "clarity", "script", "jl9x43lm0m");
// FAQPage JSON-LD script
// Search bar JavaScript
const searchInput = document.getElementById("search");
const teamMembers = document.querySelectorAll("#u li");
searchInput.addEventListener("input", () => {
const searchTerm = searchInput.value.toLowerCase();
for (const member of teamMembers) {
const memberName = member.textContent.toLowerCase();
if (memberName.includes(searchTerm)) {
member.style.display = "block";
} else {
member.style.display = "none";
}
}
});
// Function to toggle the theme
function toggleTheme() {
const body = document.body;
const themeIcon = document.getElementById("theme-icon");
if (body.classList.contains("dark-theme")) {
body.classList.remove("dark-theme");
themeIcon.innerText = "☀️ Light Mode";
} else {
body.classList.add("dark-theme");
themeIcon.innerText = "🌙 Dark Mode";
}
}
function toggleTheme2() {
const body = document.body;
const themeIcon = document.getElementById("theme-icon");
if (body.classList.contains("dark-theme")) {
body.classList.remove("dark-theme");
themeIcon.innerText = "☀️ Light Mode";
} else {
body.classList.add("dark-theme");
themeIcon.innerText = "🌙 Dark Mode automatically enabled. Click to switch to Light Mode.";
}
}
const darkModeMediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
// Function to run when dark mode is detected
function runFunctionIfDarkMode() {
if (darkModeMediaQuery.matches) {
toggleTheme2(); // Call your existing toggleTheme function
}
}
// Initial call to check if dark mode is set
runFunctionIfDarkMode();
// Listen for changes in the user's color scheme preference
darkModeMediaQuery.addListener(runFunctionIfDarkMode);
// Function to show the cookie consent popup
function showPopup() {
const popup = document.getElementById("cookie-popup");
popup.style.display = "block";
}
// Function to close the cookie consent popup
function closePopup() {
const popup = document.getElementById("cookie-popup");
popup.style.display = "none";
}
// Check if the user has previously accepted the cookies
if (!document.cookie.includes("cookieConsent=true")) {
showPopup();
}
// Function to set a cookie when the user clicks "OK"
function setCookie() {
document.cookie = "cookieConsent=true; expires=Fri, 31 Dec 9999 23:59:59 GMT; path=/";
closePopup();
}
// Attach the setCookie function to the "OK" button's click event
document.getElementById("ok-button").addEventListener("click", setCookie);