Skip to content

Commit 3ad4665

Browse files
authored
Fix Firefox and Safari issues. (#28)
* Fixed Safari transparent gradient problem. * Fixed Firefox click detection problem.
1 parent b459809 commit 3ad4665

12 files changed

Lines changed: 108 additions & 52 deletions

CHANGELOG.md

Lines changed: 37 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,63 @@
1+
## 2.7.1
2+
3+
* Fixed Safari transparent gradient problem.
4+
* Fixed Firefox click detection problem.
5+
16
## 2.7.0
27

38
* On a 16x9 or wider display, five days of forecast, instead of just four days, will be displayed without the need to scroll sideways.
49
* Fixed sometimes-off tap/click detection for forecast days and the sun/moon rise/set toggle.
5-
* Fix possible "snap-back" when scrolling forecast/alert dialog text.
6-
* Added a 3D design file to project for a custom monitor stand with mounting for Raspberry Pi and other project hardware.
10+
* Fixed possible "snap-back" when scrolling forecast/alert dialog text.
11+
* Added a 3D design file to project for printing a custom monitor stand, with mounting for Raspberry Pi and other project hardware.
712

813
## 2.6.1
914

10-
* Fix a user-settings bug for first-time users.
15+
* Fixed a user-settings bug for first-time users.
1116

1217
## 2.6.0
1318

14-
* Add option where digital time display shows UTC while analog clock shows local time.
15-
* Improve forecast caching and forecast fallback to better handle failed forecast data.
19+
* Added option where digital time display shows UTC while analog clock shows local time.
20+
* Improved forecast caching and forecast fallback to better handle failed forecast data.
1621

1722
## 2.5.1
1823

19-
* Improve wording of the README section about the planetary display.
24+
* Improved wording of the README section about the planetary display.
2025

2126
## 2.5.0
2227

23-
* Add support for Weatherbit.io forecasts.
24-
* Add hourly probability of precipitation, triggered by tap/click on hourly icons or temperatures.
28+
* Added support for Weatherbit.io forecasts.
29+
* Added hourly probability of precipitation, triggered by tap/click on hourly icons or temperatures.
2530
* Weatherbit.io can now be used in place of, or in addition to, the Google geocoding API to translate GPS latitude/longitude into place names.
2631
* Fixed bug with pop-up weather details for Weather Underground forecast.
2732
* Prevented onscreen keyboard from covering alert dialogs.
28-
* Make sure when running in kiosk mode that clicking on a weather service logo doesn't lead to the main display being blocked.
33+
* Made sure when running in kiosk mode that clicking on a weather service logo doesn't lead to the main display being blocked.
2934
* Added automatic phase-out of Dark Sky API in December 2021.
3035

3136
## 2.4.0
3237

33-
* Touchscreen support. This includes:
38+
* Added touchscreen support. This includes:
3439
* 7-day forecast, with four days shown at one time, using left/right swipe or tapping arrow icons to shift to the end or the beginning of the forecast week.
3540
* Tap on scrolling alert "ticker" at bottom of screen to see full text of current alerts.
3641
* Tap on forecast day to see textual summary for that day.
3742
* Tap on sunrise/sunset times to shift to display of moonrise/moonset times.
3843
* Tap on gear icon to bring up Settings dialog, with optional onscreen keyboard.
39-
* GPS time support.
40-
* GPS location support.
41-
* Notifications for software updates.
42-
* Optional onscreen administrative functions, provided through the Settings dialog. These include:
44+
* Added GPS time support.
45+
* Added GPS location support.
46+
* Added notifications for software updates.
47+
* Added optional onscreen administrative functions, provided through the Settings dialog. These include:
4348
* Reboot
4449
* Shutdown
4550
* Quit browser
4651
* Initiate software update.
47-
* User customizable background and clock face colors.
52+
* Added user customizable background and clock face colors.
4853
* Assorted minor bug fixes and performance improvements.
4954

5055
## 2.3.3
5156

52-
* Add hourly forecast feature.
53-
* Use darksky weather summary for wunderground forecast if available.
54-
* Eliminate forecast refreshes for preference changes that don't require it.
55-
* Fix leap second display bug for timezones with positive UTC offset.
57+
* Added hourly forecast feature.
58+
* Can use darksky weather summary for wunderground forecast if available.
59+
* Eliminated forecast refreshes for preference changes that don't require it.
60+
* Fixed leap second display bug for timezones with positive UTC offset.
5661

5762
## 2.2.2
5863

@@ -64,7 +69,7 @@
6469
* Improved recovery from TAI-UTC data errors.
6570
* Improved formatting for AM/PM-style time.
6671
* Special provisions for developing on Debian Linux with LXDE desktop as a close-to-Raspberry Pi substitute.
67-
* Fix for Weather Underground snow forecasts.
72+
* Fixed for Weather Underground snow forecasts.
6873

6974
## 2.1.2
7075

@@ -78,7 +83,7 @@
7883

7984
## 2.0.4
8085

81-
* Allow project to be developed on Windows and non-Raspbian Linux (already worked on MacOS).
86+
* Facilitated project development on Windows and non-Raspbian Linux (already worked on MacOS).
8287
* Display equinoxes and solstices.
8388

8489
## 2.0.2
@@ -92,8 +97,8 @@
9297

9398
## 1.2.6
9499

95-
* Reduce NTP polling rate.
96-
* Update linting and unit tests.
100+
* Reduced NTP polling rate.
101+
* Updated linting and unit tests.
97102

98103
## 1.2.5
99104

@@ -108,44 +113,44 @@
108113

109114
## 1.0.10
110115

111-
* Improve marquee. Add built-in font for astronomical symbols.
116+
* Improved marquee. Added built-in font for astronomical symbols.
112117

113118
## 1.0.9
114119

115-
* Improve settings dialog appearance in Firefox and Safari.
120+
* Improved settings dialog appearance in Firefox and Safari.
116121

117122
## 1.0.8
118123

119-
* Make dialog grid layout work for IE 11.
124+
* Made dialog grid layout work for IE 11.
120125

121126
## 1.0.7
122127

123-
* Improve logic of risen tracks.
128+
* Improved logic of risen tracks.
124129

125130
## 1.0.6
126131

127-
* Add rise/set time indicator arcs for planets.
128-
* Add option to debug time at accelerated rate.
132+
* Added rise/set time indicator arcs for planets.
133+
* Added option to debug time at accelerated rate.
129134

130135
## 1.0.5
131136

132-
* Add version number to settings dialog.
137+
* Added version number to settings dialog.
133138

134139
## 1.0.4
135140

136141
* More assorted code clean-up.
137142

138143
## 1.0.3
139144

140-
* Update lint and e2e.
145+
* Updated lint and e2e.
141146

142147
## 1.0.2
143148

144149
* Updated README.md.
145150

146151
## 1.0.1
147152

148-
* Fix gear.svg image so it's compatible with IE. Add MIT license to individual files.
153+
* Fixed gear.svg image so it's compatible with IE. Added MIT license to individual files.
149154

150155
## 1.0.0
151156

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "aw-clock",
3-
"version": "2.7.0",
3+
"version": "2.7.1",
44
"license": "MIT",
55
"author": "Kerry Shetline <kerry@shetline.com>",
66
"scripts": {

server/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "aw-clock-server",
3-
"version": "2.7.0",
3+
"version": "2.7.1",
44
"license": "MIT",
55
"author": "Kerry Shetline <kerry@shetline.com>",
66
"private": true,

server/src/shared-types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
export const CommonConditionsKeys = ['time', 'summary', 'icon', 'humidity', 'cloudCover', 'precipIntensity', 'precipIntensityMax',
55
'precipProbability', 'precipType'];
66

7-
export const AWC_VERSION = '2.7.0';
7+
export const AWC_VERSION = '2.7.1';
88

99
export interface CommonConditions {
1010
time: number;

src/forecast.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -867,12 +867,14 @@ export class Forecast {
867867
this.forecastDaysVisible = (aspectRatio > SIXTEEN_BY_NINE ? 5 : 4);
868868

869869
if (this.forecastDaysVisible !== lastVisible) {
870+
const width = this.forecastDaysVisible * FORECAST_DAY_WIDTH;
870871
const extraWidth = (this.forecastDaysVisible - 4) * FORECAST_DAY_WIDTH;
871872

872873
$('#clock-container').toggleClass('display16x9', this.forecastDaysVisible > 4);
873874
$('#clock').attr('viewBox', `0 0 ${172 + extraWidth} 108`);
874875
$('#current-forecast').attr('transform', `translate(${extraWidth / 2})`);
875-
$('#forecast-clip').attr('width', (this.forecastDaysVisible * FORECAST_DAY_WIDTH).toString());
876+
$('#forecast-rect').attr('width', width.toString());
877+
$('#forecast-clip').attr('width', width.toString());
876878
$('#end-of-week').attr('to', `-${(7 - this.forecastDaysVisible) * FORECAST_DAY_WIDTH} 0`);
877879
$('#forecast-week').attr('clip-path', `url(#forecast-clip-${this.forecastDaysVisible})`);
878880
$('#week-forward').attr('transform', `translate(${extraWidth})`);

src/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
<text id="dayN-moon-extra" x="6" y="34" class="small-caption moon-info extra" text-anchor="middle"></text>
4848
<text id="dayN-phase-time" x="6" y="44.75" class="small-caption" text-anchor="middle"></text>
4949

50-
<rect id="dayN-clicker" x="0" y="0" width="12" height="25" fill="rgba(0, 0, 0, 0)"/>
50+
<rect id="dayN-clicker" x="0" y="0" width="12" height="25" fill="rgba(0, 0, 0, 0)" class="ff-click"/>
5151

5252
<text id="dayN-equisolstice" x="6" y="47.25" class="small-caption equisolstice"
5353
text-anchor="middle"></text>
@@ -249,7 +249,7 @@
249249
<use href="#forecast-day"/>
250250
</svg>
251251

252-
<rect id="sun-moon-clicker" x="0" y="25.5" width="52" height="20" fill="rgba(0, 0, 0, 0)"/>
252+
<rect id="sun-moon-clicker" x="0" y="25.5" width="91" height="20" fill="rgba(0, 0, 0, 0)" class="ff-click"/>
253253

254254
<animateTransform id="start-of-week" attributeName="transform" attributeType="XML" type="translate"
255255
to="0 0" dur="500ms" fill="freeze" begin="indefinite"/>

src/main.ts

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ import $ from 'jquery';
2727
import { KsDateTime, KsTimeZone } from 'ks-date-time-zone';
2828
import { irandom } from 'ks-math';
2929
import { initTimeZoneSmall } from 'ks-date-time-zone/dist/ks-timezone-small';
30-
import { isEffectivelyFullScreen, setFullScreen } from 'ks-util';
30+
import { isEffectivelyFullScreen, isFirefox, setFullScreen } from 'ks-util';
3131
import { Sensors } from './sensors';
3232
import { apiServer, localServer, raspbianChromium, runningDev, Settings } from './settings';
3333
import { SettingsDialog } from './settings-dialog';
3434
import { TimeInfo } from '../server/src/shared-types';
3535
import { reflow, updateSvgFlowItems } from './svg-flow';
36-
import { adjustCityName, getJson } from './util';
36+
import { adjustCityName, anyDialogOpen, getJson } from './util';
3737

3838
initTimeZoneSmall();
3939

@@ -148,6 +148,30 @@ class AwClockApp implements AppService {
148148
window.open(href, '_blank', `width=${width},height=${height},left=${left},top=${top},menubar=yes,titlebar=yes`);
149149
}
150150
});
151+
152+
// Firefox doesn't detect clicks on the following SVG elements without this extra help.
153+
if (isFirefox()) {
154+
const clickTargets = Array.from(document.getElementsByClassName('ff-click'));
155+
156+
window.addEventListener('click', evt => {
157+
const outerRect = document.getElementById('forecast-rect').getBoundingClientRect();
158+
const x = evt.pageX;
159+
const y = evt.pageY;
160+
161+
if (anyDialogOpen() || evt.defaultPrevented ||
162+
x < outerRect.left || x >= outerRect.right || y < outerRect.top || y >= outerRect.bottom)
163+
return;
164+
165+
for (const target of clickTargets) {
166+
const rect = target.getBoundingClientRect();
167+
168+
if (rect.left <= x && x < rect.right && rect.top <= y && y < rect.bottom) {
169+
target.dispatchEvent(new Event('click'));
170+
break;
171+
}
172+
}
173+
});
174+
}
151175
}
152176

153177
getTimeFormat(): TimeFormat {

src/settings-dialog.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ import { Keyboard } from './keyboard';
2525
import { isIE, isIOS, isSafari } from 'ks-util';
2626
import { apiServer, localServer, raspbianChromium, Settings, toTimeFormat, updateTest } from './settings';
2727
import { AWC_VERSION } from '../server/src/shared-types';
28-
import { adjustCityName, domAlert, domConfirm, htmlEncode, popKeydownListener, pushKeydownListener } from './util';
28+
import {
29+
adjustCityName, decrementDialogCounter, domAlert, domConfirm, htmlEncode, incrementDialogCounter, popKeydownListener, pushKeydownListener
30+
} from './util';
2931

3032
const ERROR_BACKGROUND = '#FCC';
3133
const WARNING_BACKGROUND = '#FFC';
@@ -414,6 +416,7 @@ export class SettingsDialog {
414416
this.dimmingStart.val(previousSettings.dimmingStart);
415417
this.dimmingEnd.val(previousSettings.dimmingEnd);
416418

419+
incrementDialogCounter();
417420
pushKeydownListener((event: KeyboardEvent) => {
418421
if (event.code === 'Escape') {
419422
event.preventDefault();
@@ -438,6 +441,7 @@ export class SettingsDialog {
438441
}));
439442

440443
this.cancelButton.one('click', () => {
444+
decrementDialogCounter();
441445
popKeydownListener();
442446
this.okButton.off('click', this.doOK);
443447
this.dialog.css('display', 'none');
@@ -480,6 +484,7 @@ export class SettingsDialog {
480484
this.longitude.trigger('focus'));
481485
}
482486
else {
487+
decrementDialogCounter();
483488
popKeydownListener();
484489
this.okButton.off('click', this.doOK);
485490
this.dialog.css('display', 'none');

0 commit comments

Comments
 (0)