diff options
author | Teddy Wing | 2020-05-08 17:58:17 +0200 |
---|---|---|
committer | Teddy Wing | 2020-05-08 18:00:53 +0200 |
commit | 9a2d579e0e21081bb66d532679dfadd7035d5021 (patch) | |
tree | 8d97f1d05e8edd753e647a6b9cc506490492a33d | |
parent | a8d66ecf78147b2056ffec7e270369852501bf9e (diff) | |
download | netflix-immersive-9a2d579e0e21081bb66d532679dfadd7035d5021.tar.bz2 |
controls.hide(): Hide controls immediately
Don't use `wait_element` to hide the controls. I had done that because I
thought that the element wasn't there after clicking the "Watch Credits"
button, and I had to wait for it before trying to hide it.
Turns out the reason why the credits weren't hiding was that I just
shadowed the `controls` variable. This waiting isn't necessary, and in
fact it's undesirable, because it causes the player controls to appear
for a second before being hidden instead of not appearing at all.
-rw-r--r-- | src/controls.ts | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/controls.ts b/src/controls.ts index ad8f47c..5cff2d1 100644 --- a/src/controls.ts +++ b/src/controls.ts @@ -1,22 +1,21 @@ import logger from './logger'; -import wait_element from './wait_element'; const controls = { hide: function() { logger.debug('hide():', 'Hiding controls'); - wait_element('.PlayerControlsNeo__layout.PlayerControlsNeo__layout--active') - .then(function(controls) { - logger.debug('hide():', 'Controls:', controls); + const controls_el = document.querySelector( + '.PlayerControlsNeo__layout.PlayerControlsNeo__layout--active' + ); + logger.debug('hide():', 'Controls:', controls_el); - controls - .classList - .replace( - 'PlayerControlsNeo__layout--active', - 'PlayerControlsNeo__layout--inactive' - ); - }); + controls_el + .classList + .replace( + 'PlayerControlsNeo__layout--active', + 'PlayerControlsNeo__layout--inactive' + ); } }; |