您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Customize YouTube skip time by arrow key
- // ==UserScript==
- // @name YouTube Skip Time Customizer
- // @namespace http://tampermonkey.net/
- // @version 1.1
- // @description Customize YouTube skip time by arrow key
- // @author TrainingDummy1
- // @match https://www.youtube.com/*
- // @grant none
- // @license MIT
- // ==/UserScript==
- (function() {
- 'use strict';
- // 원하는 이동 시간을 초 단위로 설정하세요
- const customSkipTime = 2; // 화살표 키로 이동할 시간 (2초)
- document.addEventListener('keydown', (event) => {
- const video = document.querySelector('video');
- if (!video) return;
- // 화살표 키에 대한 기본 동작을 완전히 차단
- //if ((event.target.id == "container" || event.target.classList.contains("html5-video-container") || event.target.classList.contains("html5-video-player") || event.target.nodeName == "VIDEO") && (event.key === 'ArrowRight' || event.key === 'ArrowLeft')) {
- if ((event.target.getAttribute('contenteditable') !== 'true' && event.target.id !== 'contenteditable-root') && (event.key === 'ArrowRight' || event.key === 'ArrowLeft')) {
- event.preventDefault(); // 유튜브 기본 동작 차단
- event.stopPropagation(); // 이벤트가 유튜브로 전달되지 않도록 차단
- if (event.key === 'ArrowRight') {
- video.currentTime += customSkipTime; // 지정한 시간만큼 앞으로 이동
- } else if (event.key === 'ArrowLeft') {
- video.currentTime -= customSkipTime; // 지정한 시간만큼 뒤로 이동
- }
- }
- }, true); // true 옵션으로 캡처 단계에서 이벤트를 가로챔
- })();