PageSourceSearch

https://advancedreasoningforum.org/js/components/voice-search.js

js advancedreasoningforum.org collected 2026-10-07 11:38:48 UTC 1,380 bytes, 53 lines download raw bytes

1// Reconocimiento de voz para ayuda al buscador.
2
3var speechRecognition = window.webkitSpeechRecognition;
4var recognition = new speechRecognition();
5var textbox = $(".buscador-text");
6var content = '';
7
8recognition.continuous = false;
9
10recognition.onstart = function() { // Voice Recognition is On
11    content = '';
12}
13
14recognition.onspeechend = function() { // No Activity
15}
16
17recognition.onerror = function() { // On error (Try Again ?)
18}
19
20recognition.onresult = function(event) {
21
22    var current = event.resultIndex;
23    var transcript = event.results[current][0].transcript;
24
25    console.log('Result. ' + transcript);
26
27    content += transcript;
28    content = content.replace('buscar', '');
29    content = content.replace('notas de ', '');
30    content = content.replace('noticias de ', '');
31    content = content.replace('artículos de ', '');
32    content = content.replace('articulos de ', '');
33
34    h = $(".search-speak textarea").val();
35    $(".search-speak textarea").val(h + transcript);
36
37    textbox.val(content);
38    $("[name='buscadortop']").submit();
39}
40
41$(".buscador-text").dblclick(function() {
42    $(".search-speak").show();
43    recognition.start();
44});
45
46$("[data-search]").click(function(event) {
47    $(".search-speak").addClass('open');
48    recognition.start();
49});
50
51$(".search-speak .icon-cerrar").click(function() {
52    $(".search-speak").removeClass('open');
53});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.