BetterAnimeWorld

Migliora AnimeWorld

目前为 2020-07-24 提交的版本。查看 最新版本

// ==UserScript==
// @name         BetterAnimeWorld
// @namespace    https://pizidavi.altervista.org/
// @version      1.4.1
// @description  Migliora AnimeWorld
// @author       pizidavi
// @require      https://cdn.jsdelivr.net/gh/soufianesakhi/node-creation-observer-js@edabdee1caaee6af701333a527a0afd95240aa3b/release/node-creation-observer-latest.min.js
// @include      https://*.animeworld.*
// @run-at       document-body
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    NodeCreationObserver.onCreation('.widget.watchlist', function (element) {
        S('.cover-profilo-aw').style.display = 'none';
        S('#no-comments').style.display = 'none';
        //S('.menu-profile').style.display = 'none';
        S('.menu-profile > a:nth-child(2)').href = '/watchlist/1499?sort=a-z';

        window.onload = function() {
            setTimeout(function() {
                element.querySelector('[data-name="watching"]').click();
            }, 50);
        };
    });

    NodeCreationObserver.onCreation('#sign > div.signed', function (element) {
        element.querySelector('div > ul > li:nth-child(3) > a').href = '/watchlist/1499?sort=a-z';
    });

    if(location.pathname.includes('/play/')){
        NodeCreationObserver.onCreation('#player .cover, div.server ul a, #controls > div.prevnext', function (element) {
            element.addEventListener('click', function() {
                window.scrollTo(0, 133);
                var r = S('#controls .resize');
                if(r.textContent.includes("Espandi")) r.click();

                setTimeout(function(){
                    S('#controls .light').click();
                    document.cookie = "expandedPlayer=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;";
                }, 700);
            });
        });
    }

    function S(selector) {
        return document.querySelector(selector); }

})();