Netflix skip intro and outro

Automatically skip intro and outro on Netflix

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Netflix skip intro and outro
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Automatically skip intro and outro on Netflix
// @author       Bobocato
// @match        https://www.netflix.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    setInterval(function(){
        //Check if on watching
        var urlParts = window.location.href.split("/");
        if(urlParts.indexOf("watch") > -1){
            var introSkip = document.getElementsByClassName("skip-credits")[0];
            if(typeof(introSkip) != "undefined"){
                console.log(introSkip);
                introSkip.children[0].click();
            }
            var hoverOutro = document.getElementsByClassName("WatchNext-still-container")[0];
            if(typeof(hoverOutro) != "undefined"){
                console.log("Skip that Outro");
                hoverOutro.click();
            }

            var links = document.getElementsByTagName("a");
            for (var i = 0; i < links.length; i++){
                if(links[i].children.length > 1 && links[i].className == "nf-icon-button nf-flat-button nf-flat-button-primary"){
                    var smallOutro = links[i];
                    console.log(links[i]);
                    if(smallOutro.parentElement.className != "PromotedVideo-actions"){
                        smallOutro.click();
                    }
                }
            }
        }
    }, 1000);
})();