1
Fork 0

add shorts search support :3

This commit is contained in:
Ashley 2023-12-13 05:21:46 +00:00
parent cd1b480770
commit 2b67fb5274

View file

@ -767,7 +767,7 @@ white-space: nowrap;text-decoration: none;" href="/feeds/videos.xml?channel_id=<
<% } %> <% } %>
</div> </div>
<input type="text" id="search" placeholder="Search vids :3" style="margin-top: 2em;height: 1em;color: #fff;background: #111;border-radius: 1em;padding: 7px;margin-left: auto;margin-right: 1em;"> </div> <input type="text" id="search" placeholder="Search :3" style="margin-top: 2em;height: 1em;color: #fff;background: #111;border-radius: 1em;padding: 7px;margin-left: auto;margin-right: 1em;"> </div>
<% } %> <% } %>
@ -1375,21 +1375,39 @@ if (userID) {
} }
document.getElementById('search').addEventListener('keyup', function () { document.getElementById('search').addEventListener('keyup', function () {
var value = this.value.toLowerCase(); var value = this.value.toLowerCase();
var videos = document.querySelectorAll('.video'); var videos = document.querySelectorAll('.video, .shorts-video');
videos.forEach(function (video) { videos.forEach(function (video) {
var text = video.textContent.toLowerCase(); var text = video.textContent.toLowerCase();
if (text.indexOf(value) > -1) { if (text.indexOf(value) > -1) {
video.style.visibility = 'visible'; video.style.visibility = 'visible';
video.style.display = 'grid'; video.style.display = 'grid';
} else { } else {
video.style.visibility = 'hidden'; video.style.visibility = 'hidden';
video.style.display = 'none'; video.style.display = 'none';
} }
}); });
}); });
document.getElementById('search').addEventListener('keyup', function () {
var value = this.value.toLowerCase();
var videos = document.querySelectorAll('.community-content');
videos.forEach(function (video) {
var text = video.textContent.toLowerCase();
if (text.indexOf(value) > -1) {
video.style.visibility = 'visible';
video.style.display = 'block';
} else {
video.style.visibility = 'hidden';
video.style.display = 'none';
}
});
});
// @license-end // @license-end
</script> </script>
</body> </body>