JAYASWAROOP commited on
Commit
3b97353
·
1 Parent(s): 5b6ad42

Update audio.js

Browse files
Files changed (1) hide show
  1. audio.js +16 -23
audio.js CHANGED
@@ -1,28 +1,21 @@
1
- document.addEventListener('DOMContentLoaded', function () {
2
- const movieContainers = document.querySelectorAll('.movie');
 
 
 
3
 
4
- movieContainers.forEach(function (container) {
5
- container.addEventListener('click', function () {
6
- const audio = this.querySelector('audio');
7
 
8
- // Pause all other audio elements except the one clicked
9
- movieContainers.forEach(function (otherContainer) {
10
- const otherAudio = otherContainer.querySelector('audio');
11
- if (otherAudio !== audio && !otherAudio.paused) {
12
- otherAudio.pause();
13
- otherAudio.classList.add('d-none'); // Hide other audio elements
14
- }
15
- });
16
 
17
- // If audio is paused or not already playing, play it
18
- if (audio.paused) {
19
- audio.play();
20
- } else {
21
- audio.pause();
22
- }
23
-
24
- // Toggle the display of the audio element
25
- audio.classList.toggle('d-none');
26
  });
27
- });
28
  });
 
1
+ document.addEventListener('DOMContentLoaded', function() {
2
+ const searchBar = document.getElementById('searchBar');
3
+ const songNames = document.querySelectorAll('h1[style="font-size: 28px;"]');
4
+ const descriptions = document.querySelectorAll('p[style="font-size: 20px;"]');
5
+
6
 
7
+ searchBar.addEventListener('input', function() {
8
+ const searchText = searchBar.value.toLowerCase();
 
9
 
10
+ songNames.forEach((song, index) => {
11
+ const songName = song.textContent.toLowerCase();
12
+ const description = descriptions[index].textContent.toLowerCase();
 
 
 
 
 
13
 
14
+ if (songName.includes(searchText) || description.includes(searchText)) {
15
+ song.parentElement.parentElement.style.display = 'block';
16
+ } else {
17
+ song.parentElement.parentElement.style.display = 'none';
18
+ }
19
+ });
 
 
 
20
  });
 
21
  });