您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Anade un boton javascript para copiar TODOS los elinks
当前为
// ==UserScript== // @name Copiar TODOS los elinks en CRG // @version 2.6 // @description Anade un boton javascript para copiar TODOS los elinks // @author Intruso // @match http://lamansion-crg.net/forum/* // @require http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js // @namespace https://greasyfork.org/users/407027 // @grant none // ==/UserScript== var htmlBoton = "<button type='button' id='botonJS' style='position: fixed;top:0;left:0;' title='Copia todos los elinks de la pagina actual'><img src='http://lamansion-crg.net/forum/style_images/nuevo/p_elinks.gif' style='width:25px;'/></button>"; var patronEd2k = /^^ed2k:\/\/(?!\|serverlist\|)/i ; //el grupo (?!\|serverlist\|) impide que los enlaces ed2k diseñados para añadir servidores a la lista de servidores sean capturados por el script var textoACopiar = ''; $('a').each(function (index, value) { var href = $(this).attr('href'); if (patronEd2k.test(href)) textoACopiar += href.replace(/\s/g,'%20') + '\n'; }); if(textoACopiar){ $(document.body).append(htmlBoton); $("#botonJS").bind('click',function(){ copiarAlPortapapeles(textoACopiar); var audio = new Audio('http://lamansion-crg.net/forum/indexado/ding.mp3'); audio.play(); this.style.display = "none"; } ); } 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.'); } }