#31: Add a first search only captions support

This commit is contained in:
2023-02-14 00:59:37 +01:00
parent 8d20327b67
commit 34c0d03587
2 changed files with 8 additions and 2 deletions

View File

@@ -13,7 +13,8 @@ Access raw data with: <?php echoUrl('channels/'); ?>.
<form id="form">
<input type="text" autofocus id="search" pattern="[A-Za-z0-9-_ ]+" placeholder="Your [A-Za-z0-9-_ ]+ search"></input>
<input type="submit" value="Search">
<input type="submit" id="search" value="Search">
<input type="submit" id="search-only-captions" value="Search only captions">
</form>
<ul id="channels">
@@ -64,7 +65,7 @@ Access raw data with: <?php echoUrl('channels/'); ?>.
function search(event) {
// We don't want to refresh the webpage which is the default behavior.
event.preventDefault();
const query = document.getElementById('search').value;
const query = event.submitter.id + ' ' + document.getElementById('search').value;
if (firstRun) {
firstRun = false;
conn = new WebSocket('wss://crawler.yt.lemnoslife.com/websocket');