Commit c1ceeda0 authored by nextime's avatar nextime

use playTTS when installing firefox app

parent da7820e9
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -74,6 +74,11 @@ window.matchMedia=window.matchMedia||function(a){"use strict";var c,d=a.document
(function(b){var a=function(f){var c={toolbar:null,scroller:null},d=function(h){if(("ontouchstart" in window)&&typeof h==="function"){h.call()}},e={listen:function(){if(c.scroller){c.scroller.addEventListener("touchend",e._touchEnd);c.scroller.addEventListener("scroll",e._endScroll)}if(c.toolbar){c.toolbar.addEventListener("touchmove",e._touchMove)}e._touchEnd();e._endScroll()},noListen:function(){if(c.scroller){c.scroller.removeEventListener("touchend",e._touchEnd);c.scroller.removeEventListener("scroll",e._endScroll)}if(c.toolbar){c.toolbar.removeEventListener("touchmove",e._touchMove)}},_touchMove:function(h){h.preventDefault()},_touchEnd:function(){c.listenForScroll=true},_endScroll:function(){if(c.listenForScroll){var h=parseInt(b.getComputedStyle(c.scroller).height,10);if((c.scroller.scrollTop+h)===h){c.scroller.scrollTop=1;c.listenForScroll=false}else{if(c.scroller.scrollTop+h===c.scroller.scrollHeight){c.scroller.scrollTop=c.scroller.scrollTop-1}}}else{c.listenForScroll=false}}},g=function(h){d(function(){c=h;e.listen()})};this.on=function(){d(function(){e.noListen();e.listen()})};this.off=function(){d(e.noListen)};g(f)};if((typeof module!=="undefined")&&module.exports){module.exports=a}if(typeof ender==="undefined"){this.AppScroll=a}if((typeof define==="function")&&define.amd){define("AppScroll",[],function(){return a})}}).call(this,window);(function(global){function Map(){this.data={}}Map.prototype={get:function(key){return this.data[key+"~"]},set:function(key,value){this.data[key+"~"]=value},"delete":function(key){delete this.data[key+"~"]}};function EventTarget(){this.listeners=new Map()}function throwError(e){setTimeout(function(){throw e},0)}EventTarget.prototype={dispatchEvent:function(event){event.target=this;var type=String(event.type);var listeners=this.listeners;var typeListeners=listeners.get(type);if(!typeListeners){return}var length=typeListeners.length;var i=-1;var listener=null;while(++i<length){listener=typeListeners[i];try{listener.call(this,event)}catch(e){throwError(e)}}},addEventListener:function(type,callback){type=String(type);var listeners=this.listeners;var typeListeners=listeners.get(type);if(!typeListeners){typeListeners=[];listeners.set(type,typeListeners)}var i=typeListeners.length;while(--i>=0){if(typeListeners[i]===callback){return}}typeListeners.push(callback)},removeEventListener:function(type,callback){type=String(type);var listeners=this.listeners;var typeListeners=listeners.get(type);if(!typeListeners){return}var length=typeListeners.length;var filtered=[];var i=-1;while(++i<length){if(typeListeners[i]!==callback){filtered.push(typeListeners[i])}}if(filtered.length===0){listeners["delete"](type)}else{listeners.set(type,filtered)}}};function Event(type){this.type=type;this.target=null}function MessageEvent(type,options){Event.call(this,type);this.data=options.data;this.lastEventId=options.lastEventId}MessageEvent.prototype=Event.prototype;var XHR=global.XMLHttpRequest;var XDR=global.XDomainRequest;var isCORSSupported=Boolean(XHR&&((new XHR()).withCredentials!==undefined));var isXHR=isCORSSupported;var Transport=isCORSSupported?XHR:XDR;var WAITING=-1;var CONNECTING=0;var OPEN=1;var CLOSED=2;var AFTER_CR=3;var FIELD_START=4;var FIELD=5;var VALUE_START=6;var VALUE=7;var contentTypeRegExp=/^text\/event\-stream;?(\s*charset\=utf\-8)?$/i;var MINIMUM_DURATION=1000;var MAXIMUM_DURATION=18000000;function getDuration(value,def){var n=Number(value)||def;return(n<MINIMUM_DURATION?MINIMUM_DURATION:(n>MAXIMUM_DURATION?MAXIMUM_DURATION:n))}function fire(that,f,event){try{if(typeof f==="function"){f.call(that,event)}}catch(e){throwError(e)}}function EventSource(url,options){url=String(url);var withCredentials=Boolean(isCORSSupported&&options&&options.withCredentials);var initialRetry=getDuration(options?options.retry:NaN,1000);var heartbeatTimeout=getDuration(options?options.heartbeatTimeout:NaN,45000);var lastEventId=(options&&options.lastEventId&&String(options.lastEventId))||"";var that=this;var retry=initialRetry;var wasActivity=false;var xhr=new Transport();var timeout=0;var timeout0=0;var charOffset=0;var currentState=WAITING;var dataBuffer=[];var lastEventIdBuffer="";var eventTypeBuffer="";var onTimeout=null;var state=FIELD_START;var field="";var value="";options=null;function close(){currentState=CLOSED;if(xhr!==null){xhr.abort();xhr=null}if(timeout!==0){clearTimeout(timeout);timeout=0}if(timeout0!==0){clearTimeout(timeout0);timeout0=0}that.readyState=CLOSED}function onProgress(isLoadEnd){var responseText=currentState===OPEN||currentState===CONNECTING?xhr.responseText||"":"";var event=null;var isWrongStatusCodeOrContentType=false;if(currentState===CONNECTING){var status=0;var statusText="";var contentType="";if(isXHR){try{status=Number(xhr.status||0);statusText=String(xhr.statusText||"");contentType=String(xhr.getResponseHeader("Content-Type")||"")}catch(error){status=0}}else{status=200;contentType=xhr.contentType}if(status===200&&contentTypeRegExp.test(contentType)){currentState=OPEN;wasActivity=true;retry=initialRetry;that.readyState=OPEN;event=new Event("open");that.dispatchEvent(event);fire(that,that.onopen,event);if(currentState===CLOSED){return}}else{if(status!==0){var message="";if(status!==200){message="EventSource's response has a status "+status+" "+statusText.replace(/\s+/g," ")+" that is not 200. Aborting the connection."}else{message="EventSource's response has a Content-Type specifying an unsupported type: "+contentType.replace(/\s+/g," ")+". Aborting the connection."}setTimeout(function(){throw new Error(message)});isWrongStatusCodeOrContentType=true}}}if(currentState===OPEN){if(responseText.length>charOffset){wasActivity=true}var i=charOffset-1;var length=responseText.length;var c="\n";while(++i<length){c=responseText[i];if(state===AFTER_CR&&c==="\n"){state=FIELD_START}else{if(state===AFTER_CR){state=FIELD_START}if(c==="\r"||c==="\n"){if(field==="data"){dataBuffer.push(value)}else{if(field==="id"){lastEventIdBuffer=value}else{if(field==="event"){eventTypeBuffer=value}else{if(field==="retry"){initialRetry=getDuration(value,initialRetry);retry=initialRetry}else{if(field==="heartbeatTimeout"){heartbeatTimeout=getDuration(value,heartbeatTimeout);if(timeout!==0){clearTimeout(timeout);timeout=setTimeout(onTimeout,heartbeatTimeout)}}}}}}value="";field="";if(state===FIELD_START){if(dataBuffer.length!==0){lastEventId=lastEventIdBuffer;if(eventTypeBuffer===""){eventTypeBuffer="message"}event=new MessageEvent(eventTypeBuffer,{data:dataBuffer.join("\n"),lastEventId:lastEventIdBuffer});that.dispatchEvent(event);if(eventTypeBuffer==="message"){fire(that,that.onmessage,event)}if(currentState===CLOSED){return}}dataBuffer.length=0;eventTypeBuffer=""}state=c==="\r"?AFTER_CR:FIELD_START}else{if(state===FIELD_START){state=FIELD}if(state===FIELD){if(c===":"){state=VALUE_START}else{field+=c}}else{if(state===VALUE_START){if(c!==" "){value+=c}state=VALUE}else{if(state===VALUE){value+=c}}}}}}charOffset=length}if((currentState===OPEN||currentState===CONNECTING)&&(isLoadEnd||isWrongStatusCodeOrContentType||(charOffset>1024*1024)||(timeout===0&&!wasActivity))){currentState=WAITING;xhr.abort();if(timeout!==0){clearTimeout(timeout);timeout=0}if(retry>initialRetry*16){retry=initialRetry*16}if(retry>MAXIMUM_DURATION){retry=MAXIMUM_DURATION}timeout=setTimeout(onTimeout,retry);retry=retry*2+1;that.readyState=CONNECTING;event=new Event("error");that.dispatchEvent(event);fire(that,that.onerror,event)}else{if(timeout===0){wasActivity=false;timeout=setTimeout(onTimeout,heartbeatTimeout)}}}function onProgress2(){onProgress(false)}function onLoadEnd(){onProgress(true)}if(isXHR){timeout0=setTimeout(function f(){if(xhr.readyState===3){onProgress2()}timeout0=setTimeout(f,500)},0)}onTimeout=function(){timeout=0;if(currentState!==WAITING){onProgress(false);return}if(isXHR&&(xhr.sendAsBinary!==undefined||xhr.onloadend===undefined)&&global.document&&global.document.readyState&&global.document.readyState!=="complete"){timeout=setTimeout(onTimeout,4);return}xhr.onload=xhr.onerror=onLoadEnd;if(isXHR){xhr.onabort=onLoadEnd;xhr.onreadystatechange=onProgress2}xhr.onprogress=onProgress2;wasActivity=false;timeout=setTimeout(onTimeout,heartbeatTimeout);charOffset=0;currentState=CONNECTING;dataBuffer.length=0;eventTypeBuffer="";lastEventIdBuffer=lastEventId;value="";field="";state=FIELD_START;var s=url.slice(0,5);if(s!=="data:"&&s!=="blob:"){s=url+((url.indexOf("?",0)===-1?"?":"&")+"lastEventId="+encodeURIComponent(lastEventId)+"&r="+String(Math.random()+1).slice(2))}else{s=url}xhr.open("GET",s,true);if(isXHR){xhr.withCredentials=withCredentials;xhr.responseType="text";xhr.setRequestHeader("Accept","text/event-stream")}xhr.send(null)};EventTarget.call(this);this.close=close;this.url=url;this.readyState=CONNECTING;this.withCredentials=withCredentials;this.onopen=null;this.onmessage=null;this.onerror=null;onTimeout()}function F(){this.CONNECTING=CONNECTING;this.OPEN=OPEN;this.CLOSED=CLOSED}F.prototype=EventTarget.prototype;EventSource.prototype=new F();F.call(EventSource);if(Transport){global.NativeEventSource=global.EventSource;global.EventSource=EventSource}}(this));jQuery.easing.jswing=jQuery.easing.swing;jQuery.extend(jQuery.easing,{def:"easeOutQuad",swing:function(e,f,a,h,g){return jQuery.easing[jQuery.easing.def](e,f,a,h,g)},easeInQuad:function(e,f,a,h,g){return h*(f/=g)*f+a},easeOutQuad:function(e,f,a,h,g){return -h*(f/=g)*(f-2)+a},easeInOutQuad:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f+a}return -h/2*((--f)*(f-2)-1)+a},easeInCubic:function(e,f,a,h,g){return h*(f/=g)*f*f+a},easeOutCubic:function(e,f,a,h,g){return h*((f=f/g-1)*f*f+1)+a},easeInOutCubic:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f+a}return h/2*((f-=2)*f*f+2)+a},easeInQuart:function(e,f,a,h,g){return h*(f/=g)*f*f*f+a},easeOutQuart:function(e,f,a,h,g){return -h*((f=f/g-1)*f*f*f-1)+a},easeInOutQuart:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f*f+a}return -h/2*((f-=2)*f*f*f-2)+a},easeInQuint:function(e,f,a,h,g){return h*(f/=g)*f*f*f*f+a},easeOutQuint:function(e,f,a,h,g){return h*((f=f/g-1)*f*f*f*f+1)+a},easeInOutQuint:function(e,f,a,h,g){if((f/=g/2)<1){return h/2*f*f*f*f*f+a}return h/2*((f-=2)*f*f*f*f+2)+a},easeInSine:function(e,f,a,h,g){return -h*Math.cos(f/g*(Math.PI/2))+h+a},easeOutSine:function(e,f,a,h,g){return h*Math.sin(f/g*(Math.PI/2))+a},easeInOutSine:function(e,f,a,h,g){return -h/2*(Math.cos(Math.PI*f/g)-1)+a},easeInExpo:function(e,f,a,h,g){return(f==0)?a:h*Math.pow(2,10*(f/g-1))+a},easeOutExpo:function(e,f,a,h,g){return(f==g)?a+h:h*(-Math.pow(2,-10*f/g)+1)+a},easeInOutExpo:function(e,f,a,h,g){if(f==0){return a}if(f==g){return a+h}if((f/=g/2)<1){return h/2*Math.pow(2,10*(f-1))+a}return h/2*(-Math.pow(2,-10*--f)+2)+a},easeInCirc:function(e,f,a,h,g){return -h*(Math.sqrt(1-(f/=g)*f)-1)+a},easeOutCirc:function(e,f,a,h,g){return h*Math.sqrt(1-(f=f/g-1)*f)+a},easeInOutCirc:function(e,f,a,h,g){if((f/=g/2)<1){return -h/2*(Math.sqrt(1-f*f)-1)+a}return h/2*(Math.sqrt(1-(f-=2)*f)+1)+a},easeInElastic:function(f,h,e,l,k){var i=1.70158;var j=0;var g=l;if(h==0){return e}if((h/=k)==1){return e+l}if(!j){j=k*0.3}if(g<Math.abs(l)){g=l;var i=j/4}else{var i=j/(2*Math.PI)*Math.asin(l/g)}return -(g*Math.pow(2,10*(h-=1))*Math.sin((h*k-i)*(2*Math.PI)/j))+e},easeOutElastic:function(f,h,e,l,k){var i=1.70158;var j=0;var g=l;if(h==0){return e}if((h/=k)==1){return e+l}if(!j){j=k*0.3}if(g<Math.abs(l)){g=l;var i=j/4}else{var i=j/(2*Math.PI)*Math.asin(l/g)}return g*Math.pow(2,-10*h)*Math.sin((h*k-i)*(2*Math.PI)/j)+l+e},easeInOutElastic:function(f,h,e,l,k){var i=1.70158;var j=0;var g=l;if(h==0){return e}if((h/=k/2)==2){return e+l}if(!j){j=k*(0.3*1.5)}if(g<Math.abs(l)){g=l;var i=j/4}else{var i=j/(2*Math.PI)*Math.asin(l/g)}if(h<1){return -0.5*(g*Math.pow(2,10*(h-=1))*Math.sin((h*k-i)*(2*Math.PI)/j))+e}return g*Math.pow(2,-10*(h-=1))*Math.sin((h*k-i)*(2*Math.PI)/j)*0.5+l+e},easeInBack:function(e,f,a,i,h,g){if(g==undefined){g=1.70158}return i*(f/=h)*f*((g+1)*f-g)+a},easeOutBack:function(e,f,a,i,h,g){if(g==undefined){g=1.70158}return i*((f=f/h-1)*f*((g+1)*f+g)+1)+a},easeInOutBack:function(e,f,a,i,h,g){if(g==undefined){g=1.70158}if((f/=h/2)<1){return i/2*(f*f*(((g*=(1.525))+1)*f-g))+a}return i/2*((f-=2)*f*(((g*=(1.525))+1)*f+g)+2)+a},easeInBounce:function(e,f,a,h,g){return h-jQuery.easing.easeOutBounce(e,g-f,0,h,g)+a},easeOutBounce:function(e,f,a,h,g){if((f/=g)<(1/2.75)){return h*(7.5625*f*f)+a}else{if(f<(2/2.75)){return h*(7.5625*(f-=(1.5/2.75))*f+0.75)+a}else{if(f<(2.5/2.75)){return h*(7.5625*(f-=(2.25/2.75))*f+0.9375)+a}else{return h*(7.5625*(f-=(2.625/2.75))*f+0.984375)+a}}}},easeInOutBounce:function(e,f,a,h,g){if(f<g/2){return jQuery.easing.easeInBounce(e,f*2,0,h,g)*0.5+a}return jQuery.easing.easeOutBounce(e,f*2-g,0,h,g)*0.5+h*0.5+a}});(function($){$.fn.alterClass=function(removals,additions){var self=this;if(removals.indexOf("*")===-1){self.removeClass(removals);return !additions?self:self.addClass(additions)}var patt=new RegExp("\\s"+removals.replace(/\*/g,"[A-Za-z0-9-_]+").split(" ").join("\\s|\\s")+"\\s","g");self.each(function(i,it){var cn=" "+it.className+" ";while(patt.test(cn)){cn=cn.replace(patt," ")}it.className=$.trim(cn)});return !additions?self:self.addClass(additions)}})(jQuery);jQuery.fn.fastClick=function(handler){this.click(function(ev){ev.preventDefault()});Hammer(this[0]).on("tap doubletap",handler);return this};(function(undefined){var root=this;var SpeechRecognition=root.SpeechRecognition||root.webkitSpeechRecognition||root.mozSpeechRecognition||root.msSpeechRecognition||root.oSpeechRecognition;if(!SpeechRecognition){root.annyang=null;return undefined}var commandsList=[];var recognition;var callbacks={start:[],error:[],end:[],result:[],resultMatch:[],resultNoMatch:[],errorNetwork:[],errorPermissionBlocked:[],errorPermissionDenied:[]};var autoRestart;var lastStartedAt=0;var debugState=false;var debugStyle="font-weight: bold; color: #00f;";var optionalParam=/\s*\((.*?)\)\s*/g;var optionalRegex=/(\(\?:[^)]+\))\?/g;var namedParam=/(\(\?)?:\w+/g;var splatParam=/\*\w+/g;var escapeRegExp=/[\-{}\[\]+?.,\\\^$|#]/g;var commandToRegExp=function(command){command=command.replace(escapeRegExp,"\\$&").replace(optionalParam,"(?:$1)?").replace(namedParam,function(match,optional){return optional?match:"([^\\s]+)"}).replace(splatParam,"(.*?)").replace(optionalRegex,"\\s*$1?\\s*");return new RegExp("^"+command+"$","i")};var invokeCallbacks=function(callbacks){callbacks.forEach(function(callback){callback.callback.apply(callback.context)})};var initIfNeeded=function(){if(recognition===undefined){root.annyang.init({},false)}};root.annyang={init:function(commands,resetCommands){if(resetCommands===undefined){resetCommands=true}else{resetCommands=!!resetCommands}try{if(recognition&&recognition.abort){recognition.abort()}recognition=new SpeechRecognition();recognition.maxAlternatives=5;recognition.continuous=true;recognition.lang="en-US"}catch(err){root.annyang=null;return undefined}recognition.onstart=function(){invokeCallbacks(callbacks.start)};recognition.onerror=function(event){invokeCallbacks(callbacks.error);switch(event.error){case"network":invokeCallbacks(callbacks.errorNetwork);break;case"not-allowed":case"service-not-allowed":autoRestart=false;if(new Date().getTime()-lastStartedAt<200){invokeCallbacks(callbacks.errorPermissionBlocked)}else{invokeCallbacks(callbacks.errorPermissionDenied)}break}};recognition.onend=function(){invokeCallbacks(callbacks.end);if(autoRestart){var timeSinceLastStart=new Date().getTime()-lastStartedAt;if(timeSinceLastStart<1000){setTimeout(root.annyang.start,1000-timeSinceLastStart)}else{root.annyang.start()}}};recognition.onresult=function(event){invokeCallbacks(callbacks.result);var results=event.results[event.resultIndex];var commandText;for(var i=0;i<results.length;i++){commandText=results[i].transcript.trim();if(debugState){root.console.log("Speech recognized: %c"+commandText,debugStyle)}for(var j=0,l=commandsList.length;j<l;j++){var result=commandsList[j].command.exec(commandText);if(result){var parameters=result.slice(1);if(debugState){root.console.log("command matched: %c"+commandsList[j].originalPhrase,debugStyle);if(parameters.length){root.console.log("with parameters",parameters)}}commandsList[j].callback.apply(this,parameters);invokeCallbacks(callbacks.resultMatch);return true}}}invokeCallbacks(callbacks.resultNoMatch);return false};if(resetCommands){commandsList=[]}if(commands.length){this.addCommands(commands)}},start:function(options){initIfNeeded();options=options||{};if(options.autoRestart!==undefined){autoRestart=!!options.autoRestart}else{autoRestart=true}lastStartedAt=new Date().getTime();recognition.start()},abort:function(){initIfNeeded();autoRestart=false;recognition.abort()},debug:function(newState){if(arguments.length>0){debugState=!!newState}else{debugState=true}},setLanguage:function(language){initIfNeeded();recognition.lang=language},setContinuous:function(cont){initIfNeeded();recognition.continuous=cont},addCommands:function(commands){var cb,command;initIfNeeded();for(var phrase in commands){if(commands.hasOwnProperty(phrase)){cb=root[commands[phrase]]||commands[phrase];if(typeof cb!=="function"){continue}command=commandToRegExp(phrase);commandsList.push({command:command,callback:cb,originalPhrase:phrase})}}if(debugState){root.console.log("Commands successfully loaded: %c"+commandsList.length,debugStyle)}},removeCommands:function(commandsToRemove){commandsToRemove=Array.isArray(commandsToRemove)?commandsToRemove:[commandsToRemove];commandsList=commandsList.filter(function(command){for(var i=0;i<commandsToRemove.length;i++){if(commandsToRemove[i]===command.originalPhrase){return false}}return true})},addCallback:function(type,callback,context){if(callbacks[type]===undefined){return}var cb=root[callback]||callback;if(typeof cb!=="function"){return}callbacks[type].push({callback:cb,context:context||this})}}}).call(this);<? @include_once("../includes/common.php");?>
//document.documentElement.requestFullscreen();
//window.screen.mozLockOrientation('portrait');
var windowWidth = window.screen.width < window.outerWidth ?
window.screen.width : window.outerWidth;
var mobile = windowWidth < 500;
var ttsEnabled=<?=$_DOMOTIKA['tts']?>;
var slideEnabled=<?=$_DOMOTIKA['slide']?>;
......@@ -85,6 +90,73 @@ window.matchMedia=window.matchMedia||function(a){"use strict";var c,d=a.document
//})
var audioTagSupport = !!(document.createElement('audio').canPlayType);
/*
function DoFullScreen() {
if (!document.fullscreenElement && // alternative standard method
!document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement ) { // current working methods
if (document.documentElement.requestFullscreen) {
document.documentElement.requestFullscreen();
} else if (document.documentElement.msRequestFullscreen) {
document.documentElement.msRequestFullscreen();
} else if (document.documentElement.mozRequestFullScreen) {
document.documentElement.mozRequestFullScreen();
} else if (document.documentElement.webkitRequestFullscreen) {
document.documentElement.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
}
}
}
*/
if(mobile)
{
if(window.navigator.userAgent.match(/firefox/i) && window.navigator.userAgent.match(/mobile/i))
{
var installbutton = $("#installbutton");
var port="";
if(document.location.port)
var port=":"+document.location.port;
var manifest_url = document.location.protocol+"//"+document.location.host+port+"<?=str_replace("/js/domotika.js","",$BASEGUIPATH)?>/manifest.webapp";
function installFFApp(ev) {
ev.preventDefault();
var myapp = navigator.mozApps.install(manifest_url);
myapp.onsuccess = function(data) {
$("#install_ff").hide()
console.log(this);
popupFader('success', 'SUCCESS:','Web app installata correttamente');
var a = playTTS('Web app installata correttamente');
};
myapp.onerror = function() {
console.log('Install failed, error: ' + this.error.name);
popupFader('danger', 'ERROR:', 'App not installed: '+this.error.name);
playTTS('Errore, applicazione non installata');
};
};
var installCheck = navigator.mozApps.checkInstalled(manifest_url);
installCheck.onsuccess = function() {
if(installCheck.result) {
$("#install_ff").hide();
} else {
$("#install_ff").show();
installbutton.on('click', installFFApp);
};
};
}
if(jQuery.isFunction(window.screen.lockOrientation))
window.screen.lockOrientation('portrait');
else if(jQuery.isFunction(window.screen.mozLockOrientation))
window.screen.mozLockOrientation('portrait');
else if(jQuery.isFunction(window.screen.msLockOrientation))
window.screen.msLockOrientation('portrait');
else if(jQuery.isFunction(window.screen.webkitLockOrientation))
window.screen.webkitLockOrientation('portrait');
}
function tmpPopover(el, cont, placement, timeout)
{
......@@ -109,11 +181,20 @@ window.matchMedia=window.matchMedia||function(a){"use strict";var c,d=a.document
if (!audioTagSupport) return false;
if (text=='') return false;
if (ttsEnabled!=1 && force===false) return false;
var audio = document.createElement('audio');
if($("playTTS_audio").length)
{
var audio = $("playTTS_audio");
}
else
{
var audio = document.createElement('audio');
audio.setAttribute('id' , 'playTTS_audio');
}
// XXX BUG: webkit based browsers seems to not work with https:// in <audio>, so, we fix this to http
audio.setAttribute('src', 'http://translate.google.com/translate_tts?tl='+lang+'&q=' + encodeURIComponent(text));
audio.load();
audio.play();
return audio;
}
function speechResult(data) {
......@@ -214,12 +295,25 @@ window.matchMedia=window.matchMedia||function(a){"use strict";var c,d=a.document
<? } ?>
<? if($left || $right) { ?>
function calcSnapSize()
{
if($(window).width()>768)
var mval=Math.min(Math.ceil((75/100)*$(window).width()), 800);
else
var mval=Math.max(Math.ceil((75/100)*$(window).width()), 266);
return mval
}
$(document).ready(function() {
mval = calcSnapSize();
$(".left-drawer").css("width", mval);
$(".right-drawer").css("width", mval)
});
snapper.on('animating',
function(e) {
if($(window).width()>768)
mval=Math.min(Math.ceil((75/100)*$(window).width()), 800);
else
mval=Math.max(Math.ceil((75/100)*$(window).width()), 266);
var mval = calcSnapSize();
<? if($left) { ?>
if(snapper.state().info.opening=='left' && snapper.state().state!='left' && $(".left-drawer").css("width")!=mval+"px")
{
......
......@@ -51,11 +51,14 @@
myapp.onsuccess = function(data) {
$("#install_ff").hide()
console.log(this);
alert('Web Application installed.');
popupFader('success', 'SUCCESS:','Web app installata correttamente');
var a = playTTS('Web app installata correttamente');
};
myapp.onerror = function() {
console.log('Install failed, error: ' + this.error.name);
alert('Install failed, error: ' + this.error.name);
popupFader('danger', 'ERROR:', 'App not installed: '+this.error.name);
playTTS('Errore, applicazione non installata');
};
};
......
Markdown is supported
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