-
Notifications
You must be signed in to change notification settings - Fork 1
/
Netflix.Skips.user.js
65 lines (64 loc) · 2.23 KB
/
Netflix.Skips.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
// ==UserScript==
// @name Netflix Skips
// @namespace https://github.com/N3Cr0Cr0W/userscripts
// @version 0.5
// @description Skips Recap and Intro.
// @author N3Cr0Cr0W
// @downloadURL https://raw.githubusercontent.com/N3Cr0Cr0W/userscripts/master/Netflix.Skips.user.js
// @updateURL https://raw.githubusercontent.com/N3Cr0Cr0W/userscripts/master/Netflix.Skips.user.js
// @match https://www.netflix.com/watch/*
// @grant GM_log
// ==/UserScript==
(function(){
'use strict';
let playback="";
let urlPathName="";
let videoPlayer="";
let skipIntro='';
function tEvent(){
const newVideoPlayer=document.querySelector('video');
const newUrlPathName=window.location.pathname;
if(newUrlPathName!==urlPathName||videoPlayer!=newVideoPlayer){
mutObserver.disconnect();
mutObserver.observe(appMountPoint,{childList:true,subtree:true});
var checkExist = setInterval(function(){
const newVideoPlayer=document.querySelector('video');
videoPlayer=newVideoPlayer;
if (videoPlayer){
clearInterval(checkExist);
}
}, 100);
urlPathName=newUrlPathName;
}
}
const appMountPoint=document.getElementById("appMountPoint");
const mutObserver=new MutationObserver(mutations=>{
mutations.forEach(mutation=>{
Array.from(mutation.addedNodes).filter(node=>{
recuriveClick(node);
});
});
});
const recuriveClick=(node)=>{
if(node.childNodes){
[...node.childNodes].forEach(recuriveClick);
}
if(node?.classList&&node?.classList.contains("watch-video--skip-content-button")){
node.click();
GM_log('Recap Skipped');
}
if(node?.classList&&node?.classList.contains("main-hitzone-element-container")&&typeof node.firstChild.firstChild.firstChild!=='undefined'){
node.firstChild.firstChild.firstChild.firstChild.click();
GM_log('Continue Playing');// Span text=Continue Playing -> parent -> click
}
if(node?.classList&&node?.classList.contains("watch-video--skip-content-button")){
node.click();
GM_log('Intro Skipped');
}
if(node?.className==="main-hitzone-element-container"&&document.querySelectorAll("button").length===12){
setTimeout(()=>{document.querySelector(".button-nfplayerNextEpisode").click();},200);
GM_log('Next Ep');
}
};
const inteWatch=setInterval(tEvent,3000);
})();