YouTube Download

On youtube click the download link to download youtube video.

Fra 14.05.2015. Se den seneste versjonen.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         YouTube Download
// @namespace    http://your.homepage/
// @version      3.3
// @description  On youtube click the download link to download youtube video.
// @author       Henry Harris
// @match        https://www.youtube.com/*
// @match        http://catchvideo.net/*
// @grant        none
// @require      http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js
// @run-at document-end
// ==/UserScript==





$(document).ready ( function(){
// -----------------------Runs on YOUTUBE--------------------------------------------------------------	   
	setInterval(function(){
    if(window.location.href.indexOf("you") > -1) {
        if ($('#watch7-headline').length > 0) {
    		if ($('#downloadlnk').length > 0) {
    		
            } else {
                
                
                
                 if ($('.html5-player-chrome').length > 0) {
                     
                     if ($('#vidctrls').length > 0) {
                     
                     } else{
                         
                         document.querySelector('div.html5-player-chrome').id = 'vidctrls';

                         var c = document.createElement('img');
                         c.src = "http://upload.wikimedia.org/wikipedia/commons/thumb/c/ca/Egypt_governorates_blank.png/597px-Egypt_governorates_blank.png";
                         c.height = "30";
                         c.width = "10";
                         
                         
                         var b = document.createElement('img');
                         b.src = "http://images.clipartpanda.com/square-clip-art-black-and-white-0999d59a768fa638a6f16f4a44299e29.png";
                         b.height = "30";
                         b.width = "30";
                         b.title = "Download this video";
                         b.onclick = function () {
                             window.open("http://catchvideo.net/?url=" + document.URL)
                         };

                         document.getElementById("vidctrls").appendChild(c);
                         document.getElementById("vidctrls").appendChild(b);
                     }
                     
                 } else {
                
                var downdiv = document.createElement("div");
                downdiv.id = "downdiv";
                
                
                var a = document.createElement('a');
            var linkText = document.createTextNode("Download");
            a.appendChild(linkText);
            a.id = "downloadlnk";
            a.title = "Download this video";
            a.onclick = function () {
                window.open("http://catchvideo.net/?url=" + document.URL)
            };
                
                
            
            //document.body.appendChild(a);
            document.getElementById("watch7-headline").appendChild(downdiv);
            document.getElementById("downdiv").appendChild(a);
            document.getElementById("downloadlnk").style.fontSize = "x-large";
            var br1 = document.createElement('br');
            document.getElementById("watch7-headline").appendChild(br1);
            var br2 = document.createElement('br');
            document.getElementById("watch7-headline").appendChild(br2);
            
                
            }
    	}
	}
        
    }

    }, 2000);
// --------------------------RUNS ON KEEPVID TO DOWNLOAD VIDEO--------------------------------------------    
    if(window.location.href.indexOf("catch") > -1) {
    /*var iDiv = document.createElement('div');

        iDiv.id = 'block';
        iDiv.className = 'block';
        document.getElementsByTagName('body')[0].appendChild(iDiv);
        iDiv.height = window.height();
        iDiv.width = window.width();
        $(iDiv).css({
            position: 'fixed',
            top: 0,
            right: 0,
            bottom: 0,
            left: 0,
            zIndex: 999
        });*/



        
        if(!$('#javaUserWarning').is(':visible')) {
            
            
    setInterval(function(){
    if ($(".thumb")[0]){
        var els = document.getElementsByClassName('btn green');
        var href = els[0].href
        
        window.location = href
        
        
        
        setTimeout(function(){
    
            window.close();
    
            
       }, 2000);
    } else {
    //alert("test");
    }
    
    }, 3000);
        
     //document.getElementById("checkboxDisableJava1").checked = true;
        
    

        
            } else {
                alert("Please check disable java applet and retry.");
        }
}
});

// -----------------------Runs on YOUTUBE--------------------------------------------------------------
//$(document).keydown(function (e) {
  //  if (e.keyCode == 113) {
        //window.open("http://keepvid.com/?url=" + document.URL)
        
    //    var a = document.createElement("a");
    //a.href = "http://catchvideo.net/?url=" + document.URL;
    //var evt = document.createEvent("MouseEvents");    
    //evt.initMouseEvent("click", true, true, window, 0, 0, 0, 0, 0, true, false, false, false, 0, null);
    //a.dispatchEvent(evt);
    //}
//});