weather works
This commit is contained in:
39
app/client/weather.js
Normal file
39
app/client/weather.js
Normal file
@@ -0,0 +1,39 @@
|
||||
var options = {
|
||||
|
||||
location: 44.0123 + ',' + 18.19455, // New Visoko
|
||||
unit: 'c',
|
||||
success: function(weather) {
|
||||
html = "<h2><i class='sw icon-" + weather.code + "'></i>";
|
||||
html += weather.temp + '°' + weather.units.temp + '</h2>';
|
||||
html += '<ul><li>' + weather.city + ', ' + weather.region + '</li>';
|
||||
html += "<li class='currently'>" + weather.currently + '</li>';
|
||||
html += '<hr />';
|
||||
|
||||
for (var i = 0; i < 5; i++) {
|
||||
var forecast = weather.forecast[i];
|
||||
html += '<div>';
|
||||
html += "<h2><i class='sw icon-" + forecast.code + "'></i>";
|
||||
html += forecast.high + '°' + weather.units.temp + '</h2>';
|
||||
html += "<li class='currently'>" + daysInBosnian[forecast.day] + ': ' + forecast.text + '</li>';
|
||||
html += "</div>";
|
||||
|
||||
}
|
||||
|
||||
$('#weather').html(html);
|
||||
},
|
||||
error: function(error) {
|
||||
$('#weather').html('<p>' + error + '</p>');
|
||||
}
|
||||
}
|
||||
|
||||
var daysInBosnian = {
|
||||
'Sun': 'Nedjelja',
|
||||
'Mon': 'Ponedjeljak',
|
||||
'Tue': 'Utorak',
|
||||
'Wed': 'Srijeda',
|
||||
'Thu': 'Četvrtak',
|
||||
'Fri': 'Petak',
|
||||
'Sat': 'Subota'
|
||||
};
|
||||
|
||||
Weather.options = options
|
||||
Reference in New Issue
Block a user