-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
109 lines (93 loc) · 2.91 KB
/
index.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
104
105
106
107
108
const leftMenu = document.querySelectorAll('.left-menu');
const changeActiveItem = () => {
leftMenu.forEach(Item => {
Item.classList.remove('active');
});
};
leftMenu.forEach(Item => {
Item.addEventListener('click', () => {
changeActiveItem();
Item.classList.add('active');
if (Item.id !== "notification") {
document.querySelector('.popup').style.display = 'none';
} else {
document.querySelector('.popup').style.display = 'block';
document.querySelector('#notification .count').style.display = 'none';
}
});
});
/*---------------------------like--------------------------*/
/*
const like = document.getElementById("like");
function fun(){
document.getElementById("heart").style.display = "block";
document.getElementsByClassName("fa-regular fa-heart").style.display = "none";
}
like.addEventListener("dblclick",fun);
*/
/*
const like = document.getElementsByClassName(".like");
function fun() {
document.getElementsByClassName("fa-solid fa-heart").style.display = "block";
const icons = document.getElementsByClassName("fa-regular fa-heart");
for (const icon of icons) {
icon.style.display = "none";
}
}
like.addEventListener("dblclick", fun);
*/
/*
const likeElements = document.getElementsByClassName("like");
like=()=> {
const like = document.getElementsByClassName("fa-solid fa-heart");
for (const likes of like) {
likes.style.display = "block";
}
const regularHearts = document.getElementsByClassName("fa-regular fa-heart");
for (const regularHeart of regularHearts) {
regularHeart.style.display = "none";
}
}
// Loop through each "like" element and attach the event listener
for (const likeElement of likeElements) {
likeElement.addEventListener("dblclick", fun);
}
*/
/*
const like = document.querySelectorAll("like")
like=()=>{
document.getElementsByClassName("fa-solid fa-heart").style.display = "block";
document.getElementsByClassName("fa-regular fa-heart").style.display = "none";
}
like.addEventListener("dblclick",fun);
*/
/*
const likeElements = document.querySelectorAll(".like");
function likeHandler() {
const solidHearts = document.querySelectorAll(".fa-solid.fa-heart");
const regularHearts = document.querySelectorAll(".fa-regular.fa-heart");
solidHearts.forEach((solidHeart) => {
solidHeart.style.display = "block";
});
regularHearts.forEach((regularHeart) => {
regularHeart.style.display = "none";
});
}
likeElements.forEach((likeElement) => {
likeElement.addEventListener("dblclick", likeHandler);
});
*/
const like = document.querySelectorAll(".like");
action = () =>{
const solid = document.querySelectorAll(".fa-solid.fa-heart");
const regular = document.querySelectorAll(".fa-regular.fa-heart");
solid.forEach((solids)=>{
solids.style.display = "block";
});
regular.forEach((regulars)=>{
regulars.style.display = "none";
});
}
like.forEach((likes)=>{
likes.addEventListener("dblclick",action);
});