From 9eecf1c6be59ff3c04152390d7ce556e36965fd8 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sat, 9 May 2020 00:32:16 +0200 Subject: Add documentation comments --- src/fullscreen_credits.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/fullscreen_credits.ts') diff --git a/src/fullscreen_credits.ts b/src/fullscreen_credits.ts index 06cc873..d8b25b9 100644 --- a/src/fullscreen_credits.ts +++ b/src/fullscreen_credits.ts @@ -19,18 +19,24 @@ import controls from './controls'; import wait_element from './wait_element'; +// Prevent credits from being minimised. function init_mutation_observer (player) { 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; + // 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'); - // Activate player controls. + // Playback controls are removed when postplay is activated. + // Re-enable them. player.click(); + // Activating playback controls makes them visible. Keep them + // hidden. controls.hide(); return; @@ -47,6 +53,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') .then(function(player) { -- cgit v1.2.3