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']; $sWeatherCond = $asWeather['currentConditions']['conditions'];
$sWeatherTemp = $asWeather['currentConditions']['temp']; $sWeatherTemp = $asWeather['currentConditions']['temp'];
} }
else { //Daily Conditions elseif($asWeather['days'][0]['icon'] != '') { //Daily Conditions
$sWeatherIcon = $asWeather['days'][0]['icon']; $sWeatherIcon = $asWeather['days'][0]['icon'];
$sWeatherCond = $asWeather['days'][0]['conditions']; $sWeatherCond = $asWeather['days'][0]['conditions'];
$sWeatherTemp = $asWeather['days'][0]['temp']; $sWeatherTemp = $asWeather['days'][0]['temp'];
} }
else {
$sWeatherIcon = 'unknown';
}
//Get Condition ID //Get Condition ID
$sCondKey = (new Translator(self::WEATHER_PARAM['lang']))->getTranslationKey($sWeatherCond); $sCondKey = (new Translator(self::WEATHER_PARAM['lang']))->getTranslationKey($sWeatherCond);

View File

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