From 2393b7b44826b2677660fa6dc162371151e00b2c Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sun, 24 May 2020 10:55:09 +0200 Subject: index.ts: Reinitialise when the page changes Netflix doesn't reload when you change pages, so our listeners don't get reinitialised. This means, when you watch one video, then click the "Back to Browse" button to go back to the /browse page, and select another video, Immersive won't work on the newly-loaded video. Ensure the plugin works in this case by reinitialising when the `popstate` changes. --- src/index.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/index.ts b/src/index.ts index 9216a0a..58d4367 100644 --- a/src/index.ts +++ b/src/index.ts @@ -20,6 +20,14 @@ import styles from './styles'; import watch_credits from './watch_credits'; -styles(); -fullscreen_credits(); -watch_credits(); +function main () { + styles(); + fullscreen_credits(); + watch_credits(); +} + + +main(); + +// Reinitialise when the page changes. +window.onpopstate = main; -- cgit v1.2.3