Reliable Keys for YouTube Player

Removes the tabindex attribute from the YouTube player's controls, so that left/right keys always perform seeking and up/down keys always perform volume adjustments.

  1. // ==UserScript==
  2. // @name Reliable Keys for YouTube Player
  3. // @namespace https://youtube.com/
  4. // @version 1.0
  5. // @description Removes the tabindex attribute from the YouTube player's controls, so that left/right keys always perform seeking and up/down keys always perform volume adjustments.
  6. // @author timtimtimaroo
  7. // @match *://www.youtube.com/*
  8. // @grant none
  9. // @license copyright
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. function removeTabindex() {
  16. ['.ytp-progress-bar', '.ytp-volume-panel'].flatMap(s => [...document.querySelectorAll(s)]).forEach(panel => {
  17. if (panel.hasAttribute('tabindex')) {
  18. panel.removeAttribute('tabindex');
  19. console.log("[Reliable Keys for YouTube Player] Removed tabindex from:", panel);
  20. }
  21. });
  22. }
  23.  
  24. // Run once on load
  25. removeTabindex();
  26.  
  27. // Observe for changes in the page (useful for SPA behavior)
  28. const observer = new MutationObserver(removeTabindex);
  29. observer.observe(document.body, { childList: true, subtree: true });
  30.  
  31. })();
  32.  
  33.  

QingJ © 2025

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