diff options
author | tg(x) <*@tg-x.net> | 2016-08-17 12:04:33 +0200 |
---|---|---|
committer | tg(x) <*@tg-x.net> | 2016-08-17 12:04:33 +0200 |
commit | 15cb970023496977a995fb72aae7376be4ef15f8 (patch) | |
tree | e33703cac86a21ce6b4eee26dde498d7d00aabc7 | |
parent | 7950158af7393945ff02703e7eb3c3d74f88b0b8 (diff) | |
download | www-15cb970023496977a995fb72aae7376be4ef15f8.tar.gz www-15cb970023496977a995fb72aae7376be4ef15f8.zip |
wallet install: version check
-rw-r--r-- | wallet-installation.html | 88 |
1 files changed, 63 insertions, 25 deletions
diff --git a/wallet-installation.html b/wallet-installation.html index dee64681..5d695255 100644 --- a/wallet-installation.html +++ b/wallet-installation.html | |||
@@ -32,28 +32,51 @@ | |||
32 | for the JavaScript code in this page. | 32 | for the JavaScript code in this page. |
33 | */ | 33 | */ |
34 | 34 | ||
35 | var chrome_min_version = '47.0.2526'; | ||
36 | |||
35 | function onSuccess() { | 37 | function onSuccess() { |
36 | console.log("installation successful"); | 38 | console.log("installation successful"); |
37 | document.getElementById("install-result").innerText = "(installation was successful)"; | 39 | document.getElementById("install-result").appendChild(document.createTextNode("Installation was successful.")); |
38 | } | 40 | } |
39 | 41 | ||
40 | function onFailure(detail) { | 42 | function onFailure(detail) { |
41 | console.error("installation failed:", detail); | 43 | console.error("installation failed:", detail); |
42 | document.getElementById("install-result").innerText = "(failed: " + detail + ")"; | 44 | document.getElementById("install-result").appendChild(document.createTextNode("Installation failed: " + detail)); |
43 | } | 45 | } |
44 | 46 | ||
45 | function installWallet() { | 47 | function installWallet() { |
46 | chrome.webstore.install("https://chrome.google.com/webstore/detail/millncjiddlpgdmkklmhfadpacifaonc", onSuccess, onFailure); | 48 | if (window.chrome) { |
49 | chrome.webstore.install("https://chrome.google.com/webstore/detail/millncjiddlpgdmkklmhfadpacifaonc", onSuccess, onFailure); | ||
50 | } else { | ||
51 | onFailure("Google Chrome or Chromium is required for installation."); | ||
52 | } | ||
53 | } | ||
54 | |||
55 | try { | ||
56 | taler.onPresent(function () { | ||
57 | document.getElementById("box-present").style.display = "inherit"; | ||
58 | document.getElementById("box-not-present").style.display = "none"; | ||
59 | }); | ||
60 | taler.onAbsent(function () { | ||
61 | document.getElementById("box-present").style.display = "none"; | ||
62 | document.getElementById("box-not-present").style.display = "inherit"; | ||
63 | }); | ||
64 | } catch (err) { | ||
47 | } | 65 | } |
48 | 66 | ||
49 | taler.onPresent(function () { | 67 | function onLoad() { |
50 | document.getElementById("box-present").style.display = "inherit"; | 68 | if (typeof window.chrome != "object") { |
51 | document.getElementById("box-not-present").style.display = "none"; | 69 | document.getElementById("error-chrome").style.display = "inherit"; |
52 | }); | 70 | } else { |
53 | taler.onAbsent(function () { | 71 | var m = navigator.userAgent.match(/Chrome\/([0-9.]+)/); |
54 | document.getElementById("box-present").style.display = "none"; | 72 | if (null == m || m[1] < chrome_min_version) { |
55 | document.getElementById("box-not-present").style.display = "inherit"; | 73 | document.getElementById('chrome-min-version').appendChild(document.createTextNode(chrome_min_version)); |
56 | }); | 74 | document.getElementById('error-chrome-version').style.display = "inherit"; |
75 | } | ||
76 | } | ||
77 | } | ||
78 | |||
79 | document.addEventListener('DOMContentLoaded', onLoad); | ||
57 | </script> | 80 | </script> |
58 | 81 | ||
59 | <style type="text/css"> | 82 | <style type="text/css"> |
@@ -64,10 +87,17 @@ | |||
64 | padding: 0.5em; | 87 | padding: 0.5em; |
65 | } | 88 | } |
66 | .bluebox { | 89 | .bluebox { |
67 | background-color: #C2C6FF; | 90 | background-color: #C2C6FF; |
68 | border: solid; | 91 | border: solid; |
69 | border-radius: 5px; | 92 | border-radius: 5px; |
70 | padding: 0.5em; | 93 | padding: 0.5em; |
94 | } | ||
95 | .error { | ||
96 | font-style: italic; | ||
97 | display: none; | ||
98 | } | ||
99 | #install-result { | ||
100 | font-weight: bold; | ||
71 | } | 101 | } |
72 | </style> | 102 | </style> |
73 | </head> | 103 | </head> |
@@ -76,26 +106,34 @@ | |||
76 | <h1>Install the Taler wallet</h1> | 106 | <h1>Install the Taler wallet</h1> |
77 | 107 | ||
78 | <main style="display:inline-block;"> | 108 | <main style="display:inline-block;"> |
79 | <p> | 109 | <h2>Google Chrome / Chromium</h2> |
110 | <p id="error-chrome" class="error"> | ||
111 | <a href="https://www.google.com/chrome">Google Chrome</a> or <a href="https://www.chromium.org/">Chromium</a> | ||
112 | is required, but it appears you don't have it installed. | ||
113 | </p> | ||
114 | <p id="error-chrome-version" class="error"> | ||
115 | <a href="https://www.google.com/chrome">Google Chrome</a> or <a href="https://www.chromium.org/">Chromium</a> | ||
116 | version <span id="chrome-min-version"></span> or newer is required, but it appears you have an older version.</p> | ||
80 | <ul> | 117 | <ul> |
81 | <li>from the app store for | 118 | <li> |
82 | <a href="https://chrome.google.com/webstore/detail/gnu-taler-wallet/millncjiddlpgdmkklmhfadpacifaonc">Google | 119 | <a href="https://chrome.google.com/webstore/detail/gnu-taler-wallet/millncjiddlpgdmkklmhfadpacifaonc">Install from the Chrome Web Store</a> |
83 | Chrome and Chromium</a> | ||
84 | </li> | 120 | </li> |
85 | <li id="inline-install-chrome">from this page: | 121 | <li id="inline-install-chrome"> |
86 | <button onclick="installWallet()" id="install-button"> | 122 | <button onclick="installWallet()" id="install-button"> |
87 | install now | 123 | Install from this page |
88 | </button> <span id="install-result"></span> | 124 | </button> |
125 | <div id="install-result"></div> | ||
89 | </li> | 126 | </li> |
90 | </ul> | 127 | </ul> |
91 | Wallets for other browsers will be provided in the near future. | 128 | |
92 | </p> | 129 | <h2>Other browsers</h2> |
130 | <p>Wallets for other browsers will be provided in the near future.</p> | ||
93 | <p class="greenbox" id="box-present" style="display:none"> | 131 | <p class="greenbox" id="box-present" style="display:none"> |
94 | Congratulations, you have installed the Taler wallet. | 132 | Congratulations, you have installed the Taler wallet. |
95 | Check out the <a href="https://demo.taler.net/">demo</a>. | 133 | Check out the <a href="https://demo.taler.net/">demo</a>. |
96 | </p> | 134 | </p> |
97 | <p class="bluebox" id="box-not-present" style="display:none"> | 135 | <p class="bluebox" id="box-not-present" style="display:none"> |
98 | You don't have a wallet installed yet. | 136 | You don't have a wallet installed yet. |
99 | </p> | 137 | </p> |
100 | </main> | 138 | </main> |
101 | </body> | 139 | </body> |