Adapt css for the new player design; Remove support for classic-ui
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
// ==UserScript==
|
||||
// @name netflix-speed
|
||||
// @version 0.7
|
||||
// @version 0.8
|
||||
// @include https://www.netflix.com/*
|
||||
// ==/UserScript==
|
||||
|
||||
@@ -10,12 +10,6 @@ function find_controls() {
|
||||
mutationsList.forEach(function(mutation) {
|
||||
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('.video-title')) {
|
||||
resolve(node.querySelector('.video-title').previousElementSibling);
|
||||
return;
|
||||
}
|
||||
/* modern ui - play/pause in the middle of the screen */
|
||||
if (node.matches && node.matches('.AkiraPlayer') && (node.querySelector('.button-nfplayerNextEpisode') || node.querySelector('.button-nfplayerSubtitles'))) {
|
||||
var elem = node.querySelector('.button-nfplayerNextEpisode') || node.querySelector('.button-nfplayerSubtitles');
|
||||
resolve(elem.parentNode);
|
||||
@@ -31,47 +25,46 @@ function find_controls() {
|
||||
|
||||
function inject_controls() {
|
||||
find_controls().then(function(controls) {
|
||||
/* remove report a problem button */
|
||||
if (document.querySelector('div.ReportAProblemPopupContainer'))
|
||||
document.querySelector('div.ReportAProblemPopupContainer').remove();
|
||||
|
||||
/* 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 = `
|
||||
border-left: 1px solid #323232;
|
||||
border-right: 1px solid #151515;
|
||||
border-top: none;
|
||||
border-bottom: none;
|
||||
background: none;
|
||||
-moz-appearance: none;
|
||||
-webkit-appearance: none;
|
||||
appearance: none;
|
||||
min-width: 5em;
|
||||
width: auto;
|
||||
height: 100%;
|
||||
font-size: 2.2em;
|
||||
text-align: center;
|
||||
cursor: pointer;
|
||||
`;
|
||||
speed_control.id = 'speed-control';
|
||||
speed_control.onchange = function() {
|
||||
document.querySelector('.VideoContainer video').playbackRate = this.value;
|
||||
};
|
||||
speed_control.innerHTML = `<option value=0.5>0.5</option>
|
||||
var speed_control = document.createElement('div');
|
||||
speed_control.innerHTML = `<select>
|
||||
<option value=0.5>0.5</option>
|
||||
<option value=0.75>0.75</option>
|
||||
<option value=1.0 selected="selected">Normal</option>
|
||||
<option value=1.25>1.25</option>
|
||||
<option value=1.5>1.5</option>
|
||||
<option value=1.75>1.75</option>
|
||||
<option value=2.0>2.0</option>`;
|
||||
<option value=2.0>2.0</option>
|
||||
</select>`;
|
||||
speed_control.id = 'speed-control';
|
||||
speed_control.style.cssText = `
|
||||
padding: 0 0 1.68em 0;
|
||||
margin: 0 1.5em;`;
|
||||
speed_control.firstChild.style.cssText = `
|
||||
-webkit-appearance: none;
|
||||
background: none;
|
||||
border: none;
|
||||
font-size: 2.2em;
|
||||
text-align: right;`;
|
||||
speed_control.firstChild.onchange = function() {
|
||||
document.querySelector('.VideoContainer video').playbackRate = this.value;
|
||||
};
|
||||
|
||||
/* inject speed_control element */
|
||||
controls.after(speed_control);
|
||||
controls.before(speed_control);
|
||||
|
||||
/* redo injection, in case of video change, ... */
|
||||
inject_controls();
|
||||
});
|
||||
};
|
||||
|
||||
/* initial run of injection */
|
||||
inject_controls();
|
||||
|
||||
Reference in New Issue
Block a user