Commit 3e3b855c authored by nextime's avatar nextime

Added webapp mode for firefox browsers with openwebapp manifest and installer

parent 426e2eca
......@@ -4,7 +4,7 @@ FallbackResource /domotika/gui/index.php
Deny from all
</Files>
<Files index.php>
<FilesMatch "^(index|install)\.php$">
Order Allow,Deny
Allow from all
</Files>
</FilesMatch>
<!DOCTYPE html>
<html manifest="offline.appcache">
<html manifest="<?=$BASEGUIPATH?>/offline.appcache">
<head>
<?=$PAGE_BUFFER['head']?>
<?=$PAGE_ADDHEAD?>
......
<? include("includes/common.php");
?><html>
<head>
</head>
<body>
<button id="install">
Install Domotika GUI on homescreen
</button>
<script>
(function(){
function install(ev) {
ev.preventDefault();
// define the manifest URL
var port="";
if(document.location.port)
var port=":"+document.location.port;
var manifest_url = document.location.protocol+"//"+document.location.host+port+"<?=str_replace("/install.php","",$BASEGUIPATH)?>/manifest.webapp";
// install the app
var myapp = navigator.mozApps.install(manifest_url);
myapp.onsuccess = function(data) {
// App is installed, remove button
//this.parentNode.removeChild(this);
console.log(this);
};
myapp.onerror = function() {
// App wasn't installed, info is in this.error.name
console.log('Install failed, error: ' + this.error.name);
};
};
// get a reference to the button and call install() on click
var button = document.getElementById('install');
button.addEventListener('click', install, false);
})();
</script>
</body>
</html>
{
"name": "Domotika GUI",
"description": "Home automation user interface",
"launch_path": "/domotika/gui",
"icons": {
"256": "/resources/img/logo_icon.png"
},
"developer": {
"name": "Unixmedia S.r.l.",
"url": "http://www.unixmedia.it"
},
"default_locale": "en"
}
CACHE MANIFEST
#1388875358
/domotika/gui/index.php
/domotika/gui/
#1388875360
/resources/img/logo_icon.png
NETWORK:
*
......@@ -27,6 +27,9 @@
<script src="<?=$BASEGUIPATH;?>/js/combined.min.js"></script>
<script>
//document.documentElement.requestFullscreen();
var ttsEnabled=<?=$_DOMOTIKA['tts']?>;
//var scroller = new AppScroll({
......@@ -399,8 +402,11 @@
setInterval(function(i){
console.debug("setinterval");
$.get("/rest/v1.2/keepalive/json",
function(r){
console.debug(r);
console.debug("getok");
if(r.data=='SLOGGEDOUT')
{
location.reload();
......@@ -409,6 +415,8 @@
$("#modal_offline").modal('hide');
}).fail(function(r){
console.debug("getfail");
console.debug(r);
$("#modal_offline").modal('show');
}
);
......
......@@ -23,6 +23,9 @@
Alias /domotika /home/domotika/Web/htdocs
Alias /admin /home/domotika/Web/admin
AddType text/cache-manifest .appcache
AddType text/css .css
AddType application/x-web-app-manifest+json .webapp
<Directory /home/domotika/Web/htdocs>
Options FollowSymLinks
......
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