Spaces:
Running
Running
Commit
·
3b97353
1
Parent(s):
5b6ad42
Update audio.js
Browse files
audio.js
CHANGED
@@ -1,28 +1,21 @@
|
|
1 |
-
document.addEventListener('DOMContentLoaded', function
|
2 |
-
|
|
|
|
|
|
|
3 |
|
4 |
-
|
5 |
-
|
6 |
-
const audio = this.querySelector('audio');
|
7 |
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
if (otherAudio !== audio && !otherAudio.paused) {
|
12 |
-
otherAudio.pause();
|
13 |
-
otherAudio.classList.add('d-none'); // Hide other audio elements
|
14 |
-
}
|
15 |
-
});
|
16 |
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
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 |
});
|