Greasy Fork

来自缓存

Greasy Fork is available in English.

Bitchute playback speed control hotkeys

Allows for adjusting the Bitchute player playback speed using the + and - numpad keys, adjusing playback by 25% increments, and allows setting the speed above the standard 2x speed cap. It will temporarily show the current playback speed in a little popup in the top-right corner of the player.

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        Bitchute playback speed control hotkeys
// @namespace   Violentmonkey Scripts
// @match       https://www.bitchute.com/video/*
// @grant       GM_addStyle
// @version     1.0
// @author      The Mickey J
// @description Allows for adjusting the Bitchute player playback speed using the + and - numpad keys, adjusing playback by 25% increments, and allows setting the speed above the standard 2x speed cap. It will temporarily show the current playback speed in a little popup in the top-right corner of the player.
// ==/UserScript==

$change = 0.25;
$hookedUp = false;
var hideSpeedDisplayTimeout;

function setSpeed(speed) {
      document.getElementById('player').playbackRate = speed;
      var speedDisplay = document.getElementById("JSpeedDisplay");
      speedDisplay.innerHTML = "Speed: " + speed;
      speedDisplay.className = "show";
      //If we had a timeout, kill it.
      clearTimeout(hideSpeedDisplayTimeout);
      //And start a new one.
      hideSpeedDisplayTimeout = setTimeout(function(){ speedDisplay.className = speedDisplay.className.replace("show", ""); }, 2000);
}

function doc_keyUp(e) {
    switch (e.keyCode) {
        case 187:
            //+ key number row
        case 107:
            //+ key keypad
            if($hookedUp) {
              var speed = document.getElementById('player').playbackRate + $change;
              setSpeed(speed);
            }
            break;
        case 189:
            //- key number row
        case 109:
            //- key numpad
            if($hookedUp) {
              var speed = document.getElementById('player').playbackRate - $change;
              setSpeed(speed);
            }
            break;
        default:
            break;
    }
}
document.addEventListener('keyup', doc_keyUp, false);



GM_addStyle(`
#JSpeedDisplay {
  display: block;
  width: auto;
  top: 2%;
  right: 2%;
  position: absolute;
  font-weight: 500;
  font-size: xxx-large;
  color: white;
  -webkit-text-stroke: 2px black;
  font-weight: bold;
  visibility: hidden; /* Hidden by default. Visible on click */
}
#JSpeedDisplay.show {
  visibility: visible;
}

`);


function insertSetSpeedDiv() {
	var container_block = document.querySelector('.plyr');
	if(container_block) {
    block_to_insert = document.createElement( 'div' );
    block_to_insert.id = "JSpeedDisplay";
    block_to_insert.innerHTML = 'Speed: 1';
    container_block.appendChild( block_to_insert );
    $hookedUp = true;
    return true;
	}
	return false;
}

function KeepTrying(func, attempts, delayMillis) {
	console.log('Trying to insert Speed Display div, remaining attempts: ' + attempts);
	if(!func() && (attempts-1 > 0)) {
		window.setTimeout(function() {
			KeepTrying(func, attempts-1, delayMillis);
		}, delayMillis);
	}
}

KeepTrying(insertSetSpeedDiv, 12, 500);