Tweaks
This commit is contained in:
+9
-5
@@ -2350,6 +2350,7 @@ var Weather = /** @class */ (function () {
|
||||
current = response.current();
|
||||
hourly = response.hourly();
|
||||
daily = response.daily();
|
||||
me.offset = response.utcOffsetSeconds();
|
||||
if (current != null)
|
||||
me.current = new CurrentWeather(current);
|
||||
if (hourly != null)
|
||||
@@ -2357,6 +2358,7 @@ var Weather = /** @class */ (function () {
|
||||
if (daily != null)
|
||||
me.setDailyData(daily);
|
||||
}
|
||||
console.info("Timezone: ".concat(responses[0].timezone(), " ").concat(responses[0].timezoneAbbreviation(), "\nTimezone difference to GMT+0: ").concat(me.offset, "s"));
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
@@ -2403,8 +2405,9 @@ var Weather = /** @class */ (function () {
|
||||
var precipitationProbabilities = hourly.variables(2).valuesArray();
|
||||
this.hourly.length = 0;
|
||||
for (var i = 0; i < length; i++) {
|
||||
new Date();
|
||||
this.hourly.push({
|
||||
time: new Date(new Date().getTime() + i * 3600000),
|
||||
time: new Date((Number(hourly.time()) + i * hourly.interval()) * 1000),
|
||||
temperature: temperatures[i],
|
||||
precipitation: precipitationTotals[i],
|
||||
precipitationProbability: precipitationProbabilities[i]
|
||||
@@ -2451,16 +2454,17 @@ var Weather = /** @class */ (function () {
|
||||
var dailySlots = [];
|
||||
for (var _i = 0, _a = this.daily; _i < _a.length; _i++) {
|
||||
var day = _a[_i];
|
||||
dailySlots.push("<div class=\"daily-slot\">\n <span class=\"date\">".concat(day.time.getDate(), "</span>\n <span class=\"range\">").concat(Math.round(day.minTemperature), " - ").concat(Math.round(day.maxTemperature), "</span>\n <span class=\"uv ").concat(day.uvRating(), "\">").concat(Math.round(day.maxUV), "</span>\n <span class=\"sunrise\">").concat(day.sunrise.toLocaleTimeString("en-US", { timeStyle: "short", hour12: false }), "</span>\n <span class=\"sunset\">").concat(day.sunset.toLocaleTimeString("en-US", { timeStyle: "short", hour12: false }), "</span>\n</div>"));
|
||||
dailySlots.push("<div class=\"daily-slot\">\n <span class=\"date\">".concat(day.time.getDate(), "</span>\n <span class=\"range\">").concat(Math.round(day.minTemperature), "—").concat(Math.round(day.maxTemperature), "</span>\n <span class=\"uv ").concat(day.uvRating(), "\" title=\"").concat(day.uvRating(), "\">").concat(Math.round(day.maxUV), "</span>\n <span class=\"sunrise\">").concat(day.sunrise.toLocaleTimeString("en-US", { timeStyle: "short", hour12: false }), "</span>\n <span class=\"sunset\">").concat(day.sunset.toLocaleTimeString("en-US", { timeStyle: "short", hour12: false }), "</span>\n</div>"));
|
||||
}
|
||||
var daily = document.getElementById("daily");
|
||||
daily.innerHTML = dailySlots.join("\r\n");
|
||||
if (!this.hourly)
|
||||
return;
|
||||
var hourlySlots = [];
|
||||
for (var i = 0; i < 12; i++) {
|
||||
var hour = this.hourly[i];
|
||||
hourlySlots.push("<div class=\"hourly-slot\">\n <span class=\"hour\">".concat(hour.time.getHours(), "</span>\n <span class=\"temp\">").concat(Math.round(hour.temperature), "</span>\n <span class=\"precipitation\">").concat(hour.precipitation, "<sup>\"</sup></span>\n <span class=\"chance\">").concat(hour.precipitationProbability, "<sup>%</sup></span>\n</div>"));
|
||||
var startHour = this.hourly.findIndex(function (x) { return x.time.getTime() > (new Date().getTime()) - 3600000; });
|
||||
for (var i = 0; i < 10; i++) {
|
||||
var hour = this.hourly[i + startHour];
|
||||
hourlySlots.push("<div class=\"hourly-slot\">\n <span class=\"hour\">".concat(hour.time.getHours(), "</span>\n <span class=\"temp\">").concat(Math.round(hour.temperature), "</span>\n <span class=\"precipitation\">").concat(Math.round(hour.precipitation), "<sup>\"</sup></span>\n <span class=\"chance\">").concat(Math.round(hour.precipitationProbability), "<sup>%</sup></span>\n</div>"));
|
||||
}
|
||||
var hourly = document.getElementById("hourly");
|
||||
hourly.innerHTML = hourlySlots.join("\r\n");
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+9
-7
@@ -57,18 +57,20 @@ body #weather-panel #time {
|
||||
html #weather-panel #time .material,
|
||||
body #weather-panel #time .material {
|
||||
font-variation-settings: "FILL" 0, "wght" 700, "opsz" 24;
|
||||
vertical-align: sub;
|
||||
line-height: inherit;
|
||||
}
|
||||
html #weather-panel #hourly,
|
||||
body #weather-panel #hourly {
|
||||
display: flex;
|
||||
font-size: 0.75rem;
|
||||
margin: 1rem 0;
|
||||
text-align: center;
|
||||
}
|
||||
body #weather-panel #hourly,
|
||||
html #weather-panel #daily,
|
||||
body #weather-panel #daily {
|
||||
display: flex;
|
||||
font-size: 0.7rem;
|
||||
justify-content: space-between;
|
||||
text-align: center;
|
||||
}
|
||||
html #weather-panel #hourly,
|
||||
body #weather-panel #hourly {
|
||||
margin: 1rem 0;
|
||||
}
|
||||
html #weather-panel #daily .daily-slot,
|
||||
body #weather-panel #daily .daily-slot {
|
||||
|
||||
Reference in New Issue
Block a user