Use video-title for old video player
This commit is contained in:
@@ -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;
|
||||
|
||||
/* 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() {
|
||||
<option value=1.75>1.75</option>
|
||||
<option value=2.0>2.0</option>`;
|
||||
|
||||
/* inject speed_control element */
|
||||
controls.after(speed_control);
|
||||
|
||||
/* redo injection, in case of video change, ... */
|
||||
inject_controls();
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user