ABEMA 動画の尺を非表示

サッカーなどを追っかけ再生する際、動画の長さで延長戦の有無などが分かってしまうのを回避する

目前为 2024-06-28 提交的版本。查看 最新版本

// ==UserScript==
// @name        ABEMA 動画の尺を非表示
// @namespace   Violentmonkey Scripts
// @match       https://abema.tv/*
// @grant       none
// @version     1.0
// @author      Masao S
// @license     MIT
// @description サッカーなどを追っかけ再生する際、動画の長さで延長戦の有無などが分かってしまうのを回避する
// ==/UserScript==

(function() {
    'use strict';

    function blurVideoDuration() {
        const targetNode = document.querySelector('.com-live-event-LiveEventPlayerSectionLayout');
        if (!targetNode) return;

        // 動画一覧の動画の時間表示をぼかす
        const durations = document.querySelectorAll('.com-content-list-ContentListLiveEventItem__duration')
        if (durations) {
          durations.forEach(function(item) {
            item.style.filter = 'blur(5px)'
          });
        }

        // 再生画面のプレイヤー上の時間表示をぼかす
        if (document.location.pathname.indexOf('live-event') > 0) {
            const el = document.querySelectorAll('.com-vod-VideoControlBar__time time');
            if (el && el.length > 1) {
                el[1].style.filter = 'blur(5px)';
            }
        }
    }

    function observeDOMChanges() {
        const targetNode = document.body; // FIXME: body全体でなくても良いかも
        if (!targetNode) return;

        const observer = new MutationObserver((mutationsList) => {
            for (const mutation of mutationsList) {
                if (mutation.type === 'childList' || mutation.type === 'subtree') {
                    blurVideoDuration();
                }
            }
        });

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

        // 初回実行
        blurVideoDuration();
    }

    // 初回監視設定
    observeDOMChanges();

    // URLの変化を監視して再度監視設定を行う
    let previousUrl = window.location.href;
    setInterval(() => {
        const currentUrl = window.location.href;
        if (currentUrl !== previousUrl) {
            previousUrl = currentUrl;
            observeDOMChanges();
        }
    }, 1000);
})();

QingJ © 2025

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