-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
38 lines (33 loc) · 1.2 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// speek button
function speek() {
var recognition = new webkitSpeechRecognition();
recognition.lang = "en-GB" || "hn-GB";
recognition.onresult = function (e) {
console.log(e);
var content = e.results[0][0].transcript;
console.log(content);
document.getElementById("search").value = content;
// const utterance = new SpeechSynthesisUtterance(content);
// speechSynthesis.speak(utterance);
};
// recognition.start();
}
// searching button
const search = () => {
const searchbox = document.getElementById("search").value.toUpperCase();
const videogrid = document.getElementById("video-grid-title");
const videopre = document.querySelectorAll(".video-prewiew");
const videotitle = document.getElementsByClassName("video-title");
for (let i = 0; i < videotitle.length; i++) {
let match = videopre[i].getElementsByClassName("video-title")[0];
if (match) {
let textvalue = match.textContent || match.innerHTML;
if (textvalue.toUpperCase().indexOf(searchbox) > -1) {
videopre[i].style.display = "";
}
else {
videopre[i].style.display = "none";
}
}
}
}