diff options
author | Florian Dold <florian.dold@gmail.com> | 2016-01-10 20:07:42 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2016-01-10 20:07:42 +0100 |
commit | 473503a246aa7a23539a349710c5549d1d87c147 (patch) | |
tree | 2b1ee9b420df72a0d861759d1fbcd2226e489086 /extension/pages | |
parent | dd19e0ecbe114ebd71122ff57ea56eabb6258b75 (diff) | |
download | wallet-core-473503a246aa7a23539a349710c5549d1d87c147.tar.xz |
The great modularization.
Use ES6 module syntax and SystemJS modules for everything.
Some testing stubs were added as well.
Diffstat (limited to 'extension/pages')
-rw-r--r-- | extension/pages/confirm-contract.html | 4 | ||||
-rw-r--r-- | extension/pages/confirm-contract.js | 33 | ||||
-rw-r--r-- | extension/pages/confirm-contract.tsx | 2 | ||||
-rw-r--r-- | extension/pages/confirm-create-reserve.html | 2 | ||||
-rw-r--r-- | extension/pages/confirm-create-reserve.js | 24 |
5 files changed, 31 insertions, 34 deletions
diff --git a/extension/pages/confirm-contract.html b/extension/pages/confirm-contract.html index 242a489fd..d851af350 100644 --- a/extension/pages/confirm-contract.html +++ b/extension/pages/confirm-contract.html @@ -3,8 +3,8 @@ <html> <head> <title>Taler Wallet: Confirm Reserve Creation</title> - <script src="../lib/URI.js"></script> - <script src="../lib/handlebars-v4.0.5.js"></script> + <script src="../lib/vendor/URI.js"></script> + <script src="../lib/vendor/handlebars-v4.0.5.js"></script> <script src="../lib/commonHelpers.js"></script> <script src="confirm-contract.js"></script> <link rel="stylesheet" type="text/css" href="../style/wallet.css"> diff --git a/extension/pages/confirm-contract.js b/extension/pages/confirm-contract.js index 6a3389437..0514a4e9b 100644 --- a/extension/pages/confirm-contract.js +++ b/extension/pages/confirm-contract.js @@ -13,13 +13,13 @@ 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/> */ -/// <reference path="../decl/handlebars/handlebars.d.ts" /> +/// <reference path="../lib/decl/handlebars/handlebars.d.ts" /> "use strict"; -let url = URI(document.location.href); -let query = URI.parseQuery(url.query()); -let $_ = (x) => document.getElementById(x); +var url = URI(document.location.href); +var query = URI.parseQuery(url.query()); +var $_ = function (x) { return document.getElementById(x); }; function renderContract(contract) { - let showAmount = document.getElementById("show-amount"); + var showAmount = document.getElementById("show-amount"); $_('merchant-name').innerText = contract.merchant.name; } function clone(obj) { @@ -27,26 +27,26 @@ function clone(obj) { return JSON.parse(JSON.stringify(obj)); } Handlebars.registerHelper('prettyAmount', function (amount) { - let v = amount.value + amount.fraction / 10e6; + var v = amount.value + amount.fraction / 10e6; return v.toFixed(2) + " " + amount.currency; }); -document.addEventListener("DOMContentLoaded", (e) => { - let offer = JSON.parse(query.offer); +document.addEventListener("DOMContentLoaded", function (e) { + var offer = JSON.parse(query.offer); console.dir(offer); - let source = $_("contract-template").innerHTML; - let template = Handlebars.compile(source); + var source = $_("contract-template").innerHTML; + var template = Handlebars.compile(source); $_("render-contract").innerHTML = template(offer.contract); - document.getElementById("confirm-pay").addEventListener("click", (e) => { + document.getElementById("confirm-pay").addEventListener("click", function (e) { console.log("Query:", JSON.stringify(query)); - let d = { + var d = { offer: JSON.parse(query.offer), merchantPageUrl: query.merchantPageUrl }; - chrome.runtime.sendMessage({ type: 'confirm-pay', detail: d }, (resp) => { + chrome.runtime.sendMessage({ type: 'confirm-pay', detail: d }, function (resp) { if (!resp.success) { - let source = $_("error-template").innerHTML; - let template = Handlebars.compile(source); - $_("status").innerHTML = template(resp); + var source_1 = $_("error-template").innerHTML; + var template_1 = Handlebars.compile(source_1); + $_("status").innerHTML = template_1(resp); return; } document.location.href = URI(d.offer.exec_url) @@ -56,3 +56,4 @@ document.addEventListener("DOMContentLoaded", (e) => { }); }); }); +//# sourceMappingURL=confirm-contract.js.map
\ No newline at end of file diff --git a/extension/pages/confirm-contract.tsx b/extension/pages/confirm-contract.tsx index b2cc9efdf..d1a64a6ba 100644 --- a/extension/pages/confirm-contract.tsx +++ b/extension/pages/confirm-contract.tsx @@ -14,7 +14,7 @@ TALER; see the file COPYING. If not, If not, see <http://www.gnu.org/licenses/> */ -/// <reference path="../decl/handlebars/handlebars.d.ts" /> +/// <reference path="../lib/decl/handlebars/handlebars.d.ts" /> "use strict"; let url = URI(document.location.href); diff --git a/extension/pages/confirm-create-reserve.html b/extension/pages/confirm-create-reserve.html index 62379ae4c..812ae9434 100644 --- a/extension/pages/confirm-create-reserve.html +++ b/extension/pages/confirm-create-reserve.html @@ -3,7 +3,7 @@ <html> <head> <title>Taler Wallet: Select Taler Provider</title> - <script src="../lib/URI.js"></script> + <script src="../lib/vendor/URI.js"></script> <script src="../lib/polyfill-react.js"></script> <script src="confirm-create-reserve.js"></script> <link rel="stylesheet" type="text/css" href="../style/wallet.css"> diff --git a/extension/pages/confirm-create-reserve.js b/extension/pages/confirm-create-reserve.js index efa6b4aed..8b0fdc536 100644 --- a/extension/pages/confirm-create-reserve.js +++ b/extension/pages/confirm-create-reserve.js @@ -16,12 +16,12 @@ "use strict"; var ConfirmCreateReserve; (function (ConfirmCreateReserve) { - let url = URI(document.location.href); - let query = URI.parseQuery(url.query()); + var url = URI(document.location.href); + var query = URI.parseQuery(url.query()); function updateAmount() { - let showAmount = document.getElementById("show-amount"); + var showAmount = document.getElementById("show-amount"); console.log("Query is " + JSON.stringify(query)); - let s = query.amount_str; + var s = query.amount_str; if (!s) { document.body.innerHTML = "Oops, something went wrong."; return; @@ -32,25 +32,21 @@ var ConfirmCreateReserve; // This is faster than it looks ... return JSON.parse(JSON.stringify(obj)); } - document.addEventListener("DOMContentLoaded", (e) => { + document.addEventListener("DOMContentLoaded", function (e) { updateAmount(); - document.getElementById("confirm").addEventListener("click", (e) => { - let d = clone(query); + document.getElementById("confirm").addEventListener("click", function (e) { + var d = clone(query); d.mint = document.getElementById('mint-url').value; - chrome.runtime.sendMessage({ type: 'confirm-reserve', detail: d }, (resp) => { + chrome.runtime.sendMessage({ type: 'confirm-reserve', detail: d }, function (resp) { if (resp.success === true) { document.location.href = resp.backlink; } else { document.body.innerHTML = - ` - Oops, something went wrong. - The bank responded with HTTP status code ${resp.status}. - Here is some more info: - <pre>${resp.text}</pre> - </div>`; + "\n Oops, something went wrong.\n The bank responded with HTTP status code " + resp.status + ".\n Here is some more info:\n <pre>" + resp.text + "</pre>\n </div>"; } }); }); }); })(ConfirmCreateReserve || (ConfirmCreateReserve = {})); +//# sourceMappingURL=confirm-create-reserve.js.map
\ No newline at end of file |