Add unknown weather data flag

This commit is contained in:
2021-09-05 14:17:18 +02:00
parent 47b199702a
commit 51e0565e67
2 changed files with 11 additions and 6 deletions

View File

@@ -237,11 +237,14 @@ class Feed extends PhpObject {
$sWeatherCond = $asWeather['currentConditions']['conditions'];
$sWeatherTemp = $asWeather['currentConditions']['temp'];
}
else { //Daily Conditions
elseif($asWeather['days'][0]['icon'] != '') { //Daily Conditions
$sWeatherIcon = $asWeather['days'][0]['icon'];
$sWeatherCond = $asWeather['days'][0]['conditions'];
$sWeatherTemp = $asWeather['days'][0]['temp'];
}
else {
$sWeatherIcon = 'unknown';
}
//Get Condition ID
$sCondKey = (new Translator(self::WEATHER_PARAM['lang']))->getTranslationKey($sWeatherCond);

View File

@@ -624,7 +624,7 @@ function addSpotMessages(aoMessages) {
}
//Weather
if(oMsg.weather_icon) {
if(oMsg.weather_icon && oMsg.weather_icon!='unknown') {
$Tooltip.append($('<p>', {'class':'weather', 'title':oSpot.lang(oMsg.weather_cond)})
.addIcon('fa-'+oMsg.weather_icon+' fa-fw fa-lg', true)
.append(oMsg.weather_temp+'°C')
@@ -780,10 +780,12 @@ function focusOnPost(oFocusPost) {
var $Post = oSpot.tmp('$PostList').find(sElemId);
var bGetToTop = (oSpot.tmp('$PostList').height() - (($Post.length > 0)?$Post.position().top:0) >= $(window).height());
if($Post.length > 0 && (bGetToTop || self.tmp('out-of-data'))) {
self.tmp('simple-bar').getScrollElement().scrollTop =
parseInt($Post.position().top) +
self.tmp('simple-bar').getScrollElement().scrollTop = Math.round(
$Post.position().top +
parseInt($Post.css('margin-top')) +
(self.tmp('$Poster').is(':visible')?self.tmp('$Poster').outerHeight(true):0);
(self.tmp('$Poster').is(':visible')?self.tmp('$Poster').outerHeight(true):0)
);
if(oFocusPost.type=='media' || oFocusPost.type=='message') $Post.find('a.drill').click();
}
else if(!self.tmp('out-of-data')) updateFeed(false, false, function() {focusOnPost(oFocusPost);});
@@ -820,7 +822,7 @@ function getPost(asPost) {
.append($('<p>').addIcon('fa-time', true).append(sAbsTime))
.append(bTimeDiff?$('<p>').addIcon('fa-timezone', true).append(oSpot.lang('local_time', sAbsTimeLocal)):'')
.append($('<a>', {'class':'drill'})
.append((!asPost.weather_icon)?'':$('<span>', {'class':'weather', 'title':oSpot.lang(asPost.weather_cond)}).addIcon('fa-'+asPost.weather_icon, true).append(asPost.weather_temp+'°C'))
.append((!asPost.weather_icon || asPost.weather_icon=='unknown')?'':$('<span>', {'class':'weather', 'title':oSpot.lang(asPost.weather_cond)}).addIcon('fa-'+asPost.weather_icon, true).append(asPost.weather_temp+'°C'))
.append($('<img>', {'class':'staticmap', title: oSpot.lang('click_zoom'), src: getWmtsApiUrl('static', asPost.latitude, asPost.longitude, 13)}))
.append($('<span>', {'class': 'drill-icon fa-stack'})
.addIcon('fa-message fa-stack-2x')