forked from NageshMandal/Engineering-Notes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
58 lines (48 loc) · 1.82 KB
/
app.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
const mike_btn = document.querySelector('#mike-button')
window.SpeechRecognition= window.SpeechRecognition || window.webkitSpeechRecognition
const recognition= new SpeechRecognition()
recognition.addEventListener('result',(e)=>{
let text = Array.from(e.results)
.map(result => result[0])
.map(result => result.transcript)
.join('');
console.log(typeof(text))
text = text.toLowerCase()
console.log(text)
if(text.includes("open computer science")){
window.location.replace('branch/cs.html');
}
if(text.includes("open ece") || text.includes("open electronics and communication")){
window.location.replace('branch/ece.html');
}
if(text.includes("open ee") ||text.includes("open electrical engineering")){
window.location.replace('branch/ee.html');
}
if(text.includes("open mechanical")){
window.location.replace('branch/ME.html');
}
if(text.includes("open civil")){
window.location.replace('branch/CE.html');
}
})
mike_btn.addEventListener('click',()=>{
recognition.start()
console.log('started')
})
const syllabusSearch = document.getElementById('s-input');
const cards = document.querySelectorAll('.project-card');
syllabusSearch.addEventListener('input', function() {
const searchTerm = this.value.trim().toLowerCase();
searchProjects(searchTerm);
});
function searchProjects(searchTerm) {
for (const card of cards) {
const collegeName = card.querySelector('.project-card-title').textContent.trim().toLowerCase();
const subjectName = card.querySelector('.project-card-author.s-subject').textContent.trim().toLowerCase();
if (collegeName.includes(searchTerm) || subjectName.includes(searchTerm)) {
card.style.display = 'block';
} else {
card.style.display = 'none';
}
}
}