Plex auto-skip intro

Automatically press the Plex "Skip intro" button when it appears.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         Plex auto-skip intro
// @namespace    https://greasyfork.org/en/users/555204-bcldvd
// @version      0.1
// @description  Automatically press the Plex "Skip intro" button when it appears.
// @author       Dustin Höfer
// @match        https://app.plex.tv/desktop
// @grant        none
// ==/UserScript==

(function() {
    let observer = new MutationObserver(function(mutations) {
        mutations.forEach(function(mutation) {
            if(mutation.addedNodes.length > 0 && mutation.addedNodes[0]){
             var xpathResult = document.evaluate("(//text()[contains(., 'Skip Intro')])[1]", document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
                var node=xpathResult.singleNodeValue;
                if (node!=null){
                    setTimeout(() => {
                        document.getElementsByClassName("AudioVideoFullPlayer-overlayButton-30Vz4v Button-button-2kT68l Link-link-2n0yJn Button-button-2kT68l Link-link-2n0yJn Button-default--yDCH5 Button-large-3S9UdJ Link-link-2n0yJn Link-default-2XA2bN     ")[0].click();
                }, 2000);
                }


            }
        });
    });
    observer.observe(element, { childList: true, subtree: true });
})();