summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcello Stanisci <marcello.stanisci@inria.fr>2016-01-20 18:16:44 +0100
committerMarcello Stanisci <marcello.stanisci@inria.fr>2016-01-20 18:16:44 +0100
commit1e936a747b2c3380332f0b3dda410261fb97a2b0 (patch)
tree6e459530df0f03354c57ca1eec5e6a66d8b94723
parent44b4a0b20e798756826d7e3175e453b439e758dc (diff)
parente72726c5aeee978ce41bcd4aea42784e2046c6c9 (diff)
downloadmerchant-1e936a747b2c3380332f0b3dda410261fb97a2b0.tar.gz
merchant-1e936a747b2c3380332f0b3dda410261fb97a2b0.tar.bz2
merchant-1e936a747b2c3380332f0b3dda410261fb97a2b0.zip
Merge branch 'master' of ssh://taler.net/var/git/merchant
-rw-r--r--src/frontend/index.html62
-rw-r--r--src/frontend/taler-presence.js61
2 files changed, 66 insertions, 57 deletions
diff --git a/src/frontend/index.html b/src/frontend/index.html
index 21ca0d65..5bd3a4ff 100644
--- a/src/frontend/index.html
+++ b/src/frontend/index.html
@@ -3,60 +3,8 @@
<head>
<title>Toy &quot;Store&quot; - Taler Demo</title>
<link rel="stylesheet" type="text/css" href="style.css">
- <script type="text/javascript">
- /* @licstart The following is the entire license notice for the
- JavaScript code in this page.
-
- Copyright (C) 2015 GNUnet e.V.
-
- The JavaScript code in this page is free software: you can
- redistribute it and/or modify it under the terms of the GNU
- Lesser General Public License (GNU LGPL) as published by the Free Software
- Foundation, either version 2.1 of the License, or (at your option)
- any later version. The code is distributed WITHOUT ANY WARRANTY;
- without even the implied warranty of MERCHANTABILITY or FITNESS
- FOR A PARTICULAR PURPOSE. See the GNU LGPL for more details.
-
- As additional permission under GNU LGPL version 2.1 section 7, you
- may distribute non-source (e.g., minimized or compacted) forms of
- that code without the copy of the GNU LGPL normally required by
- section 4, provided you include this license notice and a URL
- through which recipients can access the Corresponding Source.
-
- @licend The above is the entire license notice
- for the JavaScript code in this page.
- */
- function handleInstall() {
- var b = document.getElementById("main");
- b.classList.add("installed");
- };
-
- function handleUninstall() {
- var b = document.getElementById("main");
- b.classList.remove("installed");
- };
-
- function probeTaler() {
- var eve = new Event("taler-probe");
- document.dispatchEvent(eve);
- }
-
-
- // Only probe taler once the DOM is ready and
- // we can manipulate it.
- window.addEventListener("load", probeTaler, false);
-
- document.addEventListener("taler-wallet-present", handleInstall, false);
- document.addEventListener("taler-unload", handleUninstall, false);
- document.addEventListener("taler-load", handleInstall, false);
-
+ <script src="taler-presence.js" type="text/javascript">
</script>
- <style>
- *:not(.installed) .if-installed { display: none }
- .installed .if-not-installed { display: none }
- *:not(.installed) .if-not-installed { display: initial }
- .installed .if-installed { display: initial }
- </style>
</head>
<body>
@@ -99,17 +47,17 @@
<article>
<h2>Step 1: Installing the Taler wallet</h2>
- <p class="if-not-installed">
+ <p class="taler-installed-show">
First, you need to <a href="http://demo.taler.net/">install</a>
the Taler wallet browser extension.
</p>
- <p class="if-installed">
+ <p class="taler-installed-hide">
Congratulations, you have installed the Taler wallet correctly.
You can now proceed with the next steps.
</p>
</article>
- <article class="if-installed">
+ <article class="taler-installed-show">
<h2>Step 2: Withdraw coins <sup>(occasionally)</sup></h2>
<p>The next step is to withdraw coins, after all you cannot
@@ -136,7 +84,7 @@
(opens in a new tab).</p>
</article>
- <article class="if-installed">
+ <article class="taler-installed-show">
<h2>Step 3: Shop! <sup>(as long as you have KUDOS left)</sup></h2>
<p>Now it is time to spend your hard earned KUDOS.
diff --git a/src/frontend/taler-presence.js b/src/frontend/taler-presence.js
new file mode 100644
index 00000000..2562238b
--- /dev/null
+++ b/src/frontend/taler-presence.js
@@ -0,0 +1,61 @@
+/* @licstart The following is the entire license notice for the
+ JavaScript code in this page.
+
+ Copyright (C) 2016 GNUnet e.V.
+
+ The JavaScript code in this page is free software: you can
+ redistribute it and/or modify it under the terms of the GNU
+ Lesser General Public License (GNU LGPL) as published by the Free Software
+ Foundation, either version 2.1 of the License, or (at your option)
+ any later version. The code is distributed WITHOUT ANY WARRANTY;
+ without even the implied warranty of MERCHANTABILITY or FITNESS
+ FOR A PARTICULAR PURPOSE. See the GNU LGPL for more details.
+
+ As additional permission under GNU LGPL version 2.1 section 7, you
+ may distribute non-source (e.g., minimized or compacted) forms of
+ that code without the copy of the GNU LGPL normally required by
+ section 4, provided you include this license notice and a URL
+ through which recipients can access the Corresponding Source.
+
+ @licend The above is the entire license notice
+ for the JavaScript code in this page.
+*/
+
+function handleInstall() {
+ var show = document.getElementsByClassName("taler-installed-show");
+ var hide = document.getElementsByClassName("taler-installed-hide");
+ for (var i = 0; i < show.length; i++) {
+ show[i].style.display = "";
+ }
+ for (var i = 0; i < hide.length; i++) {
+ hide[i].style.display = "none";
+ }
+};
+
+function handleUninstall() {
+ var show = document.getElementsByClassName("taler-installed-show");
+ var hide = document.getElementsByClassName("taler-installed-hide");
+ for (var i = 0; i < show.length; i++) {
+ show[i].style.display = "none";
+ }
+ for (var i = 0; i < hide.length; i++) {
+ hide[i].style.display = "";
+ }
+};
+
+function probeTaler() {
+ var eve = new Event("taler-probe");
+ console.log("probing taler");
+ document.dispatchEvent(eve);
+}
+
+document.addEventListener("taler-wallet-present", handleInstall, false);
+document.addEventListener("taler-unload", handleUninstall, false);
+document.addEventListener("taler-load", handleInstall, false);
+
+function initTaler() {
+ handleUninstall();
+ probeTaler();
+}
+
+window.addEventListener("load", initTaler, false);