aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2020-05-05 02:40:41 +0200
committerTeddy Wing2020-05-05 02:40:41 +0200
commitc64bbaca4dc9977eae5b0068ee580b96ba057cb2 (patch)
treeebc65cdbd0fd39c006f6d547f81fa0fd3ada904c
parentc5eb7ee015af975d408d7814e34a3b8e2c963e75 (diff)
downloadnetflix-immersive-c64bbaca4dc9977eae5b0068ee580b96ba057cb2.tar.bz2
Use `classList.remove()`
Turns out `classList` isn't an array, it's a `DOMTokenList`, and it doesn't have an `includes()` method. Instead, use `contains()`. `DOMTokenList` also doesn't have a `filter()`, but we can remove the `.postplay` class much easier with the `remove()` method. Turns out I didn't need to worry about a `childList` mutation observer as I previously thought. This version works. Now that the class is removed, the video no longer reduces to the small frame.
-rw-r--r--content.js16
1 files changed, 6 insertions, 10 deletions
diff --git a/content.js b/content.js
index 977f170..ab42080 100644
--- a/content.js
+++ b/content.js
@@ -18,16 +18,10 @@ function init_mutation_observer (player) {
for (var i = 0; i < mutation_list.length; i++) {
var mutation = mutation_list[i];
- console.log(
- mutation.target.className +
- '\n' +
- mutation.oldValue
- );
-
- if (mutation.target.classList.includes('postplay')) {
- mutation.target.classList = mutation.target.classList.filter(function(c) {
- return c !== 'postplay';
- });
+ if (mutation.target.classList.contains('postplay')) {
+ mutation.target.classList.remove('postplay');
+
+ return;
}
}
});
@@ -43,5 +37,7 @@ function init_mutation_observer (player) {
with_player(function(player) {
+ window.player = player;
+
init_mutation_observer(player);
});