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. --- netflix-immersive.user.js | 11 ++++++++--- src/index.ts | 14 +++++++++++--- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/netflix-immersive.user.js b/netflix-immersive.user.js index 28cb161..e956541 100644 --- a/netflix-immersive.user.js +++ b/netflix-immersive.user.js @@ -116,9 +116,14 @@ Object.defineProperty(exports, "__esModule", { value: true }); var fullscreen_credits_1 = require("./fullscreen_credits"); var styles_1 = require("./styles"); var watch_credits_1 = require("./watch_credits"); -styles_1.default(); -fullscreen_credits_1.default(); -watch_credits_1.default(); +function main() { + styles_1.default(); + fullscreen_credits_1.default(); + watch_credits_1.default(); +} +main(); +// Reinitialise when the page changes. +window.onpopstate = main; },{"./fullscreen_credits":2,"./styles":5,"./watch_credits":7}],4:[function(require,module,exports){ "use strict"; 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