diff options
author | Marcello Stanisci <marcello.stanisci@inria.fr> | 2015-07-03 17:43:04 +0200 |
---|---|---|
committer | Marcello Stanisci <marcello.stanisci@inria.fr> | 2015-07-03 17:43:04 +0200 |
commit | 9b88afc5fe4942f23957681f936c164e5170046f (patch) | |
tree | e78ae8570e5bcd82b38db0b294f7b1a02417f303 /src/website/new/merchant.js | |
parent | cfb8b5fc8000a58abfe16879cf3332d2d0aca8b7 (diff) | |
download | merchant-9b88afc5fe4942f23957681f936c164e5170046f.tar.gz merchant-9b88afc5fe4942f23957681f936c164e5170046f.tar.bz2 merchant-9b88afc5fe4942f23957681f936c164e5170046f.zip |
adding new faced merchant website
Diffstat (limited to 'src/website/new/merchant.js')
-rw-r--r-- | src/website/new/merchant.js | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/src/website/new/merchant.js b/src/website/new/merchant.js new file mode 100644 index 00000000..1c5480df --- /dev/null +++ b/src/website/new/merchant.js @@ -0,0 +1,79 @@ +/* + + This file is part of TALER + Copyright (C) 2014, 2015 Christian Grothoff (and other contributing authors) + + TALER is free software; you can redistribute it and/or modify it under the + terms of the GNU General Public License as published by the Free Software + Foundation; either version 3, or (at your option) any later version. + + TALER is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with + TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/> + + +*/ + +/* Set up a listener to be called whenever a Wallet gets installed +so that the user is led towards the demo's steps progressively +*/ + +function MERCHfirstStep(){ + + // NOTE: NO 'let' declarations liked by FF here. + var resDiv = document.createElement("div"); + var resTitle = document.createElement("h3"); + var resPar = document.createElement("p"); + + resTitle.innerHTML = "How To Create A Reserve"; + resPar.innerHTML = "Click on 'Create Reserve' on the Wallet's menu, and fill in the followong form" + + resTitle.setAttribute('class', 'preamble'); + resDiv.appendChild(resTitle); + resDiv.appendChild(resPar); + var root = document.getElementById('root'); + root.appendChild(resDiv); + + // get the form + var getform = new XMLHttpRequest(); + + getform.onload = function (){ + var parser = new DOMParser(); + var formDom = parser.parseFromString(getform.responseText, "text/html"); + var form = formDom.getElementById('reserve-form'); + + resDiv.appendChild(form); + + }; + + + getform.open("GET", "file:///home/marcello/webstore/create-reserve-form.html", true); + getform.send(); + +} + +document.body.addEventListener("taler-wallet-installed", MERCHfirstStep, false, false); + + +/* +notify the extension about the submission. That way it will be possible to retrieve +the mint's URL and/or other info. from the filled form + +*/ +function MERCHtrigSubmission(){ + +// set 'action' attribute to mint's url +// var mint = document.getElementById("mint-url"); + +// var form = document.getElementById("reserve-form"); +// form.setAttribute("action", "http://" + mint.value + "/admin/incoming/add"); + +var subEvent = new Event("submit-reserve"); +document.body.dispatchEvent(subEvent); + +// always return false so that the post is actually done by the extension +return false; +} |