YouTube Annotation Ripper

Appends the each annotation text to a textbox box below the video for easy copying.

Per 08-08-2014. Zie de nieuwste versie.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey, Greasemonkey of Violentmonkey.

Voor het installeren van scripts heb je een extensie nodig, zoals {tampermonkey_link:Tampermonkey}.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey of Violentmonkey.

Voor het installeren van scripts heb je een extensie nodig, zoals Tampermonkey of Userscripts.

Voor het installeren van scripts heb je een extensie nodig, zoals {tampermonkey_link:Tampermonkey}.

Voor het installeren van scripts heb je een gebruikersscriptbeheerder nodig.

(Ik heb al een user script manager, laat me het downloaden!)

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een extensie nodig, zoals {stylus_link:Stylus}.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

Voor het installeren van gebruikersstijlen heb je een gebruikersstijlbeheerder nodig.

(Ik heb al een beheerder - laat me doorgaan met de installatie!)

// ==UserScript==
// @name         YouTube Annotation Ripper
// @namespace    D.D.
// @version      1.0
// @description  Appends the each annotation text to a textbox box below the video for easy copying.
// @include      *youtube.*/watch?v=*
// @copyright    2014+, RGSoftware
// @run-at       document-body
// @author       R.F Geraci
// @grant        GM_notification
// @icon64       http://icons.iconarchive.com/icons/simekonelove/modern-web/64/youtube-icon.png
// ==/UserScript==

var apParent, Anno, cDiv,i, txtbox, Interval,
    TextboxWidth, TextboxHeight, TextboxMargin,
    TextboxResize, TextboxBorder, TextboxOutline,
    InitialMsg, TextboxReadOnly, CompletedAnnotationNewClassName,
    MissingHTMLErrorMsg;

//=========================CUSTOM SETTINGS==========================================================

Interval = 1000;
TextboxWidth = "839px";
TextboxHeight = "75%";
TextboxMargin = "10px";
TextboxResize = "none";
TextboxBorder = "none";
TextboxOutline = "none";
TextboxReadOnly = "true";
InitialMsg = "̶̶̶̶̶̶̶̶̶═══════════════════════════ Any annotations from the video will show here as it plays ═══════════════════════════";
MissingHTMLErrorMsg = "A YouTube element is missing or has been renamed. 'YouTube Annotation Grabber' code must be updated.";
CompletedAnnotationNewClassName = "inner-done-text";

//===================================================================================================

function CreateElements(){
    apParent = document.getElementById('watch7-content');
    Anno = document.getElementsByClassName('inner-text');
    cDiv = document.createElement('div');
    cDiv.id = 'cDiv';
    cDiv.setAttribute('style', 'width: 100%; height: 100px; border-bottom: 1px solid #E6E6E6; border-top: 1px solid #E6E6E6;');
    apParent.insertBefore(cDiv, apParent.firstChild);
    
    txtbox = document.createElement('textarea');
    txtbox.id = 'cDivTxtBox';
    txtbox.innerHTML = InitialMsg;
    txtbox.setAttribute('readonly', TextboxReadOnly);
    txtbox.setAttribute('style', 'width: '+ TextboxWidth +';' + 'height: ' + TextboxHeight + ';' + 'margin: ' + TextboxMargin + ';'
                        + 'resize: ' +TextboxResize + ';' + 'border: ' + TextboxBorder + ';' + 'outline: ' + TextboxOutline + ';'); //height:75px
    cDiv.appendChild(txtbox);
}

function getAnno(){
    
    for (i=0; i<Anno.length; i++){
        
        if (Anno[i].innerHTML != ""){
            txtbox.value += "\n\n" + Anno[i].innerHTML; 
            Anno[i].className = CompletedAnnotationNewClassName;
        }
        
    }
}

function Tmsg(message, title){
    GM_notification(message, title);   
}

if (document.getElementById('watch7-content') == undefined){
    Tmsg(MissingHTMLErrorMsg, "YouTube Annotation Grabber Error");
}else{  
    CreateElements();
    window.setInterval(getAnno, Interval);
}