mirror of
https://gitlab.silvrtree.co.uk/martind2000/old-silvrgit.git
synced 2025-01-25 16:26:17 +00:00
tidying up and eventing the app
This commit is contained in:
parent
929904325f
commit
30b83278f1
22
app/app.js
22
app/app.js
@ -84,7 +84,6 @@
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Access-Control-Allow-Methods': 'PUT, GET, POST, DELETE, OPTIONS',
|
||||
'Access-Control-Allow-Headers': 'Content-Type'
|
||||
|
||||
},
|
||||
success: function (data) {
|
||||
self.trigger('displayWeather', data);
|
||||
@ -137,6 +136,11 @@
|
||||
elm.html("£1 = $" + parseFloat(data.gpbe.toFixed(2)) + " = " + parseFloat(data.sekex.toFixed(2)) + " SEK");
|
||||
};
|
||||
|
||||
this.bind('updateFX', function (data) {
|
||||
$('#fx').html("£1 = $" + parseFloat(data.gpbe.toFixed(2)) + " = " + parseFloat(data.sekex.toFixed(2)) + " SEK");
|
||||
});
|
||||
|
||||
|
||||
var btcValue = function () {
|
||||
var url = '/btc';
|
||||
|
||||
@ -193,7 +197,6 @@
|
||||
|
||||
},
|
||||
success: function (data) {
|
||||
//console.log(data);
|
||||
var gpbex = (1 / data.rates.GBP);
|
||||
var sekex = (gpbex * data.rates.SEK);
|
||||
var fxdata = {
|
||||
@ -203,10 +206,7 @@
|
||||
gpbe: gpbex,
|
||||
sekex: sekex
|
||||
};
|
||||
// console.log(fxdata);
|
||||
//var fxdata = data.bpi.GBP.rate_float, usd = data.bpi.USD.rate_float;
|
||||
|
||||
updateFX(fxdata);
|
||||
self.trigger('updateFX', fxdata);
|
||||
},
|
||||
error: function (xhr, type) {
|
||||
console.log("ajax error");
|
||||
@ -216,6 +216,10 @@
|
||||
});
|
||||
};
|
||||
|
||||
this.bind('getFX', function () {
|
||||
getFX();
|
||||
});
|
||||
|
||||
var getNextTrainTime = function (toStation, fromStation) {
|
||||
var url = '/getnexttraintimes?from=' + fromStation + '&to=' + toStation;
|
||||
var target = fromStation + toStation;
|
||||
@ -227,7 +231,6 @@
|
||||
|
||||
timeout: 10000,
|
||||
|
||||
//contentType: ('application/json'),
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Access-Control-Allow-Methods': 'PUT, GET, POST, DELETE, OPTIONS',
|
||||
@ -313,7 +316,6 @@
|
||||
|
||||
timeout: 10000,
|
||||
|
||||
//contentType: ('application/json'),
|
||||
headers: {
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Access-Control-Allow-Methods': 'PUT, GET, POST, DELETE, OPTIONS',
|
||||
@ -334,7 +336,7 @@
|
||||
tick();
|
||||
get_weather();
|
||||
self.trigger('getBTC');
|
||||
getFX();
|
||||
self.trigger('getFX');
|
||||
getNextTrainTime('dbe', 'glq');
|
||||
getNextTrainTime('glq', 'dbe');
|
||||
|
||||
@ -348,7 +350,7 @@
|
||||
|
||||
_slowTimer = setInterval(function () {
|
||||
|
||||
getFX();
|
||||
self.trigger('getFX');
|
||||
get_weather();
|
||||
}, (60000 * 15));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user