mirror of
https://gitlab.silvrtree.co.uk/martind2000/old-silvrgit.git
synced 2025-01-25 17:56:17 +00:00
console.log tidy
This commit is contained in:
parent
258396c06f
commit
0531b14949
17
lib/today.js
17
lib/today.js
@ -1,7 +1,6 @@
|
||||
/**
|
||||
* Created by marti on 30/01/2016.
|
||||
*/
|
||||
|
||||
var http = require('http'), request = require('request'), cheerio = require('cheerio'), Forecast = require('forecast.io'), util = require('util');
|
||||
|
||||
var todayCache = {
|
||||
@ -81,8 +80,7 @@ module.exports = {
|
||||
|
||||
// todayCache.data.trains.data = j;
|
||||
|
||||
}
|
||||
,
|
||||
},
|
||||
updateTrains: function () {
|
||||
todayCache.data.trains.data = [];
|
||||
module.exports.getTrainUpdates(0);
|
||||
@ -91,32 +89,23 @@ module.exports = {
|
||||
setTimeout(function () {
|
||||
module.exports.updateTrains();
|
||||
}, todayCache.expire);
|
||||
}
|
||||
,
|
||||
},
|
||||
|
||||
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;
|
||||
|
||||
// console.log('data: ' + util.inspect(data));
|
||||
|
||||
j.currently = data.currently.summary;
|
||||
j.today = data.daily.summary;
|
||||
j.alerts = data.alerts || {};
|
||||
|
||||
todayCache.data.weather = j;
|
||||
|
||||
// console.log(j.currently);
|
||||
// console.log(j.today);
|
||||
// console.log(j.alerts);
|
||||
});
|
||||
|
||||
}
|
||||
,
|
||||
},
|
||||
preLoadToday: function () {
|
||||
try {
|
||||
module.exports.doGetWeatherOutlook();
|
||||
|
@ -8,6 +8,7 @@
|
||||
"htmlparser": "^1.7.7",
|
||||
"mammoth": "^0.3.25-pre.1",
|
||||
"request": "^2.67.0",
|
||||
"simple-weather": "^1.2.2",
|
||||
"wordsoap": "^0.2.0"
|
||||
},
|
||||
"dependencies": {
|
||||
|
@ -54,7 +54,9 @@
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
|
||||
.mui--text-danger {
|
||||
color: #F44336;
|
||||
}
|
||||
</style>
|
||||
<script src="//cdnjs.cloudflare.com/ajax/libs/zepto/1.1.4/zepto.min.js"></script>
|
||||
</head>
|
||||
|
@ -4,4 +4,19 @@
|
||||
<h1>Weather</h1>
|
||||
<div class="mui-row"><div class="mui-col-md-12">Currently: <%=data.weather.currently%></div></div>
|
||||
<div class="mui-row"><div class="mui-col-md-12">Later: <%=data.weather.today%></div></div>
|
||||
|
||||
<% if (data.weather.alerts.length > 0) {
|
||||
for (var i =0; i < data.weather.alerts.length; i++) {
|
||||
%>
|
||||
|
||||
<div class="mui-row">
|
||||
<div class="mui-col-md-12 mui--text-danger"><%=data.weather.alerts[i].title%></div>
|
||||
<div class="mui-col-md-12"><%=data.weather.alerts[i].description%></div>
|
||||
</div>
|
||||
|
||||
<%
|
||||
|
||||
}
|
||||
}%>
|
||||
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user