您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Toggle mini player when scrolling down in Youtube
当前为
// ==UserScript== // @name Youtube Mini Player // @namespace feifeihang.info // @description Toggle mini player when scrolling down in Youtube // @include https://youtu.be/* // @include http://youtu.be/* // @include https://www.youtube.com/watch?* // @include http://www.youtube.com/watch?* // @version 1 // @grant none // ==/UserScript== (function (window, document, undefined) { // find and keep a reference of the video player. var player = document.querySelector('.video-stream'); var style = ''; // a flag to indicate is the mini player is toggled. var isToggled = false; var originalHeight; window.addEventListener('scroll', function () { // when scrolling up to 1/3 original player height, turn off mini player. if (isToggled && window.pageYOffset < originalHeight / 3) { player.style = style; isToggled = false; return; } // when scrolling down to 1/3 player height, go to mini player mode. if (!isToggled && window.pageYOffset >= parseInt(player.style.height, 10) / 3) { originalHeight = parseInt(player.style.height, 10); style = player.style.cssText; var top = 'top: ' + (window.innerHeight - 270) + 'px;'; player.style = 'position: fixed; bottom: 20px; left: 20px; height: 250px;' + 'width: 350px; z-index: 9999999;' + top; isToggled = true; } }, false); })(this, this.document);