Pobieracz YT 1.0 - Pobieracz.net (MP3, FHD, MP4, HD, SD, M4A, AAC, MKV, F4V, 3GP)

Pobieranie muzyki i filmów z YouTube //// Darmowe pobieranie: MP3, MP4 //// Pobieranie premium: MP3, FHD, MP4, HD, SD, M4A, AAC, MKV, F4V, 3GP ////

// ==UserScript==
// @name Pobieracz YT 1.0 - Pobieracz.net (MP3, FHD, MP4, HD, SD, M4A, AAC, MKV, F4V, 3GP)
// @description Pobieranie muzyki i filmów z YouTube //// Darmowe pobieranie: MP3, MP4 //// Pobieranie premium: MP3, FHD, MP4, HD, SD, M4A, AAC, MKV, F4V, 3GP ////
// @namespace https://greasyfork.org/pl/users/687419
// @homepageURL https://greasyfork.org/pl/scripts/411327
// @supportURL https://greasyfork.org/pl/scripts/411327/feedback
// @author Slayter
// @version 1.1
// @date 14.09.2020
// @icon https://i.imgur.com/Zd8tXze.jpg
// @compatible chrome
// @compatible firefox
// @compatible opera
// @compatible safari
// @license CC BY-NC-ND 4.0 International. https://creativecommons.org/licenses/by-nc-nd/4.0/
// @match *://*.youtube.com/*
// ==/UserScript==

(function() {
    if (document.getElementById("polymerz-app") || document.getElementById("masthead") || window.Polymerz) {
    setInterval(function() {
        if (window.location.href.indexOf("watch?v=") < 0) {
            return false;
        }
        if (document.getElementById("meta-contents") && document.getElementById("slayter") === null) {
            Addytpolymerz();
        }
    }, 100);



} else {

    setInterval(function() {
        if (window.location.href.indexOf("watch?v=") < 0) {
            return false;
        }
        if (document.getElementById("watch8-sentiment-actions") && document.getElementById("slayter") === null) {
            AddhtmlDV();
        }
    }, 100);


}

function AddhtmlDV() {
    if (document.getElementById("watch8-sentiment-actions")) {
        var wrap = document.getElementById('watch8-sentiment-actions');
        var button = "<div id='slayter' style='display: inline-block; margin-left: 5px; vertical-align: middle;'>";

        button += "<i style=\"position: absolute; display: inline-block; left: 6px; top: 3px; background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAA3UlEQVR42mNgoDX4//+/PhBHA7EnEHOSolEAiLf8RwL//v17DqRcCWkyBmJ2oOJN/7GDr0Csik2zG1DTZySb8IFJ2Aw4+594cASIGZE18wDxEzT/vgZSd0EYysZmiCBIsyMQv8CioAaIl0JxDQ6XLAAZ8B6HZDvIIVDcjk0B0GWfGKAKyDXgC8iAh2iCF4DUCSAuQDKgACp2EU3tclj0fUESBMV/ChAfQjIAxE5BSxvngVgMFgvSQJwKxIVQ2/SRFUPZ+lD5PCD2AWIWQkmZE2rzQZLyAJakLUDT3AoALzJfljL5Yb4AAAAASUVORK5CYII=); background-size: 12px; background-repeat: no-repeat; background-position: center center; width: 16px; height: 16px;\"></i>";
        button += "<span style=\"padding-right: 12px;\">Pobierz</span></a></div>";
        var style = "<style>#slayter button: -moz-focus-inner {padding: 0; margin:0} #slayter a {background-color: #1A1616} #slayter a:hover {background-color: #1A1616} #slayter a:active {background-color: #1A1616}</style>";
        var tmp = wrap.innerHTML;
        wrap.innerHTML = tmp + button + style;
    }
}

function Addytpolymerz() {
    var buttonDiv = document.createElement("span");
    buttonDiv.id = "slayter";
    buttonDiv.style.width = "100%";
    buttonDiv.style.marginTop = "3px";
    buttonDiv.style.padding = "20px 0";
    var addButton = document.createElement("a");
    addButton.appendChild(document.createTextNode("POBIERZ"));
    addButton.style.width = "100%";
    addButton.style.cursor = "pointer";
    addButton.style.height = "inherit";
    addButton.style.backgroundColor = "green";
    addButton.style.color = "#ffffff";
    addButton.style.padding = "10px 22px";
    addButton.style.margin = "0px 0px";
    addButton.style.border = "0";
    addButton.style.borderRadius = "2px";
    addButton.style.fontSize = "1.4rem";
    addButton.style.fontFamily = "inherit";
    addButton.style.textAlign = "center";
    addButton.style.textDecoration = "none";
    addButton.href = "//pobieracz.net/?URL=" + encodeURIComponent(location.href);
    addButton.target = "_blank";
    buttonDiv.appendChild(addButton);

    var targetElement = document.querySelectorAll("[id='subscribe-button']");
    if(targetElement){
      for(var i = 0; i < targetElement.length; i++){
        if(targetElement[i].className.indexOf("ytd-video-secondary-info-renderer") > -1){
            targetElement[i].appendChild(buttonDiv);
        }
      }
    }
}
})();