Fix Javascript problems

master
Alfred Egger 2019-05-22 16:05:10 +02:00
parent 4523922f81
commit 91064d5acf
1 changed files with 3 additions and 3 deletions

View File

@ -14,7 +14,7 @@ var app = angular.module('Weather', []);
var g_error500 = t('weather', 'Fatal Error: please check your nextcloud.log and send a bug report here: https://github.com/nextcloud/weather/issues'); var g_error500 = t('weather', 'Fatal Error: please check your nextcloud.log and send a bug report here: https://github.com/nextcloud/weather/issues');
function undef (obj) { function undef (obj) {
return typeof obj === undefined || obj === undefined; return typeof obj === 'undefined' || obj === undefined;
} }
function emptyStr (obj) { function emptyStr (obj) {
@ -127,7 +127,7 @@ app.controller('WeatherController', ['$scope', '$interval', '$timeout', '$compil
if (!undef(r.data['home'])) { if (!undef(r.data['home'])) {
$scope.homeCity = r.data['home']; $scope.homeCity = r.data['home'];
if ($scope.homeCity) { if ($scope.homeCity) {
for (i = 0; i < $scope.cities.length; i++) { for (var i = 0; i < $scope.cities.length; i++) {
if ($scope.cities[i].id == $scope.homeCity) { if ($scope.cities[i].id == $scope.homeCity) {
$scope.loadCity($scope.cities[i]); $scope.loadCity($scope.cities[i]);
return; return;
@ -183,7 +183,7 @@ app.controller('WeatherController', ['$scope', '$interval', '$timeout', '$compil
else if ($scope.currentCity.wind.deg > 244 && $scope.currentCity.wind.deg < 289) { else if ($scope.currentCity.wind.deg > 244 && $scope.currentCity.wind.deg < 289) {
$scope.currentCity.wind.desc = t('weather', 'West'); $scope.currentCity.wind.desc = t('weather', 'West');
} }
else if ($scope.currentCity.wind.deg > 288 && $scope.currentCity.wind.deg < 334) { else if ($scope.currentCity.wind.deg > 288) {
$scope.currentCity.wind.desc = t('weather', 'North-West'); $scope.currentCity.wind.desc = t('weather', 'North-West');
} }
$scope.cityLoadError = ''; $scope.cityLoadError = '';