Jutsu helper

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

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

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.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==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);
    })();

})();