Jutsu helper

Скрипт для автоматического пропуска опенингов и эндингов

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name Jutsu helper
// @description Скрипт для автоматического пропуска опенингов и эндингов
// @author Murka
// @version 0.3
// @icon https://gen.jut.su/safari_152.png
// @match *://jut.su/*
// @run-at document-end
// @grant none
// @license MIT
// @namespace https://greasyfork.org/users/919633
// ==/UserScript==
/* jshint esversion:6 */

(function() {

    function isVisible(elem) {
        return elem && elem.offsetParent !== null;
    }

    (function loop() {
        const opening = document.querySelector("div[title='Нажмите, если лень смотреть опенинг']");
        const ending = document.querySelector("div[title='Перейти к следующему эпизоду']");
        const playButton = document.querySelector("button[title='Воспроизвести видео']");
        const fullButton = document.getElementById("my-player_html5_api");

        if (isVisible(opening)) opening.click();
        if (isVisible(ending)) ending.click();
        if (isVisible(playButton)) {
            playButton.click();
            //fullButton.style='    width: 1960px;    position: fixed;    height: 1080px;    z-index: 9999;    top: -150px;    left: 0px;';
        }
        setTimeout(loop, isVisible(opening) || isVisible(ending) ? 5000 : 250);
    })();

})();