您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Adds +-30sec +-1min +-5min buttons below the video
当前为
- // ==UserScript==
- // @name m.YouTube.com seek buttons
- // @namespace m-youtube-com-seek-buttons
- // @version 1.3
- // @description Adds +-30sec +-1min +-5min buttons below the video
- // @author hlorand.hu
- // @match https://m.youtube.com/*
- // @icon https://www.google.com/s2/favicons?sz=64&domain=tampermonkey.net
- // @grant none
- // @license https://creativecommons.org/licenses/by-nc-sa/4.0/
- // ==/UserScript==
- // Screenshot: https://ibb.co/72YKQPn
- (function() {
- //'use strict';
- function addbuttons(){
- document.getElementById("seekbuttons").innerHTML = "";
- const times = ["+300s", "+60s", "+30s", "-30s", "-60s", "-300s"];
- times.forEach((time)=>{
- let button = document.createElement('button');
- button.textContent = time;
- button.style.margin = "4px";
- button.style.padding = "4px";
- button.style.backgroundColor = "purple";
- button.style.position = "relative";
- button.onclick = function() {
- let video = document.querySelector("video");
- if(video && video.readyState >= 2) {
- video.currentTime += parseInt(this.textContent.replace("s",""));
- }
- };
- let target = document.getElementById("seekbuttons");
- target.insertBefore(button, target.firstChild);
- }); // end times foreach
- } // end addbuttons
- // Periodically check if the buttons are visible
- // (sometimes YouTube redraws its interface).
- setInterval(()=>{
- // Creating a div that will contain buttons.
- if( document.getElementById("seekbuttons") == undefined ){
- let parent = document.querySelector('.related-chips-slot-wrapper'); // placement of buttons
- let wrapper = document.createElement('div');
- wrapper.setAttribute("id","seekbuttons");
- parent.insertBefore(wrapper, parent.firstChild);
- addbuttons();
- }
- }, 1000);
- })();