Stops YouTube Video From Downloading.
当前为
// ==UserScript==
// @name Custom YouTube Video Seeking
// @namespace http://www.diamonddownload.weebly.com
// @description Stops YouTube Video From Downloading.
// @include http://*.youtube.com/*
// @include http://youtube.com/*
// @include https://*.youtube.com/*
// @include https://youtube.com/*
// @grant none
// @version 1.0
// @run-at document-body
// @author R.F Geraci
// ==/UserScript==
//============CUSTOM SETTINGS============
var showPauseButton = true;
var showBackwardsSeekButton = false;
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";};