您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Adds buttons to YouTube videos to allow custom seeking. It also adds a handy stop start button for stopping to video quickly.
当前为
- // ==UserScript==
- // @name Custom YouTube Video Seeking
- // @namespace http://www.diamonddownload.weebly.com
- // @description Adds buttons to YouTube videos to allow custom seeking. It also adds a handy stop start button for stopping to video quickly.
- // @include http://*.youtube.com/*
- // @include http://youtube.com/*
- // @include https://*.youtube.com/*
- // @include https://youtube.com/*
- // @grant none
- // @version 1.2
- // @run-at document-body
- // @author R.F Geraci
- // @icon64 http://icons.iconarchive.com/icons/designbolts/minimalist-social/64/YouTube-icon.png
- // ==/UserScript==
- //============CUSTOM SETTINGS============
- var showPauseButton = true;
- var showBackwardsSeekButton = true;
- var showForwardsSeekButton = true;
- //=======================================
- var toggle = false;
- var btn;
- var Tbox;
- var SeekBBtn;
- var SeekFBtn;
- var label;
- var p = document.getElementsByClassName('video-stream html5-main-video')[0];
- var container = document.getElementById('watch7-user-header');
- function stopvidload(){
- if (p){
- toggle = !toggle;
- if (toggle){
- btn.innerText = "Play Video";
- p.pause();
- }else{
- btn.innerText = "Stop Video";
- p.play();
- }
- }
- }
- function seekForward(){
- if (Tbox.value != "" && Tbox.value > 0){
- var int = parseInt(Tbox.value, 10);
- p.currentTime += int;
- }
- }
- function seekBackward(){
- if (Tbox.value != "" && Tbox.value > 0){
- var int = parseInt(Tbox.value, 10);
- p.currentTime -= int;
- }
- }
- btn = document.createElement('button');
- btn.id = 'stop-download';
- btn.type = 'button';
- btn.title = 'Stop Youtube Download';
- btn.className ='yt-subscription-button yt-uix-button yt-uix-button-subscribe-branded';
- btn.setAttribute('style', 'margin-left: 5px; outline: none;');
- btn.innerText = "Stop Video";
- container.appendChild(btn);
- btn.addEventListener('click',stopvidload, true);
- if (showPauseButton == true){
- btn.style.display = "inline-block";
- }else{
- btn.style.display = "none";
- }
- SeekBBtn = document.createElement('button');
- SeekBBtn.id = 'Seek-B-Increment';
- SeekBBtn.type = 'button';
- SeekBBtn.title = 'Seek Backward';
- SeekBBtn.className = 'yt-subscription-button yt-uix-button yt-uix-button-subscribe-branded';
- SeekBBtn.setAttribute('style', 'margin-left: 5px; outline: none; width: 25px;');
- SeekBBtn.innerText = "◄";
- container.appendChild(SeekBBtn);
- SeekBBtn.addEventListener('click',seekBackward, true);
- if (showBackwardsSeekButton == true){
- SeekBBtn.style.display = "inline-block";
- }else{
- SeekBBtn.style.display = "none";
- }
- SeekFBtn = document.createElement('button');
- SeekFBtn.id = 'Seek-F-Increment';
- SeekFBtn.type = 'button';
- SeekBBtn.title = 'Seek Forward';
- SeekFBtn.className = 'yt-subscription-button yt-uix-button yt-uix-button-subscribe-branded';
- SeekFBtn.setAttribute('style', 'margin-left: 5px; outline: none; width: 25px;');
- SeekFBtn.innerText = "►";
- container.appendChild(SeekFBtn);
- SeekFBtn.addEventListener('click',seekForward, true);
- if (showForwardsSeekButton == true){
- SeekFBtn.style.display = "inline-block";
- }else{
- SeekFBtn.style.display = "none";
- }
- if (showForwardsSeekButton || showBackwardsSeekButton){
- Tbox = document.createElement('input');
- Tbox.id = 'Increment-value';
- Tbox.type ='number';
- Tbox.setAttribute('style', 'position: relative; top: 2px; margin-left: 5px; outline: none; width: 35px;');
- Tbox.value = "5";
- Tbox.min = "0";
- Tbox.setAttribute('maxlength', "5");
- container.appendChild(Tbox);
- label = document.createElement('label');
- label.id = 'Seek-Label';
- label.type = 'text';
- label.setAttribute('style', 'position: relative; top: 2px; margin-left: 5px; outline: none;');
- label.innerText = "Seconds";
- container.appendChild(label);
- }
- p.onpause = function(){btn.innerText = "Play Video";};
- p.onplay = function(){btn.innerText = "Stop Video";};