remove window. references
This commit is contained in:
parent
cc61d2c6d1
commit
72b2f275fa
|
@ -2,8 +2,9 @@
|
|||
import { loadImg, preloadImg } from './utils/image.mjs';
|
||||
import { DateTime } from '../vendor/auto/luxon.mjs';
|
||||
import STATUS from './status.mjs';
|
||||
import WeatherDisplay from './weatherdisplay.mjs';
|
||||
|
||||
/* globals WeatherDisplay, SunCalc */
|
||||
/* globals SunCalc */
|
||||
|
||||
class Almanac extends WeatherDisplay {
|
||||
constructor(navId, elemId) {
|
||||
|
@ -171,5 +172,3 @@ class Almanac extends WeatherDisplay {
|
|||
}
|
||||
|
||||
export default Almanac;
|
||||
|
||||
window.Almanac = Almanac;
|
||||
|
|
|
@ -7,8 +7,9 @@ import { directionToNSEW } from './utils/calc.mjs';
|
|||
import * as units from './utils/units.mjs';
|
||||
import { locationCleanup } from './utils/string.mjs';
|
||||
import { getWeatherIconFromIconLink } from './icons.mjs';
|
||||
import WeatherDisplay from './weatherdisplay.mjs';
|
||||
|
||||
/* globals WeatherDisplay, navigation */
|
||||
/* globals navigation */
|
||||
|
||||
class CurrentWeather extends WeatherDisplay {
|
||||
constructor(navId, elemId) {
|
||||
|
@ -191,5 +192,3 @@ class CurrentWeather extends WeatherDisplay {
|
|||
}
|
||||
|
||||
export default CurrentWeather;
|
||||
|
||||
window.CurrentWeather = CurrentWeather;
|
||||
|
|
|
@ -98,8 +98,3 @@ export {
|
|||
start,
|
||||
stop,
|
||||
};
|
||||
|
||||
window.currentWeatherScroll = {
|
||||
start,
|
||||
stop,
|
||||
};
|
||||
|
|
|
@ -8,8 +8,9 @@ import { DateTime } from '../vendor/auto/luxon.mjs';
|
|||
import { fahrenheitToCelsius } from './utils/units.mjs';
|
||||
import { getWeatherIconFromIconLink } from './icons.mjs';
|
||||
import { preloadImg } from './utils/image.mjs';
|
||||
import WeatherDisplay from './weatherdisplay.mjs';
|
||||
|
||||
/* globals WeatherDisplay, navigation */
|
||||
/* globals navigation */
|
||||
|
||||
class ExtendedForecast extends WeatherDisplay {
|
||||
constructor(navId, elemId) {
|
||||
|
@ -167,5 +168,3 @@ class ExtendedForecast extends WeatherDisplay {
|
|||
}
|
||||
|
||||
export default ExtendedForecast;
|
||||
|
||||
window.ExtendedForecast = ExtendedForecast;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// hourly forecast list
|
||||
/* globals WeatherDisplay, navigation */
|
||||
/* globals navigation */
|
||||
|
||||
import STATUS from './status.mjs';
|
||||
import { DateTime, Interval, Duration } from '../vendor/auto/luxon.mjs';
|
||||
|
@ -8,6 +8,7 @@ import { UNITS } from './config.mjs';
|
|||
import * as units from './utils/units.mjs';
|
||||
import { getHourlyIcon } from './icons.mjs';
|
||||
import { directionToNSEW } from './utils/calc.mjs';
|
||||
import WeatherDisplay from './weatherdisplay.mjs';
|
||||
|
||||
class Hourly extends WeatherDisplay {
|
||||
constructor(navId, elemId, defaultActive) {
|
||||
|
@ -198,5 +199,3 @@ class Hourly extends WeatherDisplay {
|
|||
}
|
||||
|
||||
export default Hourly;
|
||||
|
||||
window.Hourly = Hourly;
|
||||
|
|
|
@ -331,9 +331,3 @@ export {
|
|||
getWeatherRegionalIconFromIconLink,
|
||||
getHourlyIcon,
|
||||
};
|
||||
|
||||
window.icons = {
|
||||
getWeatherIconFromIconLink,
|
||||
getWeatherRegionalIconFromIconLink,
|
||||
getHourlyIcon,
|
||||
};
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
// current weather conditions display
|
||||
/* globals WeatherDisplay, navigation, StationInfo */
|
||||
/* globals navigation, StationInfo */
|
||||
import { distance as calcDistance, directionToNSEW } from './utils/calc.mjs';
|
||||
import { json } from './utils/fetch.mjs';
|
||||
import STATUS from './status.mjs';
|
||||
import { locationCleanup } from './utils/string.mjs';
|
||||
import { UNITS } from './config.mjs';
|
||||
import * as units from './utils/units.mjs';
|
||||
import WeatherDisplay from './weatherdisplay.mjs';
|
||||
|
||||
class LatestObservations extends WeatherDisplay {
|
||||
constructor(navId, elemId) {
|
||||
|
@ -131,5 +132,3 @@ class LatestObservations extends WeatherDisplay {
|
|||
return condition;
|
||||
}
|
||||
}
|
||||
|
||||
window.LatestObservations = LatestObservations;
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
// display text based local forecast
|
||||
|
||||
/* globals WeatherDisplay, navigation */
|
||||
/* globals navigation */
|
||||
import STATUS from './status.mjs';
|
||||
import { UNITS } from './config.mjs';
|
||||
import { json } from './utils/fetch.mjs';
|
||||
import WeatherDisplay from './weatherdisplay.mjs';
|
||||
|
||||
class LocalForecast extends WeatherDisplay {
|
||||
constructor(navId, elemId) {
|
||||
|
@ -96,5 +97,3 @@ class LocalForecast extends WeatherDisplay {
|
|||
}));
|
||||
}
|
||||
}
|
||||
|
||||
window.LocalForecast = LocalForecast;
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
// regional forecast and observations
|
||||
/* globals WeatherDisplay, navigation */
|
||||
/* globals navigation */
|
||||
import { loadImg } from './utils/image.mjs';
|
||||
import STATUS from './status.mjs';
|
||||
import WeatherDisplay from './weatherdisplay.mjs';
|
||||
|
||||
class Progress extends WeatherDisplay {
|
||||
constructor(navId, elemId) {
|
||||
|
@ -102,4 +103,6 @@ class Progress extends WeatherDisplay {
|
|||
}
|
||||
}
|
||||
|
||||
export default Progress;
|
||||
|
||||
window.Progress = Progress;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
// current weather conditions display
|
||||
/* globals WeatherDisplay */
|
||||
import STATUS from './status.mjs';
|
||||
import { DateTime } from '../vendor/auto/luxon.mjs';
|
||||
import { loadImg } from './utils/image.mjs';
|
||||
import { text } from './utils/fetch.mjs';
|
||||
import { rewriteUrl } from './utils/cors.mjs';
|
||||
import WeatherDisplay from './weatherdisplay.mjs';
|
||||
|
||||
class Radar extends WeatherDisplay {
|
||||
constructor(navId, elemId) {
|
||||
|
@ -397,4 +397,4 @@ class Radar extends WeatherDisplay {
|
|||
}
|
||||
}
|
||||
|
||||
window.Radar = Radar;
|
||||
export default Radar;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// regional forecast and observations
|
||||
// type 0 = observations, 1 = first forecast, 2 = second forecast
|
||||
|
||||
/* globals WeatherDisplay, navigation, StationInfo, RegionalCities */
|
||||
/* globals navigation, StationInfo, RegionalCities */
|
||||
import STATUS from './status.mjs';
|
||||
import { UNITS } from './config.mjs';
|
||||
import { distance as calcDistance } from './utils/calc.mjs';
|
||||
|
@ -10,6 +10,7 @@ import * as units from './utils/units.mjs';
|
|||
import { getWeatherRegionalIconFromIconLink } from './icons.mjs';
|
||||
import { preloadImg } from './utils/image.mjs';
|
||||
import { DateTime } from '../vendor/auto/luxon.mjs';
|
||||
import WeatherDisplay from './weatherdisplay.mjs';
|
||||
|
||||
class RegionalForecast extends WeatherDisplay {
|
||||
constructor(navId, elemId) {
|
||||
|
@ -389,4 +390,4 @@ class RegionalForecast extends WeatherDisplay {
|
|||
}
|
||||
}
|
||||
|
||||
window.RegionalForecast = RegionalForecast;
|
||||
export default RegionalForecast;
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
// travel forecast display
|
||||
/* globals WeatherDisplay, navigation, TravelCities */
|
||||
/* globals navigation, TravelCities */
|
||||
import STATUS from './status.mjs';
|
||||
import { UNITS } from './config.mjs';
|
||||
import { json } from './utils/fetch.mjs';
|
||||
import { getWeatherRegionalIconFromIconLink } from './icons.mjs';
|
||||
import { fahrenheitToCelsius } from './utils/units.mjs';
|
||||
import { DateTime } from '../vendor/auto/luxon.mjs';
|
||||
import WeatherDisplay from './weatherdisplay.mjs';
|
||||
|
||||
class TravelForecast extends WeatherDisplay {
|
||||
constructor(navId, elemId, defaultActive) {
|
||||
|
@ -165,4 +166,4 @@ class TravelForecast extends WeatherDisplay {
|
|||
}
|
||||
}
|
||||
|
||||
window.TravelForecast = TravelForecast;
|
||||
export default TravelForecast;
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
// base weather display class
|
||||
|
||||
/* globals navigation, utils, luxon, currentWeatherScroll, STATUS */
|
||||
/* globals navigation */
|
||||
import STATUS from './status.mjs';
|
||||
import * as currentWeatherScroll from './currentweatherscroll.mjs';
|
||||
import { DateTime } from '../vendor/auto/luxon.mjs';
|
||||
import { elemForEach } from './utils/elem.mjs';
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
class WeatherDisplay {
|
||||
constructor(navId, elemId, name, defaultEnabled) {
|
||||
// navId is used in messaging
|
||||
|
@ -166,7 +169,6 @@ class WeatherDisplay {
|
|||
drawCurrentDateTime() {
|
||||
// only draw if canvas is active to conserve battery
|
||||
if (!this.isActive()) return;
|
||||
const { DateTime } = luxon;
|
||||
// Get the current date and time.
|
||||
const now = DateTime.local();
|
||||
|
||||
|
@ -174,14 +176,14 @@ class WeatherDisplay {
|
|||
const time = now.toLocaleString(DateTime.TIME_WITH_SECONDS).padStart(11, ' ');
|
||||
|
||||
if (this.lastTime !== time) {
|
||||
utils.elem.forEach('.date-time.time', (elem) => { elem.innerHTML = time.toUpperCase(); });
|
||||
elemForEach('.date-time.time', (elem) => { elem.innerHTML = time.toUpperCase(); });
|
||||
}
|
||||
this.lastTime = time;
|
||||
|
||||
const date = now.toFormat(' ccc LLL ') + now.day.toString().padStart(2, ' ');
|
||||
|
||||
if (this.lastDate !== date) {
|
||||
utils.elem.forEach('.date-time.date', (elem) => { elem.innerHTML = date.toUpperCase(); });
|
||||
elemForEach('.date-time.date', (elem) => { elem.innerHTML = date.toUpperCase(); });
|
||||
}
|
||||
this.lastDate = date;
|
||||
}
|
||||
|
@ -408,3 +410,5 @@ class WeatherDisplay {
|
|||
return template;
|
||||
}
|
||||
}
|
||||
|
||||
export default WeatherDisplay;
|
|
@ -34,7 +34,6 @@
|
|||
<script type="module" src="scripts/modules/currentweather.mjs"></script>
|
||||
<script type="module" src="scripts/modules/almanac.mjs"></script>
|
||||
<script type="module" src="scripts/modules/icons.mjs"></script>
|
||||
<script type="module" src="scripts/modules/currentweatherscroll.mjs"></script>
|
||||
<script type="module" src="scripts/modules/extendedforecast.mjs"></script>
|
||||
<script type="module" src="scripts/modules/hourly.mjs"></script>
|
||||
<script type="module" src="scripts/modules/progress.mjs"></script>
|
||||
|
@ -43,6 +42,7 @@
|
|||
<script type="module" src="scripts/modules/radar.mjs"></script>
|
||||
<script type="module" src="scripts/modules/regionalforecast.mjs"></script>
|
||||
<script type="module" src="scripts/modules/travelforecast.mjs"></script>
|
||||
<script type="module" src="scripts/modules/weatherdisplay.mjs"></script>
|
||||
|
||||
<script type="module" src="scripts/index.mjs"></script>
|
||||
|
||||
|
@ -53,7 +53,6 @@
|
|||
<script type="text/javascript" src="scripts/data/stations.js"></script>
|
||||
|
||||
<script type="text/javascript" src="scripts/vendor/auto/suncalc.js"></script>
|
||||
<script type="text/javascript" src="scripts/modules/weatherdisplay.js"></script>
|
||||
<script type="text/javascript" src="scripts/modules/utilities.js"></script>
|
||||
<script type="text/javascript" src="scripts/modules/navigation.js"></script>
|
||||
|
||||
|
|
Loading…
Reference in a new issue