Advertisement Hide - Youtube

Выключает рекламу или звук в рекламе на ресурсе Youtube

目前为 2021-04-26 提交的版本。查看 最新版本

// ==UserScript==
// @name           Advertisement Hide - Youtube
// @namespace      scriptomatika
// @author         mouse-karaganda
// @description    Выключает рекламу или звук в рекламе на ресурсе Youtube
// @include        https://*.youtube.com/*
// @require        https://gf.qytechs.cn/scripts/379902-include-tools/code/Include%20Tools.js
// @version        1.1
// @grant          none
// ==/UserScript==

var paramWindow = (typeof unsafeWindow === 'object') ? unsafeWindow : window;

(function(unsafeWindow) {
    var console = unsafeWindow.console;
    var $ = unsafeWindow.jQuery;
    var $$ = unsafeWindow.__krokodil;

    $$.renderStyle(
        '',
        ''
    );

    unsafeWindow.greasyMovieVolumeOn = false;

    /**
     * Выключает звук на внутренней рекламе
     */
    var muteInternalAdverts = function() {
        var button;

        if (button = $$.get(`.ytp-ad-overlay-slot .ytp-ad-overlay-close-button`)) {
            $$.fireEvent(button, 'click');
        }
        if (button = $$.get(`.video-ads .ytp-ad-skip-button-container`)) {
            $$.fireEvent(button, 'click');
        }
        if (button = $$.get(`.ytp-ad-preview-container`)) {
            if (button = $$.get(`#movie_player .ytp-mute-button[title^="Отключение звука"]`)) {
                $$.fireEvent(button, 'click');
            }
            unsafeWindow.greasyMovieVolumeOn = false;
        } else {
            if (!unsafeWindow.greasyMovieVolumeOn) {
                if (button = $$.get(`#movie_player .ytp-mute-button[title^="Включить звук"]`)) {
                    $$.fireEvent(button, 'click');
                }
                unsafeWindow.greasyMovieVolumeOn = true;
            }
        }
    };

    var muteTimer = setInterval(muteInternalAdverts, 80);
    console.log('Advertisement Hide - Youtube');
})(paramWindow);

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址