From 2f6f6bd29e60b7af2721198c9b8e2a0f6a7bc5f3 Mon Sep 17 00:00:00 2001 From: Nathan Parikh Date: Fri, 8 Sep 2017 22:47:32 -0500 Subject: [PATCH] Version 1.0 fully ready --- index.html | 72 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 43 insertions(+), 29 deletions(-) diff --git a/index.html b/index.html index 53f2164..3db22f5 100644 --- a/index.html +++ b/index.html @@ -377,24 +377,24 @@

Choose Your Base Currency

- + - + - + - - - + + + - - - - + + + + @@ -422,6 +422,29 @@

Tip Jar

/****************** * APP FUNCTIONALITY ******************/ + //user settings + const settings = require('electron-settings'); + settings.set('developer', { + first: 'Nathan', + last: 'Parikh' + }); + //default coins + if(settings.has('user.coins')) { + //do nothing because coins already set + } + else { + settings.set('user', { + coins: 'BTC,ETH,LTC' + }); + } + //default base currency + if(settings.has('user.currency')) { + //do nothing because currency already set + } + else { + settings.set('user.currency', 'USD'); + } + (function() { function loadJSON(callback) { @@ -475,12 +498,17 @@

Tip Jar

}); //loadJSON - base = 'USD'; + base = settings.get('user.currency'); // get the user's base currency + var currSel = document.getElementById('base'); //select the currency select box + currSel.value = settings.get('user.currency'); //select the option that corresponds to the user's currency setBase = function() { //selected base currency - var x = document.getElementById("base").selectedIndex; - var y = document.getElementById("base").options; - base = y[x].text; + var sel = document.getElementById('base'); + var x = sel.selectedIndex; + var y = sel.options; + base = y[x].text; + settings.set('user.currency', base); //save the user's selection + updateData(); //immediately reflect the changed currency }; })(); @@ -493,21 +521,7 @@

Tip Jar

return parent.appendChild(el); } - //user settings - const settings = require('electron-settings'); - settings.set('developer', { - first: 'Nathan', - last: 'Parikh' - }); - //default coins - if(settings.has('user.coins')) { - //do nothing because coins already set - } - else { - settings.set('user', { - coins: 'BTC,ETH,LTC' - }); - } + // Returns an array with values of the selected (checked) checkboxes in "frm" function getSelectedChbox(frm) {