aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/messages.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/features/messages.js')
-rw-r--r--src/features/messages.js28
1 files changed, 26 insertions, 2 deletions
diff --git a/src/features/messages.js b/src/features/messages.js
index 4ba4bfb..b491a5c 100644
--- a/src/features/messages.js
+++ b/src/features/messages.js
@@ -8436,8 +8436,21 @@ export function messagesFeature(ctx) {
Promise.resolve(go.call(v)).catch(() => {});
return true;
}
+ // A YouTube box we took full screen still shows YouTube's own full-screen
+ // button, and a press on it asks for full screen again from inside the
+ // frame — nothing to see, and no way out ("worked to make the video
+ // fullscreen but not toggle it off"). The page does see that happen: the
+ // frame becomes the full-screen element in place of its box. The press
+ // meant "out", so out it goes, both steps.
+ let ytFs = null, ytLeaving = false;
if (typeof document !== 'undefined') document.addEventListener('fullscreenchange', () => {
const el = fsElement();
+ const leave = () => Promise.resolve((document.exitFullscreen || document.webkitExitFullscreen || (() => {})).call(document)).catch(() => {});
+ if (!el) { ytFs = null; ytLeaving = false; }
+ else if (el.classList && el.classList.contains('yt-embed')) {
+ if (ytLeaving) { ytLeaving = false; ytFs = null; leave(); return; }
+ ytFs = el;
+ } else if (el.tagName === 'IFRAME' && ytFs && ytFs.contains(el)) { ytLeaving = true; leave(); return; }
// The player's own full-screen button on a feed clip: the pager, not
// Chrome's full screen (no next clip there). The button stays on the bar
// (left off, Chrome greys it out) and is taken over here.
@@ -8643,15 +8656,26 @@ export function messagesFeature(ctx) {
if (!go) return;
Promise.resolve(go.call(box, { navigationUI: 'hide' })).catch(() => {});
};
+ // With a mouse the player's own buttons are all in reach, so its clicks
+ // are its own: the shield is off while a mouse is over the box (by-mouse;
+ // a finger on the same screen gets it back) and the middle button pauses, the
+ // corner one goes full screen and back (Adam, 2026-11-10: the pause button
+ // "didn't pause, it fullscreened. it should just pause"). A click on the
+ // still plays it where it is.
const tapped = (e) => {
if (e.target.closest('.yt-open, .vid-sound, iframe')) return;
e.stopPropagation(); e.preventDefault();
const box = e.currentTarget;
if (!box.dataset.playing) load(box, false); // a tap means sound
else { post(box, 'unMute'); post(box, 'playVideo'); if (box._soundOn) box._soundOn(); }
- full(box);
+ if (e.pointerType !== 'mouse') full(box);
};
- const frame = h('div', { class: 'yt-embed', onClick: tapped },
+ const byMouse = (e) => { e.currentTarget.classList.toggle('by-mouse', e.pointerType === 'mouse'); };
+ const frame = h('div', {
+ class: 'yt-embed', onClick: tapped,
+ onPointerEnter: byMouse, onPointerMove: byMouse, onPointerDown: byMouse,
+ onPointerLeave: (e) => { e.currentTarget.classList.remove('by-mouse'); },
+ },
h('img', {
class: 'yt-poster', loading: 'lazy', alt: '',
src: !feedPaint || feedMedia('https://i.ytimg.com/vi/' + vid + '/hqdefault.jpg')