自研 - 豆瓣 - 调整预告片音量

当预告片播放时自动调整音量。

当前为 2024-03-23 提交的版本,查看 最新版本

// ==UserScript==
// @name               自研 - 豆瓣 - 调整预告片音量
// @name:en_US         Self-made - douban - Modify trailer volume
// @description        当预告片播放时自动调整音量。
// @description:en_US  When trailers play, automatically adjust the volume.
// @version            1.0.1
// @author             CPlayerCHN
// @license            MulanPSL-2.0
// @namespace          https://www.gitlink.org.cn/CPlayerCHN
// @match              https://movie.douban.com/trailer/*
// @icon               https://douban.com/favicon.ico
// @run-at             document-end
// @noframes
// ==/UserScript==

(function() {
    'use strict';

    // 定义「参数配置」「视频」变量和「调整音量」函数。
    const config = {
        "volme": "10" // 音量百分比。必须得是高于 0 且低于 101 数字,否则就会静音、最大音量甚至报错。
    },
          video = document.querySelector('.video-js video');

    function modifyVolme() {
        // 修改音量并移除监听。
        video.volume = config.volme * 0.01;
        video.removeEventListener("playing", modifyVolme);
    };

    // 监听到视频播放时就执行「调整音量」函数。
    video.addEventListener("playing", modifyVolme);

})();

QingJ © 2025

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