diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/controls.ts | 4 | ||||
-rw-r--r-- | src/fullscreen_credits.ts | 35 | ||||
-rw-r--r-- | src/styles.ts | 3 |
3 files changed, 34 insertions, 8 deletions
diff --git a/src/controls.ts b/src/controls.ts index 4be1752..4e54c40 100644 --- a/src/controls.ts +++ b/src/controls.ts @@ -1,4 +1,4 @@ -// Copyright (c) 2020 Teddy Wing +// Copyright (c) 2020–2021 Teddy Wing // // This file is part of Immersive. // @@ -27,7 +27,7 @@ const controls = { hide_cursor(); const controls_el = document.querySelector( - '.PlayerControlsNeo__layout.PlayerControlsNeo__layout--active' + '.watch-video--bottom-controls-container' ); logger.debug('hide():', 'Controls:', controls_el); diff --git a/src/fullscreen_credits.ts b/src/fullscreen_credits.ts index f558221..f3cefcb 100644 --- a/src/fullscreen_credits.ts +++ b/src/fullscreen_credits.ts @@ -1,4 +1,4 @@ -// Copyright (c) 2020 Teddy Wing +// Copyright (c) 2020–2021 Teddy Wing // // This file is part of Immersive. // @@ -21,23 +21,46 @@ import wait_element from './wait_element'; // Prevent credits from being minimised. function init_mutation_observer (player) { + // const controls_observer = new MutationObserver(function(mutation_list) { + // for (var i = 0; i < mutation_list.length; i++) { + // const mutation = mutation_list[i]; + // const player = mutation.target as HTMLElement; + // const controls_el = player.querySelector( + // '.watch-video--bottom-controls-container' + // ) as HTMLElement; + // + // controls_el.parentNode.removeChild(controls_el); + // + // return; + // } + // }); + const observer = new MutationObserver(function(mutation_list) { for (var i = 0; i < mutation_list.length; i++) { const mutation = mutation_list[i]; const player = mutation.target as HTMLElement; + const video = player.querySelector('video') as HTMLElement; // The `postplay` class minimises the movie. Remove it if it gets // added to remain in full frame. - if (player.classList.contains('postplay')) { - player.classList.remove('postplay'); + if (player.classList.contains('watch-video--player-view-minimized')) { + player.classList.remove('watch-video--player-view-minimized'); + + // Resize the video to full frame. Otherwise it will shrink for + // a second until the click event kicks in. + video.style.height = null; + video.style.width = 'inherit'; // Playback controls are removed when postplay is activated. // Re-enable them. - player.click(); + const click_area = player.children[0] as HTMLElement; + click_area.click(); // Activating playback controls makes them visible. Keep them // hidden. - controls.hide(); + // controls.hide(); + // controls_observer.observe(player, { subtree: true }); + // '.watch-video--bottom-controls-container' return; } @@ -54,7 +77,7 @@ function init_mutation_observer (player) { // Initialise the mutation observer when the video player becomes available. export default function init () { - wait_element('.NFPlayer.nf-player-container') + wait_element('.watch-video--player-view') .then(function(player) { init_mutation_observer(player); }); diff --git a/src/styles.ts b/src/styles.ts index 5a16d6e..3661fff 100644 --- a/src/styles.ts +++ b/src/styles.ts @@ -29,6 +29,9 @@ export default function styles () { /* "Back to Browse" button that appears when credits are minimised. */ .OriginalsPostPlay-BackgroundTrailer .BackToBrowse, + /* Promo that appears during credis */ + .OriginalsPostPlay-BackgroundTrailer, + /* Age rating. */ .player-view-childrens, .advisory-container, |