diff --git a/src/extension.js b/src/extension.js index d5c66cf..609673d 100644 --- a/src/extension.js +++ b/src/extension.js @@ -139,7 +139,7 @@ const WeatherMenuButton = new Lang.Class({ text: _('...') }); - if (typeof St.TextDirection == 'undefined') { + if (St.TextDirection == undefined) { // Panel icon this._weatherIcon = new St.Icon({ icon_name: 'view-refresh' + this.icon_type(), @@ -191,7 +191,7 @@ const WeatherMenuButton = new Lang.Class({ Main.panel._rightBox.insert_child_at_index(this.actor, 0); break; } - if (typeof Main.panel._menus == 'undefined') + if (Main.panel._menus == undefined) Main.panel.menuManager.addMenu(this.menu); else Main.panel._menus.addMenu(this.menu); @@ -285,8 +285,8 @@ const WeatherMenuButton = new Lang.Class({ this._settingsC = this._settings.connect("changed", function() { that.rebuildFutureWeatherUi(); if (that.locationChanged()) { - that.currentWeatherCache = 'undefined'; - that.forecastWeatherCache = 'undefined'; + that.currentWeatherCache = undefined; + that.forecastWeatherCache = undefined; } that.parseWeatherCurrent(); that.parseWeatherForecast(); @@ -303,8 +303,8 @@ const WeatherMenuButton = new Lang.Class({ }); this._settingsInterfaceC = this._settingsInterface.connect("changed", function() { if (that.locationChanged()) { - that.currentWeatherCache = 'undefined'; - that.forecastWeatherCache = 'undefined'; + that.currentWeatherCache = undefined; + that.forecastWeatherCache = undefined; } that.parseWeatherCurrent(); that.parseWeatherForecast(); @@ -700,7 +700,7 @@ const WeatherMenuButton = new Lang.Class({ }, _onOpenStateChanged: function(menu, open) { - if (open && typeof this._forecastScrollBox != 'undefined' && typeof this._forecastBox != 'undefined' && typeof this._currentWeather != 'undefined') { + if (open && this._forecastScrollBox != undefined && this._forecastBox != undefined && this._currentWeather != undefined) { this._forecastScrollBox.set_width(this._currentWeather.get_width()); if (this._forecastBox.get_width() > this._currentWeather.get_width()) { this._forecastScrollBox.hscroll.margin_top = 10; @@ -1094,7 +1094,7 @@ weather-storm.png = weather-storm-symbolic.svg }, parseWeatherCurrent: function() { - if (this.currentWeatherCache == 'undefined') { + if (this.currentWeatherCache == undefined) { this.refreshWeatherCurrent(); return; } @@ -1154,10 +1154,10 @@ weather-storm.png = weather-storm-symbolic.svg let iconname = this.get_weather_icon_safely(json.weather[0].id, now < sunrise || now > sunset); - if (typeof this.lastBuildId == 'undefined') + if (this.lastBuildId == undefined) this.lastBuildId = 0; - if (typeof this.lastBuildDate == 'undefined') + if (this.lastBuildDate == undefined) this.lastBuildDate = 0; if (this.lastBuildId != json.dt || !this.lastBuildDate) { @@ -1369,7 +1369,7 @@ weather-storm.png = weather-storm-symbolic.svg }, parseWeatherForecast: function() { - if (this.forecastWeatherCache == 'undefined') { + if (this.forecastWeatherCache == undefined) { this.refreshWeatherForecast(); return; } @@ -1381,7 +1381,7 @@ weather-storm.png = weather-storm-symbolic.svg for (let i = 0; i < this._days_forecast; i++) { let forecastUi = this._forecast[i]; let forecastData = forecast[i]; - if (forecastData == 'undefined') + if (forecastData == undefined) continue; let t_low = forecastData.temp.min; diff --git a/src/prefs.js b/src/prefs.js index db2fc17..19f6dc0 100644 --- a/src/prefs.js +++ b/src/prefs.js @@ -157,7 +157,7 @@ const WeatherPrefsWidget = new GObject.Class({ this.Window.get_object("tree-toolbutton-remove").sensitive = Boolean(this.city.length); if (mCities != this.city) { - if (typeof this.liststore != "undefined") + if (this.liststore != undefined) this.liststore.clear(); if (this.city.length > 0) { @@ -290,7 +290,7 @@ const WeatherPrefsWidget = new GObject.Class({ selectionChanged: function(select) { let a = select.get_selected_rows(this.liststore)[0][0]; - if (typeof a != "undefined") + if (a != undefined) if (this.actual_city != parseInt(a.to_string())) this.actual_city = parseInt(a.to_string()); }, @@ -350,7 +350,7 @@ const WeatherPrefsWidget = new GObject.Class({ id: id }, function() { d.sensitive = 0; - if (typeof arguments[0] == "undefined") + if (arguments[0] == undefined) return 0; let city = arguments[0]; @@ -397,7 +397,7 @@ const WeatherPrefsWidget = new GObject.Class({ let current = this.liststore.get_iter_first(); for (var i in city) { - if (typeof m == "undefined") + if (m == undefined) var m = {}; current = completionModel.append(); @@ -546,10 +546,10 @@ const WeatherPrefsWidget = new GObject.Class({ let message = Soup.form_request_new_from_hash('GET', url, params); - if (typeof this.asyncSession == "undefined") + if (this.asyncSession == undefined) this.asyncSession = {}; - if (typeof this.asyncSession[id] != "undefined" && this.asyncSession[id]) { + if (this.asyncSession[id] != undefined && this.asyncSession[id]) { _httpSession.abort(); this.asyncSession[id] = 0; }