forked from Gyanthakur/Dev_Profiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
48 lines (43 loc) · 1.67 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
document.addEventListener("DOMContentLoaded", function() {
const searchInput = document.getElementById('searchInput');
const profiles = document.querySelectorAll('.profile');
const date = document.getElementById('dates')
let currentDate = new Date()
let currentYear = currentDate.getFullYear()
date.innerHTML = currentYear
if (searchInput) {
searchInput.addEventListener('input', filterProfiles);
}
function filterProfiles() {
const query = searchInput.value.toLowerCase();
profiles.forEach((profile) => {
const name = profile.querySelector('.name').textContent.toLowerCase();
const skills = Array.from(profile.querySelectorAll('.skills .skill'))
.map(skill => skill.textContent.toLowerCase());
if (name.includes(query) || skills.some(skill => skill.includes(query))) {
profile.style.display = 'block';
} else {
profile.style.display = 'none';
}
});
}
const darkMode = document.querySelector(".dark-btn");
var icon=document.getElementById("icon");
darkMode.addEventListener("click", () => {
document.body.classList.toggle("light-background");
if(document.body.classList.contains("light-background")){
icon.src="Sun.png";
}else{
icon.src="Moon.png";
}
darkMode.classList.toggle("icon-position")
darkMode.classList.toggle("light-background");
darkMode.classList.toggle("icon-color")
document.querySelector(".title").classList.toggle("text-color");
document.querySelector("footer").classList.toggle("text-color");
const buttons = document.querySelectorAll('.add');
buttons.forEach(button => {
button.classList.toggle('bg-color');
});
});
});