Skip to content
Snippets Groups Projects
Commit 8fc142d0 authored by Lucio Zambon's avatar Lucio Zambon
Browse files

Update talk.js

parent d314cf84
No related branches found
No related tags found
No related merge requests found
......@@ -19,7 +19,7 @@
const a = document.location.search.split('background=')[1].split('&')[0];
console.log(a);
// $('body').css('background-color', +a > 0? '#'+a: a);
$('#search').hide(); $('#open').hide();
$('#search').hide(); $('#open').hide(); $('#tree').hide(); $('#chart').hide();
}
});
}
......@@ -62,14 +62,14 @@
showLog('started');
document.getElementById('micstart').style.display = 'inline';
document.getElementById('micstop').style.display = 'none';
$('#search').hide();
$('#open').hide();
console.log($('#search'));
if (mode=='') {$('#search').hide(); $('#open').hide(); $('#tree').hide(); $('#chart').hide();}
// console.log($('#search'));
}
function naClick() {
$("#micstart").show();
$("#micna").hide();
$("#miclabel").hide();
$('#search').hide(); $('#open').hide(); $('#tree').hide(); $('#chart').hide();
if (window.parent && window.parent.document.getElementById("talk")) {
window.parent.document.getElementById("talk").style.height = "250px";
window.parent.document.getElementById("talk").style.position = "absolute";
......@@ -153,11 +153,10 @@
let txt = transcript.toLowerCase();
if (txt.length>0) {
let tok = txt.split(' ')[0];
console.log('tok', tok);
showLog('tok: '+tok+', mode: '+mode+', ujindex: '+locale[lang].ujive.indexOf(tok));
if (locale[lang].open.indexOf(tok)>-1) {
mode = 'open';
$('#search').hide();
$('#open').show();
$('#search').hide(); $('#open').show(); $('#tree').hide(); $('#chart').hide();
txt = txt.replace(tok, '').replace(' ', '');
}
if (mode=='open' && txt.length>0) {
......@@ -179,8 +178,7 @@
showLog('window.openData1');
showLog(window.openData);
mode = 'openTable';
$('#search').hide();
$('#open').show();
$('#search').hide(); $('#open').show(); $('#tree').hide(); $('#chart').hide();
txt = '';
});
}
......@@ -209,13 +207,12 @@
.then((rlocale) => {showLog(rlocale);});*/
}
mode = '';
$('#search').hide();
$('#open').hide();
$('#search').hide(); $('#open').hide(); $('#tree').hide(); $('#chart').hide();
$('#openTable').html('');
}
if (locale[lang].search.indexOf(tok)>-1) {
mode = 'search';
$('#search').show(); $('#open').hide();
$('#search').show(); $('#open').hide(); $('#tree').hide(); $('#chart').hide();
// txt = txt.replace(tok+' ', '').replace('ing', 'inj').replace('inch', 'inj').split(' ').join('_').split('.').join('_').toUpperCase();
txt = txt.replace(tok+' ', '').split(' ').join('_').split('.').join('_').split('-').join('_').toUpperCase();
const token = document.location.search.indexOf('?d=')>-1? '&token='+document.location.search.split('?d=')[1].split('&')[0]: '';
......@@ -230,19 +227,26 @@
// mode = '';
// $('#search').hide(); $('#open').hide();
}
if (mode=='ujive') {
showLog('ujive: '+tok);
if (mode=='ujive' && locale[lang].ujive.indexOf(tok)==-1) {
if (locale[lang].number == tok) tok = txt.split(' ')[1];
showLog('ujive1: '+tok+', tok: '+tok);
if (typeof locale[lang].num[tok] !== 'undefined') tok = locale[lang].num[tok];
if (!isNaN(tok)) {ancestor.push(tok); tok = 'n'+ancestor.join('_');}
if (locale[lang].back.indexOf(tok)>-1) ancestor.pop();
if (locale[lang].back.indexOf(tok)>-1) {ancestor.pop(); showLog('ujive2b: '+tok+', tok: n'+ancestor.join('_')); return;}
showLog('ujive2: '+tok+', tok: '+tok);
if (locale[lang].up.indexOf(tok)>-1) tok = 'up';
if (locale[lang].down.indexOf(tok)>-1) tok = 'down';
showLog('ujive3: '+tok+', tok: '+tok);
if (locale[lang].eGiga2m.indexOf(tok)>-1) tok = 'eGiga2m';
// var iframe = $('iframe'); $('[tokenid=' + token + ']', iframe.contents()).
showLog('ujive4: '+tok+', tok: '+tok);
const token = document.location.search.indexOf('?d=')>-1? '&token='+document.location.search.split('?d=')[1].split('&')[0]: '';
const snd = './talk.php?ctree='+tok+token;
showLog('ujive: '+tok+', snd: '+snd);
fetch(snd).then((response) => {return response.json();}).then((rlocale) => {showLog(rlocale); alert(rlocale);});
mode = '';
$('#search').hide(); $('#open').hide();
}
if (locale[lang].ujive.indexOf(tok)>-1) {
$('#search').hide(); $('#open').hide(); $('#tree').show(); $('#chart').hide();
const token = document.location.search.indexOf('token=')>-1? '&token='+document.location.search.split('token=')[1].split('&')[0]: (document.location.search.indexOf('?d=')>-1? '&token='+document.location.search.split('?d=')[1].split('&')[0]: '');
const snd = './talk.php?search=ujive'+token+"&lang="+lang;
console.log('ujive');
......@@ -261,7 +265,7 @@
const snd = './talk.php?list='+tok+token;
fetch(snd).then((response) => {return response.json();}).then((rlocale) => {showLog(rlocale); alert(rlocale);});
mode = '';
$('#search').hide(); $('#open').hide();
$('#search').hide(); $('#open').hide(); $('#tree').hide(); $('#chart').hide();
}
showLog('mode: '+mode+', tok: '+tok);
}
......@@ -340,7 +344,7 @@
for (let i = event.resultIndex, len = event.results.length; i < len; i++) {
let transcript = event.results[i][0].transcript;
// const dt = + new Time() - t0;
if (event.results[i][0].transcript.length) showLog(' mode '+mode+', i: '+i+', transcripts: '+event.results[i][0].transcript+(event.results[i][1]? ', transcripts: '+event.results[i][1].transcript:'')+'\n');
if (event.results[i][0].transcript.length) showLog(' mode '+mode+', i: '+i+', transcripts: '+event.results[i][0].transcript+(event.results[i][1]? ', transcripts: '+event.results[i][1].transcript:'')+(event.results[i].isFinal? ', final':'')+'\n');
if (event.results[i].isFinal) {
detectTranscript(transcript.toLowerCase());
var meno = transcript.toLowerCase().indexOf('meno ');
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment