diff options
| author | Teddy Wing | 2020-05-05 02:40:41 +0200 | 
|---|---|---|
| committer | Teddy Wing | 2020-05-05 02:40:41 +0200 | 
| commit | c64bbaca4dc9977eae5b0068ee580b96ba057cb2 (patch) | |
| tree | ebc65cdbd0fd39c006f6d547f81fa0fd3ada904c /content.js | |
| parent | c5eb7ee015af975d408d7814e34a3b8e2c963e75 (diff) | |
| download | netflix-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.
Diffstat (limited to 'content.js')
| -rw-r--r-- | content.js | 16 | 
1 files changed, 6 insertions, 10 deletions
| @@ -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);  }); | 
