Use video-title for old video player
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
// ==UserScript==
|
// ==UserScript==
|
||||||
// @name netflix-speed
|
// @name netflix-speed
|
||||||
// @version 0.5
|
// @version 0.6
|
||||||
// @include https://www.netflix.com/*
|
// @include https://www.netflix.com/*
|
||||||
// ==/UserScript==
|
// ==/UserScript==
|
||||||
|
|
||||||
@@ -11,8 +11,8 @@ function find_controls() {
|
|||||||
var nodes = Array.from(mutation.addedNodes);
|
var nodes = Array.from(mutation.addedNodes);
|
||||||
for (var node of nodes) {
|
for (var node of nodes) {
|
||||||
/* classic ui - black bar at the bottom */
|
/* classic ui - black bar at the bottom */
|
||||||
if (node.matches && node.matches('.classic-ui') && node.querySelector('.button-volumeMax')) {
|
if (node.matches && node.matches('.classic-ui') && node.querySelector('.video-title')) {
|
||||||
resolve(node.querySelector('.button-volumeMax').parentNode);
|
resolve(node.querySelector('.video-title').previousElementSibling);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* modern ui - play/pause in the middle of the screen */
|
/* modern ui - play/pause in the middle of the screen */
|
||||||
@@ -31,8 +31,11 @@ function find_controls() {
|
|||||||
|
|
||||||
function inject_controls() {
|
function inject_controls() {
|
||||||
find_controls().then(function(controls) {
|
find_controls().then(function(controls) {
|
||||||
|
/* don't inject multiple times */
|
||||||
if (document.querySelector('#speed-control'))
|
if (document.querySelector('#speed-control'))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
/* create speed_control element */
|
||||||
var speed_control = document.createElement('select');
|
var speed_control = document.createElement('select');
|
||||||
speed_control.id = 'speed-control';
|
speed_control.id = 'speed-control';
|
||||||
speed_control.style.cssText = `
|
speed_control.style.cssText = `
|
||||||
@@ -57,8 +60,10 @@ function inject_controls() {
|
|||||||
<option value=1.75>1.75</option>
|
<option value=1.75>1.75</option>
|
||||||
<option value=2.0>2.0</option>`;
|
<option value=2.0>2.0</option>`;
|
||||||
|
|
||||||
|
/* inject speed_control element */
|
||||||
controls.after(speed_control);
|
controls.after(speed_control);
|
||||||
|
|
||||||
|
/* redo injection, in case of video change, ... */
|
||||||
inject_controls();
|
inject_controls();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user