Spaces:
Running
Running
Commit
•
deacdff
1
Parent(s):
b22feca
Update audio.js
Browse files
audio.js
CHANGED
@@ -1,46 +1,41 @@
|
|
1 |
document.addEventListener('DOMContentLoaded', function () {
|
2 |
-
|
3 |
-
const
|
4 |
-
const descriptions = document.querySelectorAll('p[style="font-size: 20px;"]');
|
5 |
-
const movieContainers = document.querySelectorAll('.movie');
|
6 |
|
7 |
-
|
8 |
-
|
9 |
-
const audio = this.querySelector('audio');
|
10 |
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
if (otherAudio !== audio && !otherAudio.paused) {
|
15 |
-
otherAudio.pause();
|
16 |
-
otherAudio.classList.add('d-none');
|
17 |
-
}
|
18 |
-
});
|
19 |
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
// Toggle the display of the audio element
|
28 |
-
audio.classList.toggle('d-none');
|
29 |
});
|
30 |
-
});
|
31 |
|
32 |
-
|
33 |
-
|
|
|
34 |
|
35 |
-
|
36 |
-
|
37 |
-
|
|
|
|
|
|
|
|
|
38 |
|
39 |
-
if (
|
40 |
-
|
41 |
} else {
|
42 |
-
|
43 |
}
|
|
|
|
|
44 |
});
|
45 |
});
|
46 |
});
|
|
|
1 |
document.addEventListener('DOMContentLoaded', function () {
|
2 |
+
const searchBar = document.getElementById('searchBar');
|
3 |
+
const movieContainers = document.querySelectorAll('.movie');
|
|
|
|
|
4 |
|
5 |
+
searchBar.addEventListener('input', function () {
|
6 |
+
const searchText = searchBar.value.toLowerCase().trim();
|
|
|
7 |
|
8 |
+
movieContainers.forEach(function (container) {
|
9 |
+
const title = container.querySelector('.title').textContent.toLowerCase();
|
10 |
+
const description = container.querySelector('.description').textContent.toLowerCase();
|
|
|
|
|
|
|
|
|
|
|
11 |
|
12 |
+
if (title.includes(searchText) || description.includes(searchText)) {
|
13 |
+
container.style.display = 'block';
|
14 |
+
} else {
|
15 |
+
container.style.display = 'none';
|
16 |
+
}
|
17 |
+
});
|
|
|
|
|
|
|
18 |
});
|
|
|
19 |
|
20 |
+
movieContainers.forEach(function (container) {
|
21 |
+
container.addEventListener('click', function () {
|
22 |
+
const audio = this.querySelector('audio');
|
23 |
|
24 |
+
movieContainers.forEach(function (otherContainer) {
|
25 |
+
const otherAudio = otherContainer.querySelector('audio');
|
26 |
+
if (otherAudio !== audio && !otherAudio.paused) {
|
27 |
+
otherAudio.pause();
|
28 |
+
otherAudio.classList.add('d-none');
|
29 |
+
}
|
30 |
+
});
|
31 |
|
32 |
+
if (audio.paused) {
|
33 |
+
audio.play();
|
34 |
} else {
|
35 |
+
audio.pause();
|
36 |
}
|
37 |
+
|
38 |
+
audio.classList.toggle('d-none');
|
39 |
});
|
40 |
});
|
41 |
});
|