Skip to content

Instantly share code, notes, and snippets.

@azhurb
Created August 26, 2015 10:33
Show Gist options
  • Select an option

  • Save azhurb/ea322d7a12d944feb1d1 to your computer and use it in GitHub Desktop.

Select an option

Save azhurb/ea322d7a12d944feb1d1 to your computer and use it in GitHub Desktop.
Display day min and max temperature in the current weather widget.
Index: c/weather.current.js
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- c/weather.current.js (revision 0f15c773e5d7d29b7400860ad2aba209ef0a2898)
+++ c/weather.current.js (revision )
@@ -62,10 +62,10 @@
var cur = '<div class="curweather_img"><img src="template/' + loader.template + '/i' + resolution_prefix + '/' + this.current.pict + '"/></div>';
cur += '<div class="city">' + this.current.city + '</div>';
- cur += '<div class="curweather_descr">' + this.current.t +'&deg; C<br>';
+ cur += '<div class="curweather_descr">' + this.current.t +'&deg; C, ';
cur += this.current.cloud_str + '<br>';
- if (this.current.t_flik){
- cur += '<span class="curweather_title">' + word['weather_comfort'] + ':</span> ' + this.current.t_flik +'&deg; C<br>';
+ if (this.current.hasOwnProperty('temperature')){
+ cur += this.current.temperature + '<br>';
}
cur += '<span class="curweather_title">' + word['weather_pressure'] + ':</span> ' + this.current.p + ' ' + word['weather_mmhg'] +'<br>';
cur += '<div class="curweather_wind"><div class="curweather_title" style="float: left">' + word['weather_wind'] + ':</div><div class="wind_direction_'+this.current.w_rumb_str+'">&uarr;</div> <div style="float: left;"> ' + this.current.w + ' ' + word['weather_speed'] + '</div></div><br>';
\ No newline at end of file
Index: server/lib/openweathermap.class.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- server/lib/openweathermap.class.php (revision 0f15c773e5d7d29b7400860ad2aba209ef0a2898)
+++ server/lib/openweathermap.class.php (revision )
@@ -102,6 +102,13 @@
$current['cloud_str'] = _($current['cloud_str']);
$current['w_rumb_str'] = str_replace('/', '', $current['w_rumb_str']);
+ $forecast = $this->getForecast();
+
+ if (!empty($forecast['forecast'][0]['t'])){
+ $day = $forecast['forecast'][0];
+ $current['temperature'] = (($day['t']['min']) > 0 ? '+' : '').$day['t']['min'].'..'.(($day['t']['max']) > 0 ? '+' : '').$day['t']['max'].'&deg;';
+ }
+
return $this->postParse($current);
}
\ No newline at end of file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment