您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Keeps video player where it always looks good, even without scrolling.
当前为
// ==UserScript== // @name Gelbooru Size Video in View // @namespace https://greasyfork.org/en/users/460331-xerodusk // @version 2.0.1 // @description Keeps video player where it always looks good, even without scrolling. // @author Xerodusk // @homepage https://greasyfork.org/en/users/460331-xerodusk // @license GPL-3.0-or-later // @match https://gelbooru.com/index.php?page=post&s=view* // @grant none // @icon https://gelbooru.com/favicon.png // ==/UserScript== /* jshint esversion: 6 */ (function() { 'use strict'; // Get current video elements const video = document.getElementById('gelcomVideoPlayer'); if (!video) { return; } const player = video.parentNode; const webm = video.querySelector('[type="video/webm"]'); const mp4 = video.querySelector('[type="video/mp4"]'); // Create replacement video element // Necessary to detach terrible breaking scripts present on the original player const newVideo = document.createElement('video'); newVideo.id = 'newGelcomVideoPlayer'; newVideo.controls = 'controls'; newVideo.flashstopped = 'true'; newVideo.name = 'media'; newVideo.loop = 'loop'; newVideo.preload = 'metadata'; // Copy over attributes from current video element newVideo.width = video.width; newVideo.height = video.height; newVideo.poster = video.poster; newVideo.appendChild(webm); newVideo.appendChild(mp4); // Apply styling to fix size const css = document.createElement('style'); css.appendChild(document.createTextNode(` #newGelcomVideoPlayer { width: auto !important; height: auto !important; max-width: min(100%, 1000px) !important; max-height: calc(100vh - 244px) !important; } `)); document.head.appendChild(css); // Replace video element player.before(newVideo); player.remove(); })();