diff --git a/netflix-speed.user.js b/netflix-speed.user.js index 3f45fbb..498229a 100644 --- a/netflix-speed.user.js +++ b/netflix-speed.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name netflix-speed -// @version 0.5 +// @version 0.6 // @include https://www.netflix.com/* // ==/UserScript== @@ -11,8 +11,8 @@ function find_controls() { var nodes = Array.from(mutation.addedNodes); for (var node of nodes) { /* classic ui - black bar at the bottom */ - if (node.matches && node.matches('.classic-ui') && node.querySelector('.button-volumeMax')) { - resolve(node.querySelector('.button-volumeMax').parentNode); + if (node.matches && node.matches('.classic-ui') && node.querySelector('.video-title')) { + resolve(node.querySelector('.video-title').previousElementSibling); return; } /* modern ui - play/pause in the middle of the screen */ @@ -31,8 +31,11 @@ function find_controls() { function inject_controls() { find_controls().then(function(controls) { + /* don't inject multiple times */ if (document.querySelector('#speed-control')) - return; + return; + + /* create speed_control element */ var speed_control = document.createElement('select'); speed_control.id = 'speed-control'; speed_control.style.cssText = ` @@ -57,8 +60,10 @@ function inject_controls() { `; + /* inject speed_control element */ controls.after(speed_control); + /* redo injection, in case of video change, ... */ inject_controls(); }); };