您需要先安装一个扩展,例如 篡改猴、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.1.0
- // @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 showOnPageLoad = false;
- //=======================================
- var toggle = false;
- var btn;
- var Tbox;
- var SeekBBtn;
- var SeekFBtn;
- var label;
- var CheckBox;
- var div;
- 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;
- }
- }
- div = document.createElement('div');
- div.id = 'myDiv';
- div.setAttribute('style', 'outline: none; display:none; ');
- container.appendChild(div);
- btn = document.createElement('button');
- btn.id = 'Play-Video';
- btn.type = 'button';
- btn.title = 'Play/Pause Video';
- btn.className ='yt-subscription-button yt-uix-button yt-uix-button-subscribe-branded';
- btn.setAttribute('style', 'margin-left: 5px; outline: none; display: inline;');
- btn.innerText = "Stop Video";
- div.appendChild(btn);
- btn.addEventListener('click',stopvidload, true);
- 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; display: inline;');
- SeekBBtn.innerText = "◄";
- div.appendChild(SeekBBtn);
- SeekBBtn.addEventListener('click',seekBackward, true);
- 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; display: inline;');
- SeekFBtn.innerText = "►";
- div.appendChild(SeekFBtn);
- SeekFBtn.addEventListener('click',seekForward, true);
- Tbox = document.createElement('input');
- Tbox.id = 'Increment-value';
- Tbox.type ='number';
- Tbox.setAttribute('style', 'margin-left: 5px; outline: none; width: 35px; display: inline; position: relative; top: 2px;');
- Tbox.value = "5";
- Tbox.min = "0";
- Tbox.setAttribute('maxlength', "5");
- div.appendChild(Tbox);
- label = document.createElement('label');
- label.id = 'Seek-Label';
- label.type = 'text';
- label.setAttribute('style', 'margin-left: 5px; outline: none; display: inline; position: relative; top: 2px;');
- label.innerText = "Seconds";
- div.appendChild(label);
- CheckBox = document.createElement('input');
- CheckBox.id = 'myCheckbox';
- CheckBox.type = 'checkbox';
- CheckBox.title = 'Show/Hide Custom Video Seeking';
- CheckBox.className ='yt-subscription-button yt-uix-button yt-uix-button-subscribe-branded';
- CheckBox.setAttribute('style', 'margin-left: 5px; outline: none; display: inline; position: relative; top: 2px;');
- CheckBox.checked = false;
- container.appendChild(CheckBox);
- if (showOnPageLoad){
- CheckBox.checked = true;
- div.style.display = "inline-block";
- }else{
- CheckBox.checked = false;
- div.style.display = "none";
- }
- setInterval(function(){
- if(CheckBox.checked == true){
- div.style.display = "inline-block";
- }else{
- div.style.display = "none";
- }
- }, 10);
- p.onpause = function(){btn.innerText = "Play Video"; toggle = true;};
- p.onplay = function(){btn.innerText = "Stop Video"; toggle = false;};