Commit 671c04f3 authored by nextime's avatar nextime

Wow, duplicated domotika.js include!

parent 137c951b
<?
$GUIDEBUG=FALSE;
//$GUIDEBUG=TRUE;
$BASEGUIPATH=str_replace("/index.php","",$_SERVER['PHP_SELF']);
$FSPATH=realpath(dirname(__FILE__)."/..");
......
......@@ -71,7 +71,7 @@ window.matchMedia=window.matchMedia||function(a){"use strict";var c,d=a.document
* Github: https://github.com/jakiestfu/AppScroll
* Version: 1.0.0
*/
(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){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}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 isWebKitBefore535=/AppleWebKit\/5([0-2][0-9]|3[0-4])[\.\s\w]/.test(navigator.userAgent);var isGecko=Boolean(XHR&&((new XHR()).sendAsBinary!==undefined));var isPresto=Object.prototype.toString.call(global.opera)==="[object Opera]";var MINIMUM_DURATION=1;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 retryLimit=getDuration(options?options.retryLimit:NaN,300000);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;if(currentState===CONNECTING){var status=0;var contentType="";if(isXHR){try{status=Number(xhr.status||0);contentType=String(xhr.getResponseHeader("Content-Type")||"")}catch(error){}}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}}}if(currentState===OPEN){if(responseText.length>charOffset){wasActivity=true}var i=charOffset-1;var length=responseText.length;while(++i<length){var 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;if(retryLimit<initialRetry){retryLimit=initialRetry}}else{if(field==="retryLimit"){retryLimit=getDuration(value,retryLimit)}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||(charOffset>1024*1024)||(timeout===0&&!wasActivity))){currentState=WAITING;xhr.abort();if(timeout!==0){clearTimeout(timeout);timeout=0}if(retry>retryLimit){retry=retryLimit}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(isPresto){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(navigator.onLine===false){timeout=setTimeout(onTimeout,500);return}if(isWebKitBefore535&&global.document&&global.document.readyState!=="complete"){timeout=setTimeout(onTimeout,100);return}xhr.onload=xhr.onerror=onLoadEnd;xhr.onabort=onLoadEnd;if(isXHR){xhr.onreadystatechange=onProgress2}if(!isGecko){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);xhr.withCredentials=withCredentials;xhr.responseType="text";if(isXHR){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.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");?>
(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();
......@@ -129,6 +129,7 @@ window.matchMedia=window.matchMedia||function(a){"use strict";var c,d=a.document
function sendSpeech(spobj)
{
console.debug(spobj.serialize());
$.post("/rest/v1.2/actions/speech_text/json", spobj.serialize(), speechResult );
}
......@@ -157,6 +158,7 @@ window.matchMedia=window.matchMedia||function(a){"use strict";var c,d=a.document
function setSpeechText(terms)
{
// XXX Sistema sta cosa!
$("#speech [name=text]").val(terms);
$("#speechsm [name=text]").val(terms);
console.debug("SpeechRecognized: "+terms)
......@@ -304,18 +306,22 @@ window.matchMedia=window.matchMedia||function(a){"use strict";var c,d=a.document
$('#speech').bind('webkitspeechchange',function(event) {
event.preventDefault();
console.debug("AAAA");
sendSpeech($("#speech"));
});
$('#speechsm').bind('webkitspeechchange',function(event) {
event.preventDefault();
sendSpeech($("#speech"));
console.debug("BBBBB");
sendSpeech($("#speechsm"));
});
$("#speech").keypress(function(event) {
var keycode = (event.keyCode ? event.keyCode : event.which);
if(keycode == 13) {
event.preventDefault();
console.debug("CCCC");
console.debug($("#speech"));
sendSpeech($("#speech"));
}
});
......@@ -509,11 +515,11 @@ window.matchMedia=window.matchMedia||function(a){"use strict";var c,d=a.document
setInterval(function(i){
console.debug("setinterval");
//console.debug("setinterval");
$.get("/rest/v1.2/keepalive/json",
function(r){
console.debug(r);
console.debug("getok");
//console.debug(r);
//console.debug("getok");
//if('vibrate' in navigator) {
// // ... vibrate for a second
// navigator.vibrate(1000);
......
......@@ -56,6 +56,7 @@
function sendSpeech(spobj)
{
console.debug(spobj.serialize());
$.post("/rest/v1.2/actions/speech_text/json", spobj.serialize(), speechResult );
}
......@@ -84,6 +85,7 @@
function setSpeechText(terms)
{
// XXX Sistema sta cosa!
$("#speech [name=text]").val(terms);
$("#speechsm [name=text]").val(terms);
console.debug("SpeechRecognized: "+terms)
......@@ -231,18 +233,22 @@
$('#speech').bind('webkitspeechchange',function(event) {
event.preventDefault();
console.debug("AAAA");
sendSpeech($("#speech"));
});
$('#speechsm').bind('webkitspeechchange',function(event) {
event.preventDefault();
sendSpeech($("#speech"));
console.debug("BBBBB");
sendSpeech($("#speechsm"));
});
$("#speech").keypress(function(event) {
var keycode = (event.keyCode ? event.keyCode : event.which);
if(keycode == 13) {
event.preventDefault();
console.debug("CCCC");
console.debug($("#speech"));
sendSpeech($("#speech"));
}
});
......@@ -436,11 +442,11 @@
setInterval(function(i){
console.debug("setinterval");
//console.debug("setinterval");
$.get("/rest/v1.2/keepalive/json",
function(r){
console.debug(r);
console.debug("getok");
//console.debug(r);
//console.debug("getok");
//if('vibrate' in navigator) {
// // ... vibrate for a second
// navigator.vibrate(1000);
......
......@@ -29,5 +29,4 @@
<script src="<?=$BASEGUIPATH;?>/js/domotika.js"></script>
<? } else { ?>
<script src="<?=$BASEGUIPATH;?>/js/combined.min.js"></script>
<script src="<?=$BASEGUIPATH;?>/js/domotika.js"></script>
<? } ?>
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