mirror of
https://gitlab.silvrtree.co.uk/martind2000/old-silvrgit.git
synced 2025-02-11 06:09:21 +00:00
console.log tidy
This commit is contained in:
parent
40c7aa3d8f
commit
258396c06f
107
lib/today.js
107
lib/today.js
@ -26,7 +26,6 @@ var forecastOptions = {
|
||||
|
||||
module.exports = {
|
||||
getToday: function (req, res) {
|
||||
console.log( util.inspect(todayCache.data.trains));
|
||||
res.render('pages/today', todayCache);
|
||||
},
|
||||
|
||||
@ -44,15 +43,10 @@ module.exports = {
|
||||
var lu = $('DIV#LU').first();
|
||||
|
||||
var us = lu.find('.updatesSection').first();
|
||||
|
||||
|
||||
|
||||
us.find('.updateTitle').each(function (div) {
|
||||
var wO = {title: '', description: ''};
|
||||
|
||||
title = $(this).find('A').first().text().trim();
|
||||
wO.title = title;
|
||||
console.log(wO.title);
|
||||
outputArray.push(wO);
|
||||
});
|
||||
|
||||
@ -76,12 +70,11 @@ module.exports = {
|
||||
|
||||
// join arrays
|
||||
|
||||
for (var i = 0;i < outputArray.length;i++)
|
||||
{
|
||||
for (var i = 0; i < outputArray.length; i++) {
|
||||
todayCache.data.trains.data.push(outputArray[i])
|
||||
}
|
||||
console.log("outputArray array length:" + outputArray.length );
|
||||
console.log("array length:" + todayCache.data.trains.data.length );
|
||||
console.log("outputArray array length:" + outputArray.length);
|
||||
console.log("array length:" + todayCache.data.trains.data.length);
|
||||
});
|
||||
|
||||
todayCache.data.trains.last = now;
|
||||
@ -89,64 +82,64 @@ module.exports = {
|
||||
// todayCache.data.trains.data = j;
|
||||
|
||||
}
|
||||
,
|
||||
updateTrains: function () {
|
||||
todayCache.data.trains.data = [];
|
||||
module.exports.getTrainUpdates(0);
|
||||
module.exports.getTrainUpdates(1);
|
||||
,
|
||||
updateTrains: function () {
|
||||
todayCache.data.trains.data = [];
|
||||
module.exports.getTrainUpdates(0);
|
||||
module.exports.getTrainUpdates(1);
|
||||
|
||||
setTimeout(function () {
|
||||
module.exports.updateTrains();
|
||||
}, todayCache.expire);
|
||||
}
|
||||
,
|
||||
setTimeout(function () {
|
||||
module.exports.updateTrains();
|
||||
}, todayCache.expire);
|
||||
}
|
||||
,
|
||||
|
||||
doGetWeatherOutlook: function () {
|
||||
console.log('Retrieving weather..');
|
||||
var j = {};
|
||||
var forecast = new Forecast(forecastOptions);
|
||||
doGetWeatherOutlook: function () {
|
||||
console.log('Retrieving weather..');
|
||||
var j = {};
|
||||
var forecast = new Forecast(forecastOptions);
|
||||
//55.8582846,-4.2593033
|
||||
forecast.get(55.8582846, -4.2593033, {units: 'uk2'}, function (err, res, data) {
|
||||
if (err) throw err;
|
||||
forecast.get(55.8582846, -4.2593033, {units: 'uk2'}, function (err, res, data) {
|
||||
if (err) throw err;
|
||||
|
||||
// console.log('data: ' + util.inspect(data));
|
||||
// console.log('data: ' + util.inspect(data));
|
||||
|
||||
j.currently = data.currently.summary;
|
||||
j.today = data.daily.summary;
|
||||
j.alerts = data.alerts || {};
|
||||
j.currently = data.currently.summary;
|
||||
j.today = data.daily.summary;
|
||||
j.alerts = data.alerts || {};
|
||||
|
||||
todayCache.data.weather = j;
|
||||
todayCache.data.weather = j;
|
||||
|
||||
// console.log(j.currently);
|
||||
// console.log(j.today);
|
||||
// console.log(j.alerts);
|
||||
});
|
||||
// console.log(j.currently);
|
||||
// console.log(j.today);
|
||||
// console.log(j.alerts);
|
||||
});
|
||||
|
||||
}
|
||||
,
|
||||
preLoadToday: function () {
|
||||
try {
|
||||
module.exports.doGetWeatherOutlook();
|
||||
}
|
||||
catch (e) {
|
||||
// statements to handle any exceptions
|
||||
console.log('ERROR:');
|
||||
console.log(e);
|
||||
}
|
||||
,
|
||||
preLoadToday: function () {
|
||||
try {
|
||||
module.exports.doGetWeatherOutlook();
|
||||
}
|
||||
catch (e) {
|
||||
// statements to handle any exceptions
|
||||
console.log('ERROR:');
|
||||
console.log(e);
|
||||
}
|
||||
|
||||
try {
|
||||
module.exports.updateTrains();
|
||||
}
|
||||
catch (e) {
|
||||
// statements to handle any exceptions
|
||||
console.log('ERROR:');
|
||||
console.log(e);
|
||||
}
|
||||
try {
|
||||
module.exports.updateTrains();
|
||||
}
|
||||
catch (e) {
|
||||
// statements to handle any exceptions
|
||||
console.log('ERROR:');
|
||||
console.log(e);
|
||||
}
|
||||
|
||||
setTimeout(function () {
|
||||
module.exports.preLoadToday();
|
||||
}, todayCache.expire);
|
||||
}
|
||||
setTimeout(function () {
|
||||
module.exports.preLoadToday();
|
||||
}, todayCache.expire);
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user