时间领主

在所有网页右下角加一个倍速操作界面

当前为 2024-08-28 提交的版本,查看 最新版本

// ==UserScript==
// @name        时间领主
// @namespace   http://tampermonkey.net/
// @version     1.0
// @description 在所有网页右下角加一个倍速操作界面
// @license     MIT
// @author      失辛向南
// @match       *://*/*
// @grant       none
// ==/UserScript==

(function () {
    'use strict';

    const speedControlContainer = document.createElement('div');
    speedControlContainer.style.position = 'fixed';
    speedControlContainer.style.bottom = '20px';
    speedControlContainer.style.right = '20px';
    speedControlContainer.style.backgroundColor = 'rgba(0, 0, 0, 0.7)';
    speedControlContainer.style.padding = '10px';
    speedControlContainer.style.borderRadius = '5px';
    speedControlContainer.style.color = 'white';
    speedControlContainer.style.zIndex = '9999';

    const speedLabel = document.createElement('span');
    speedLabel.textContent = 'Speed: ';
    speedControlContainer.appendChild(speedLabel);

    const speedSelect = document.createElement('select');
    for (let i = 1; i <= 20; i += 1) {
        const option = document.createElement('option');
        option.value = i;
        option.textContent = i + 'x';
        speedSelect.appendChild(option);
    }
    speedControlContainer.appendChild(speedSelect);

    document.body.appendChild(speedControlContainer);

    function updateVideoSpeeds() {
        const videos = document.getElementsByTagName('video');
        for (let video of videos) {
            video.playbackRate = parseFloat(speedSelect.value);
        }
    }

    speedSelect.addEventListener('change', updateVideoSpeeds);
})();

QingJ © 2025

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