diff options
author | Teddy Wing | 2020-05-24 10:55:09 +0200 |
---|---|---|
committer | Teddy Wing | 2020-05-24 11:07:40 +0200 |
commit | 2393b7b44826b2677660fa6dc162371151e00b2c (patch) | |
tree | 78de23d6b1696a60e44f55293e9f852495ab16c3 | |
parent | ea6c52f4c8563503c06e5a91105e34e14ccf53ca (diff) | |
download | netflix-immersive-2393b7b44826b2677660fa6dc162371151e00b2c.tar.bz2 |
index.ts: Reinitialise when the page changesv0.0.1
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.
-rw-r--r-- | netflix-immersive.user.js | 11 | ||||
-rw-r--r-- | 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; |