CRG copiar elinks OLD

Anade un boton javascript para copiar los elinks seleccionados

// ==UserScript==
// @name     CRG copiar elinks OLD
// @version  1.0
// @description  Anade un boton javascript para copiar los elinks seleccionados
// @author       Intruso
// @match        http://lamansion-crg.net/forum/index.php?autocom=elinks&p=*
// @require      http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js
// @grant    none
// @namespace https://greasyfork.org/users/407027
// ==/UserScript==

var htmlBoton = "<input type='button' id='botonJS' name='copiarSel' value='Copiar al portapapeles'>";
$("#f1").append(htmlBoton);
$("#botonJS").bind('click',copiarSeleccionados);

function copiarSeleccionados(){
  	var chk = document.f1.checks;
    var textoACopiar='';
    for (i = 0; i < chk.length; i++)
        if (chk[i].checked)
            textoACopiar += chk[i].value+'\n';
  
    copiarAlPortapapeles(textoACopiar);
    var audio = new Audio('indexado/ding.mp3');
    audio.play();
}

function copiarAlPortapapeles(text) {
                var id = "mycustom-clipboard-textarea-hidden-id";
                var existsTextarea = document.getElementById(id);

                if (!existsTextarea) {
                    console.log("Creating textarea");
                    var textarea = document.createElement("textarea");
                    textarea.id = id;
                    // Place in top-left corner of screen regardless of scroll position.
                    textarea.style.position = 'fixed';
                    textarea.style.top = 0;
                    textarea.style.left = 0;

                    // Ensure it has a small width and height. Setting to 1px / 1em
                    // doesn't work as this gives a negative w/h on some browsers.
                    textarea.style.width = '1px';
                    textarea.style.height = '1px';

                    // We don't need padding, reducing the size if it does flash render.
                    textarea.style.padding = 0;

                    // Clean up any borders.
                    textarea.style.border = 'none';
                    textarea.style.outline = 'none';
                    textarea.style.boxShadow = 'none';

                    // Avoid flash of white box if rendered for any reason.
                    textarea.style.background = 'transparent';
                    document.querySelector("body").appendChild(textarea);
                    console.log("The textarea now exists :)");
                    existsTextarea = document.getElementById(id);
                } else {
                    console.log("The textarea already exists :3")
                }

                existsTextarea.value = text;
                existsTextarea.select();

                try {
                    var status = document.execCommand('copy');
                    if (!status) {
                        console.error("Cannot copy text");
                    } else {
                        console.log("The text is now on the clipboard");
                    }
                } catch (err) {
                    console.log('Unable to copy.');
                }
}