您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Manages the video controls overlay on a youtube video, to prevent it blocking 30-40 pixels on the bottom of the video
当前为
// ==UserScript== // @name Youtube Video Controls Manager // @namespace http://your.homepage/ // @version 0.01 // @description Manages the video controls overlay on a youtube video, to prevent it blocking 30-40 pixels on the bottom of the video // @include http*://www.youtube.com/watch?v=* // @author D.Slee // @match https://www.youtube.com/watch?v=rXj3hUB7BH8 // @grant none // ==/UserScript== var body = document.getElementById("body"); var playerAPI = document.getElementById("player-api") var progBar = document.getElementsByClassName("html5-video-controls")[0]; //Progress Bar var scrubBn = document.getElementsByClassName("html5-scrubber-button")[0]; //Circle Button (on progress bar) var vidCont = document.getElementsByClassName("html5-player-chrome")[0]; //Video controls var elements = [scrubBn, vidCont]; var fadeState = true; var fadeOutInterval = setTimeout(fadeOut, 0); //Interval used to fade out when inactive //Feel free to edit these parameters var progBarHide = false; var timeOut = 1000; //progBar handling progBar.style.setProperty("opacity", 1, "important") if (progBarHide == true){ elements.push(progBar) } //Initiate fadeOut() mainProgram() function mainProgram(){ playerAPI.addEventListener("mousemove", handleMouseOver, false) playerAPI.addEventListener("mouseout", handleMouseOut, false) body.addEventListener("keydown", handleKeyDown, false) } function handleMouseOver(){ fadeIn() } function handleMouseOut(){ fadeOut() } function handleKeyDown(e){ if (e.keyCode == 87 && fadeState == false){ fadeIn(); setTimeout(fadeOut, timeOut) } } function fadeIn(){ playerAPI.style.cursor = "default" progBar.style.bottom = "0px" clearTimeout(fadeOutInterval) fadeOutInterval = setTimeout(fadeOut, timeOut) fadeState = true for (i = 0; i<elements.length; i++){ elements[i].style.display = "block" } } function fadeOut(){ playerAPI.style.cursor = "none" progBar.style.bottom = "-5px" for (i = 0; i<elements.length; i++){ elements[i].style.display = "none" } fadeState = false }