From d0b388834ffa759767f9bf4999b992e4e236cc67 Mon Sep 17 00:00:00 2001 From: dattaz Date: Thu, 10 Jul 2014 21:50:57 +0200 Subject: [PATCH] hide app button already install add js code to hide app install button when app already install --- templates/layouts/default.html.ep | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/templates/layouts/default.html.ep b/templates/layouts/default.html.ep index a29fc7b..9b99c8b 100644 --- a/templates/layouts/default.html.ep +++ b/templates/layouts/default.html.ep @@ -74,6 +74,15 @@ alert('Install failed, error: ' + this.error.name); }; }); + //hide app install button when app already install + var button = document.getElementById('install-app'); + var installCheck = navigator.mozApps.checkInstalled(manifestUrl); + installCheck.onsuccess = function() { + if(installCheck.result) { + button.style.display = "none"; + } + + //Hide app install button on the webapp if (navigator.mozApps) { var checkIfInstalled = navigator.mozApps.getSelf(); checkIfInstalled.onsuccess = function () { @@ -86,6 +95,7 @@ } }; } + % end <%= content %>