Netflix skip intro and outro

Automatically skip intro and outro on Netflix

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 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);
})();