diff --git a/extension/extension.js b/extension/extension.js index 434ab42..f0b30fe 100644 --- a/extension/extension.js +++ b/extension/extension.js @@ -1,25 +1,8 @@ $(function() { - var heads = 'Official RateOfficial ValueMarket Value'; - - $("thead tr").append(heads); - - - ajax = function(options, callback) { - var xhr; - xhr = new XMLHttpRequest(); - xhr.open(options.type, options.url, options.async || true); - xhr.onreadystatechange = function() { - if (xhr.readyState === 4) { - return callback(xhr.responseText); - } - }; - return xhr.send(); - }; - ajax({ type: "GET", - url: "http://api.fairplayground.info/rawdata/faircoin_prices.csv", + url: "https://api.fairplayground.info/rawdata/faircoin_prices.csv", }, processData); @@ -30,6 +13,9 @@ $(function() { if (priceData) { + var heads = 'Official RateOfficial ValueMarket Value'; + $("thead tr").append(heads); + $('tbody > tr').each(function() { @@ -81,6 +67,17 @@ $(function() { $(el).append('€ ' + (Math.round(market * 100) / 100) + ''); } + function ajax (options, callback) { + var xhr; + xhr = new XMLHttpRequest(); + xhr.open(options.type, options.url, options.async || true); + xhr.onreadystatechange = function() { + if (xhr.readyState === 4) { + return callback(xhr.responseText); + } + }; + return xhr.send(); + }; function csvToArray(csv) { var a1 = csv.split("\n"); diff --git a/index.js b/index.js index d528df1..61ec2bc 100644 --- a/index.js +++ b/index.js @@ -9,7 +9,7 @@ $(document).ready(function() { $.ajax({ type: "GET", - url: "http://api.fairplayground.info/rawdata/faircoin_prices.csv", + url: "https://api.fairplayground.info/rawdata/faircoin_prices.csv", dataType: "text", success: processData });