Commit bdc4932a authored by Gampe Sebastian's avatar Gampe Sebastian
Browse files

rename function json_load to content_load

parent 66ae169f
function json_load( url, datatype ){
function content_load( url, datatype ){
var json = null;
if( datatype == undefined ){
datatype=url.match(/\..*$/g)[0].slice(1);
}
console.log( url, datatype );
$.ajax({
'async': false,
'global': false,
......@@ -15,6 +15,7 @@ function json_load( url, datatype ){
result = data;
}
});
if(datatype == 'csv'){
result=result.split(/\n/g);
var AA=[];
......@@ -28,6 +29,7 @@ function json_load( url, datatype ){
);
result=AA;
}
return result;
}
......
......@@ -49,13 +49,18 @@ function create_graph(){
var D=[];
var L=['time','fv_price','fm_price'];
var factor_curr=0;
var factor=0;
DATA.history.slice(1).forEach(
function(v,i){
var A=v.split(/,/g);
if( A.length > 1 ){
var LMH_fv=[parseFloat(A[1]),parseFloat(A[1]),parseFloat(A[2])];
var LMH_fm=[parseFloat(A[3]),(parseFloat(A[3])+parseFloat(A[4]))/2,parseFloat(A[4])];
factor=parseFloat(A[5]);
if( factor_curr == 0 ) factor_curr=factor;
fact=factor/factor_curr;
var LMH_fv=[A[1]*fact,A[1]*fact,A[2]*fact];
var LMH_fm=[A[3]*fact,(A[3]*fact+A[4]*fact)/2,A[4]*fact];
D.push([new Date(A[0]*1000),LMH_fv,LMH_fm]);
}
}
......@@ -107,8 +112,8 @@ function create_graph(){
function get_data(curr){
DATA=json_load('functions/get_data.php?c=' + curr,'json' );
PAIR=json_load('data/coingecko_currencies.json');
DATA=content_load('functions/get_data.php?c=' + curr,'json' );
PAIR=content_load('data/coingecko_currencies.json');
$('#curr').html('');
var tmp='';
PAIR.sort().forEach(
......
......@@ -17,7 +17,7 @@
<div class="container-fluid">
<h3>Faircoin FreeVision price ticker ( in testing )</h3>
<div class="row">
<div class="col-sm-5 ticker">
<div class="col-md-5 ticker">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text prep">FreeVision (bid)</span>
......@@ -50,7 +50,7 @@
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">FreeVision price (ask)</span>
<span class="input-group-text">FreeVision (ask)</span>
</div>
<div class="form-control prices" id="fv_ask">loading...</div>
<div class="input-group-append">
......@@ -72,7 +72,7 @@
<p class="api data"><a>CURRENT TICKER DATA.JSON</a></p>
<p class="api history"><a>HISTORICAL TICKER DATA.CSV</a></p>
</div>
<div class="col-sm-7 finfo_chart">
<div class="col-md-7 finfo_chart">
<div id="pricegraph_btn">
<button class="btn btn-sm btn-info" id="linear">Linear Scale</button>&nbsp;
<button class="btn btn-sm btn-info" id="log" disabled="true">Log Scale</button>
......@@ -87,7 +87,7 @@
</div>
<div class="row">
<div class="col-sm-8 finfo_history">
<div class="col-md-8 finfo_history">
<h4>history</h4>
<span id="history"></span>
</div>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment