@@ -38,7 +38,7 @@ const { prev, next } = await getPagination(channelId);
38
38
</div >
39
39
<div class =" control-group" >
40
40
<div class =" label" >Menu</div >
41
- <button class =" button" aria-label =" Open Menu" id =" menu" ></button >
41
+ <button class =" button" aria-label =" Open Menu" id =" menu-button " ></button >
42
42
</div >
43
43
</div >
44
44
<ChannelDisplay channelId ={ channelId } activeProgram ={ activeProgram } />
@@ -64,7 +64,7 @@ const { prev, next } = await getPagination(channelId);
64
64
const screen = document.querySelector(".screen");
65
65
const powerIndicator = document.querySelector(".power-indicator");
66
66
const channelDisplay = document.querySelector("channel-display");
67
- const menuButton = document.getElementById("menu");
67
+ const menuButton = document.getElementById("menu-button ");
68
68
const channelButtons = document.querySelectorAll(".channel-button");
69
69
70
70
function updateButtonStates(powerState: string) {
@@ -90,6 +90,38 @@ const { prev, next } = await getPagination(channelId);
90
90
}
91
91
}
92
92
93
+ function handlePowerButtonClick(event: Event) {
94
+ // Prevent default behavior to avoid any conflicts
95
+ event.preventDefault();
96
+
97
+ if (!screen) return;
98
+
99
+ const isTurningOff = screen.getAttribute("data-power") === "on";
100
+
101
+ Fathom.trackEvent(`controls: click power ${isTurningOff ? "off" : "on"}`);
102
+
103
+ if (isTurningOff) {
104
+ screen.setAttribute("data-powering-off", "true");
105
+ updateButtonStates(screen.getAttribute("data-power") || "on");
106
+ } else {
107
+ screen.setAttribute("data-power", "on");
108
+ screen.setAttribute("data-booting", "true");
109
+ localStorage.setItem("power", "on");
110
+ updateButtonStates("on");
111
+ }
112
+
113
+ const newPowerState = isTurningOff ? "off" : "on";
114
+ powerIndicator?.setAttribute("data-power", newPowerState);
115
+ channelDisplay?.setAttribute("data-power", newPowerState);
116
+ }
117
+
118
+ function handleChannelButtonClick(event: Event) {
119
+ const button = event.currentTarget as HTMLAnchorElement;
120
+ const direction =
121
+ button.getAttribute("data-arrow") === "up" ? "next" : "previous";
122
+ Fathom.trackEvent(`controls: click channel ${direction}`);
123
+ }
124
+
93
125
function init() {
94
126
const savedPowerState = localStorage.getItem("power") || "on";
95
127
@@ -116,40 +148,12 @@ const { prev, next } = await getPagination(channelId);
116
148
});
117
149
118
150
powerButton?.addEventListener("click", handlePowerButtonClick);
151
+
119
152
channelButtons.forEach((button) => {
120
153
button.addEventListener("click", handleChannelButtonClick);
121
154
});
122
155
}
123
156
124
- function handleChannelButtonClick(event: Event) {
125
- const button = event.currentTarget as HTMLAnchorElement;
126
- const direction =
127
- button.getAttribute("data-arrow") === "up" ? "next" : "previous";
128
- Fathom.trackEvent(`controls: click channel ${direction}`);
129
- }
130
-
131
- function handlePowerButtonClick() {
132
- if (!screen) return;
133
-
134
- const isTurningOff = screen.getAttribute("data-power") === "on";
135
-
136
- Fathom.trackEvent(`controls: click power ${isTurningOff ? "off" : "on"}`);
137
-
138
- if (isTurningOff) {
139
- screen.setAttribute("data-powering-off", "true");
140
- updateButtonStates(screen.getAttribute("data-power") || "on");
141
- } else {
142
- screen.setAttribute("data-power", "on");
143
- screen.setAttribute("data-booting", "true");
144
- localStorage.setItem("power", "on");
145
- updateButtonStates("on");
146
- }
147
-
148
- const newPowerState = isTurningOff ? "off" : "on";
149
- powerIndicator?.setAttribute("data-power", newPowerState);
150
- channelDisplay?.setAttribute("data-power", newPowerState);
151
- }
152
-
153
157
init();
154
158
</script >
155
159
@@ -165,6 +169,7 @@ const { prev, next } = await getPagination(channelId);
165
169
grid-template-columns: auto;
166
170
grid-template-areas: "buttons display logo";
167
171
width: 100%;
172
+ user-select: none;
168
173
align-items: center;
169
174
justify-items: space-between;
170
175
gap: 1rem;
@@ -309,6 +314,7 @@ const { prev, next } = await getPagination(channelId);
309
314
310
315
.button {
311
316
--shadow-color: 0deg 0% 0%;
317
+ touch-action: manipulation; /* Prevent double-tap zoom on iOS */
312
318
width: 4rem;
313
319
height: 1.5rem;
314
320
background-color: #333333;
0 commit comments