var ia=isandroid(); var loc=""; var androidversion=""; var synth; var utterance=''; var synthtext=''; var synthlen=0; var synthVolume=1; var synthFun=null; var voices; function isandroid(){ try { if(typeof (AndroidFunction.fromjs) == 'function'){ //androidversion=AndroidFunction.fromjs("MINDYVERSION","","",true)+AndroidFunction.fromjs("ANDROIDVERSION","","",true); return(true); }} catch(err) { return(false); } return(false); } function general_vibrate(n){ if(!ia)navigator.vibrate(n); else AndroidFunction.fromjs('VIBRATE',n,"",false); } function gpspermissions(){ var n=0; if(''=='MINDYEYE')return(7); if(ia){ var androidgps1=AndroidFunction.fromjs("ISPERMISSION","android.permission.ACCESS_COARSE_LOCATION","",true); if(androidgps1=="OK")n=n+1; var androidgps2=AndroidFunction.fromjs("ISPERMISSION","android.permission.ACCESS_FINE_LOCATION","",true); if(androidgps2=="OK")n=n+2; var androidgps3=AndroidFunction.fromjs("ISPERMISSION","android.permission.ACCESS_BACKGROUND_LOCATION","",true); if(androidgps3=="OK")n=n+4; } return(n); } function getLocation() { loc=""; if(!ia){ if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(showPosition); } else { alert("Geolocation no soportada por el navegador."); } }else{ var androidgps=AndroidFunction.fromjs("ISPERMISSION","android.permission.ACCESS_COARSE_LOCATION","",true); var androidgps2=AndroidFunction.fromjs("ISPERMISSION","android.permission.ACCESS_FINE_LOCATION","",true); var androidgps3=AndroidFunction.fromjs("ISPERMISSION","android.permission.ACCESS_BACKGROUND_LOCATION","",true); if(androidgps!="OK"||androidgps2!="OK"||androidgps3!="OK"){ AndroidFunction.fromjs("INIGPS","","",false); return; } var s=AndroidFunction.fromjs("GPS","","",true); var t=AndroidFunction.fromjs("GETINSTRING",s,"*lat:**lon:***",true)+','+AndroidFunction.fromjs("GETINSTRING",s,"*lon:**pro:***",true); t=t.replace('*',''); t=t.replace('*',''); loc=t; } } function showPosition(position) { loc=position.coords.longitude+"_"+position.coords.latitude+"_pc"; } function openweb(url){ if(ia){ //alert("android"+url); AndroidFunction.fromjs("WEBURL",url,""); }else{ //alert("open"+url); window.open(url,'_self'); } } function speechini(){ if(!ia){ synth = window.speechSynthesis; voices=speechSynthesis.getVoices(); } } function speechread(lang,id){ if(ia){ var l=AndroidFunction.fromjs('SPEECHTOTEXT','','',true); return(l); } if(window.SpeechRecognition||window.webkitSpeechRecognition){ reconoce=new(window.SpeechRecognition||window.webkitSpeechRecognition); reconoce.lang=lang; reconoce.onresult=function(event){ document.getElementById(id).value+=(event.results[0][0].transcript+' '); } reconoce.start(); }else alert('Voz a texto no soportado'); return(""); } function speechstop(){ if(!ia) synth.cancel(); } function speechwrite(lang,id,fun){ if(ia){ AndroidFunction.fromjs('SPEAK',id,lang,true); return(true); } synthtext=id; synthlen=0; synth = window.speechSynthesis; synthFun=fun; speechplay(lang,synthtext); return(true); } function getvoices(){ if(ia){ var v=AndroidFunction.fromjs('SPEAK_VOICES','','',true); return(v.split(',')); } voices=speechSynthesis.getVoices(); return(voices); } function speechplay(lang,txt){ var s=''; var i=-1; voices=speechSynthesis.getVoices(); for(var a=0;a-1){ do{ codestart1=s.indexOf(code,codestart+1); if(codestart1>0&&codestart10&&codestart1