diff --git a/js/jquery.simpleopenweather.js b/js/jquery.simpleopenweather.js
index 62bd37e..62e09b6 100644
--- a/js/jquery.simpleopenweather.js
+++ b/js/jquery.simpleopenweather.js
@@ -1,7 +1,7 @@
(function( $ ){
$.fn.simpleopenweather = function(options){
var defaults = {
- template : '
{{icon}} {{place}}: {{sky}}
Temp: {{temperature.current}} ºC Humidity: {{humidity}}%
Temp min/max: {{temperature.min}} ºC /{{temperature.max}} ºC
Wind: {{wind.speed}} m/s {{wind.direction}}º
Cloudiness: {{cloudiness}}% Pressure: {{pressure}} kPa
',
+ template : ' {{icon}} {{place}}: {{sky}}
Temp: {{temperature.current}} ºC Humidity: {{humidity}}%
Temp min/max: {{temperature.min}} ºC /{{temperature.max}} ºC
Wind: {{wind.speed}} m/s {{wind.direction}}º
Cloudiness: {{cloudiness}}% Pressure: {{pressure}} hPa
',
noweather : 'no weather report was found for that place!
',
error : 'something went wrong!
',
latitude : 0,
@@ -9,7 +9,8 @@
units : 'imperial',
lang : 'en',
iconset : 'http://openweathermap.org/img/w/',
- iconfont : false
+ iconfont : false,
+ appid : ''
}
var settings = $.extend(defaults, options);
@@ -36,6 +37,10 @@
} else{
openweathermap_url += "&units="+'imperial';
}
+ if(settings.appid != ''){
+ openweathermap_url += "&APPID="+settings.appid;
+ }
+
console.log(openweathermap_url);
$.ajax({
@@ -69,7 +74,6 @@
cloudiness : weather.clouds ? weather.clouds.all : "N/A",
sky : weather.weather[0].description,
icon : icon_name,
- iconname : weather.weather[0].icon,
place : weather.name
};
@@ -84,7 +88,6 @@
.replace(/{{wind.direction}}/ig, info.wind.direction)
.replace(/{{cloudiness}}/ig, info.cloudiness)
.replace(/{{icon}}/ig, ((settings.iconfont) ? ''+info.icon+'' : ''))
- .replace(/{{iconname}}/ig, info.iconname)
.replace(/{{sky}}/ig, info.sky));
},
error : function(){
diff --git a/weather_portal.class.php b/weather_portal.class.php
index 10b7dc6..e151304 100644
--- a/weather_portal.class.php
+++ b/weather_portal.class.php
@@ -29,7 +29,7 @@ class weather_portal extends portal_generic {
protected static $path = 'weather';
protected static $data = array(
'name' => 'Weather',
- 'version' => '4.0.0',
+ 'version' => '4.1.0',
'author' => 'WalleniuM',
'icon' => 'fa-cloud',
'contact' => EQDKP_PROJECT_URL,
@@ -99,6 +99,7 @@ public function output() {
$temperature_unit = ($this->config('tempformat') == 'F') ? '°F' : '°C';
$tempformat = ($this->config('tempformat') == 'F') ? 'imperial' : 'metric';
+ $appID = '';
$strCountry = $this->config('default_country');
$strTown = $this->config('default_town');
@@ -115,7 +116,7 @@ public function output() {
//User has both in his profile
if($strUserCountry != "" && $strUserTown != ""){
- $this->tpl->add_js('$("#weather_'.$this->id.'").simpleopenweather({template: \' {{place}}
{{icon}}{{temperature}} '.$temperature_unit.'
{{sky}}
{{humidity}} %
{{wind.speed}} m/s, {{wind.direction}} °
\', lang:"'.$this->user->lang('XML_LANG').'", units: "'.$tempformat.'", iconfont: true});', "docready");
+ $this->tpl->add_js('$("#weather_'.$this->id.'").simpleopenweather({template: \'
{{place}}
{{icon}}{{temperature}} '.$temperature_unit.'
{{sky}}
{{humidity}} %
{{wind.speed}} m/s, {{wind.direction}} °
\', lang:"'.$this->user->lang('XML_LANG').'", units: "'.$tempformat.'", iconfont: true, appid="'.$appID.'"});', "docready");
return '
';
} elseif($this->config('geolocation') == '1'){
@@ -128,7 +129,7 @@ public function output() {
}
function locationSuccess(position) {
- $("#weather_'.$this->id.'").simpleopenweather({latitude: position.coords.latitude, longitude: position.coords.longitude, template: \'
{{place}}
{{icon}}{{temperature}} '.$temperature_unit.'
{{sky}}
{{humidity}} %
{{wind.speed}} m/s, {{wind.direction}} °
\', lang:"'.$this->user->lang('XML_LANG').'", units: "'.$tempformat.'", iconfont: true});
+ $("#weather_'.$this->id.'").simpleopenweather({latitude: position.coords.latitude, longitude: position.coords.longitude, template: \'
{{place}}
{{icon}}{{temperature}} '.$temperature_unit.'
{{sky}}
{{humidity}} %
{{wind.speed}} m/s, {{wind.direction}} °
\', lang:"'.$this->user->lang('XML_LANG').'", units: "'.$tempformat.'", iconfont: true, appid="'.$appID.'"});
}
function showError(msg){
$("#error").html(msg);
@@ -137,7 +138,7 @@ function showError(msg){
$js .= '
function locationError(error){
$("#weather_'.$this->id.'").attr("data-simpleopenweather-city", "'.$strTown.', '.$strCountry.'");
- $("#weather_'.$this->id.'").simpleopenweather({template: \'
{{place}}
{{icon}}{{temperature}} '.$temperature_unit.'
{{sky}}
{{humidity}} %
{{wind.speed}} m/s, {{wind.direction}} °
\', lang:"'.$this->user->lang('XML_LANG').'", units: "'.$tempformat.'", iconfont: true});
+ $("#weather_'.$this->id.'").simpleopenweather({template: \'
{{place}}
{{icon}}{{temperature}} '.$temperature_unit.'
{{sky}}
{{humidity}} %
{{wind.speed}} m/s, {{wind.direction}} °
\', lang:"'.$this->user->lang('XML_LANG').'", units: "'.$tempformat.'", iconfont: true, appid="'.$appID.'"});
}
';
} else {
@@ -153,7 +154,7 @@ function locationError(error){
return '
';
}elseif($strCountry != "" && $strTown != ""){
//Show the default weather
- $this->tpl->add_js('$("#weather_'.$this->id.'").simpleopenweather({template: \'
{{place}}
{{icon}}{{temperature}} '.$temperature_unit.'
{{sky}}
{{humidity}} %
{{wind.speed}} m/s, {{wind.direction}} °
\', lang:"'.$this->user->lang('XML_LANG').'", units: "'.$tempformat.'", iconfont: true});', "docready");
+ $this->tpl->add_js('$("#weather_'.$this->id.'").simpleopenweather({template: \'
{{place}}
{{icon}}{{temperature}} '.$temperature_unit.'
{{sky}}
{{humidity}} %
{{wind.speed}} m/s, {{wind.direction}} °
\', lang:"'.$this->user->lang('XML_LANG').'", units: "'.$tempformat.'", iconfont: true, appid="'.$appID.'"});', "docready");
return '
';
}else {