diff --git a/extension/extension.js b/extension/extension.js index f982146..e9099e3 100644 --- a/extension/extension.js +++ b/extension/extension.js @@ -1,3 +1,7 @@ +var total_fair; +var total_euro; +var total_market; + $(function() { ajax({ @@ -19,18 +23,26 @@ $(function() { var heads = 'Official RateOfficial ValueMarket Value'; $("thead tr").append(heads); - $('tbody > tr').each(function() { + $('tbody').each(function() { + + total_fair = total_euro = total_market = 0; + + $(this).find('tr').each(function() { + + + var dateVar = $(this).find('td:first').text(); + var d = new Date(dateVar); + var dateISO = d.toISOString().slice(0, 10); + var faircoins = parseFloat($(this).find('td:nth-child(3)').text()); - var dateVar = $(this).find('td:first').text(); - var d = new Date(dateVar); - var dateISO = d.toISOString().slice(0, 10); + // $(this).append(''+faircoins+''); - var faircoins = $(this).find('td:nth-child(3)').text(); + calculateEuros(dateISO, faircoins, this); - // $(this).append(''+faircoins+''); + }); - calculateEuros(dateISO, faircoins, this); + $(this).append('Totals' + (Math.round(total_fair * 100) / 100) + ' FAIR€ ' + (Math.round(total_euro * 100) / 100) + '€ ' + (Math.round(total_market * 100) / 100) + ''); }); } @@ -64,6 +76,9 @@ $(function() { var euros = faircoins * selectedPriceData[3]; var market = faircoins * selectedPriceData[2]; + total_fair = total_fair+faircoins; + total_euro = total_euro+euros; + total_market = total_market+market; $(el).append('' + parseFloat(selectedPriceData[3]).toString() + ''); $(el).append('€ ' + (Math.round(euros * 100) / 100) + ''); diff --git a/extension/manifest.json b/extension/manifest.json index 5cebc19..8cc1021 100644 --- a/extension/manifest.json +++ b/extension/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "name": "FairCoin Calculator", - "version": "1.0", + "version": "1.1", "permissions": [ "webRequest", "",