您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
The arrow buttons don't depend on slider/seekbar focus. Left/Right - always playback, Down/Up - always sound volume.
当前为
- // ==UserScript==
- // @name [youtube.com] Arrow buttons constant binding
- // @name:ru [youtube.com] Неизменные действия для клавиш стрелок
- // @description The arrow buttons don't depend on slider/seekbar focus. Left/Right - always playback, Down/Up - always sound volume.
- // @description:ru Клавиши стрелок не зависят от фокуса ползунков. Влево/Вправо - всегда перемотка, Вниз/Вверх - всегда громкость.
- // @namespace youtube.com/arrows.constant.binding
- // @author Zaytsev Artem
- // @version 0.0.1.2
- // @match https://*.youtube.com/*
- // ==/UserScript==
- /*
- document.addEventListener('focusin', (event) => {
- console.log("GM-youtube-novf: Focusin: " + event.target.className);
- });
- */
- //Sound volume panel.
- //console.log("GM-youtube-novf: Quering the .ytp-volume-panel...");
- var q_vp = document.querySelector(".ytp-volume-panel");
- if (q_vp) {
- q_vp.addEventListener('focus', (event) => {
- //console.log("GM-youtube-novf: .ytp-volume-panel tried to get focus.");
- //event.target.focusout();
- //event.target.blur();
- document.querySelector(".html5-video-player").focus({preventScroll:true});
- });
- console.log("GM-youtube-novf: .ytp-volume-panel element found.");
- window.setTimeout(function(){
- //console.log("GM-youtube-novf: Setting .ytp-volume-panel's tabindex to -1...");
- q_vp.setAttribute("tabindex", "-1");
- }, 3000)
- }
- //Somehow the slider also wants to get the focus although it doesn't have a tabindex set.
- var q_vsh = document.querySelector(".ytp-volume-slider-handle");
- if (q_vsh) {
- q_vsh.addEventListener('focus', (event) => {
- //console.log("GM-youtube-novf: .ytp-volume-slider-handle tried to get focus.");
- document.querySelector(".html5-video-player").focus({preventScroll:true});
- });
- window.setTimeout(function(){
- //console.log("GM-youtube-novf: Setting .ytp-volume-slider-handle's tabindex to -1...");
- q_vsh.setAttribute("tabindex", "-1");
- }, 3000)
- }
- //The player playback seekbar.
- var q_pb = document.querySelector(".ytp-progress-bar");
- if (q_pb) {
- q_pb.addEventListener('focus', (event) => {
- //console.log("GM-youtube-novf: .ytp-progress-bar tried to get focus.");
- document.querySelector(".html5-video-player").focus({preventScroll:true});
- });
- window.setTimeout(function(){
- //console.log("GM-youtube-novf: Setting .ytp-progress-bar's tabindex to -1...");
- q_pb.setAttribute("tabindex", "-1");
- }, 3000)
- }