N
nicorto
Lambda
<script type="text/javascript">
//Cambiar mi.DOMINIO.com
var Ancla = ["mi.DOMINIO.com", "DOMINIO.com", document.location.href, document.title];
var Texto = ["Fuente:", "Leer completo:"];
var AnclaRandom = Ancla[Math.floor(Math.random() * Ancla.length)];
var TextoRandom = Texto[Math.floor(Math.random() * Texto.length)];
function addLink() {
var body_element = document.getElementsByTagName('body')[0];
var selection;
selection = window.getSelection();
var pagelink = "<br /><br />"+TextoRandom+" <a href='"+document.location.href+"' href='"+document.title+"'>"+AnclaRandom+"</a>";
var copytext = selection + pagelink;
var newdiv = document.createElement('p');
body_element.appendChild(newdiv);
newdiv.innerHTML = copytext;
selection.selectAllChildren(newdiv);
window.setTimeout(function() {
body_element.removeChild(newdiv);
},0);
}
document.oncopy = addLink;
</script>
es valido para todo. WP, blogger, sitios normal. Yo lo uso, si lo editas podes hacer que no le regrese el texto copiado 😉
valido para Blogger?
<script type="text/javascript">function addLink() {
var body_element = document.getElementsByTagName('body')[0];
var selection;
selection = window.getSelection();
var pagelink = "<br /><br /> Artículo sustraído de: <a href='"+document.location.href+"' Title="ANCHOR TEXT">ANCHOR TEXT</a>"; // Mensaje que aparecerá al copiar
var copytext = selection + pagelink;
var newdiv = document.createElement('div');
newdiv.style.position='absolute';
newdiv.style.left='-99999px';
body_element.appendChild(newdiv);
newdiv.innerHTML = copytext;
selection.selectAllChildren(newdiv);
window.setTimeout(function() {
body_element.removeChild(newdiv);
},0);
}
document.oncopy = addLink;
</script>
El código está en Javascript. Por lo que funciona independientemente de la plataforma o lenguaje del sitio.
El código lo pueden poner donde quieran. En general estas cosas se ponen en el head o en el footer. Les recomiendo por una cuestión de carga, ponerlo en el footer.
Un anchor text es la palabra que se "linkea" (o frase).
Si quieren usar un anchor text (aunque estático, osea, independientemente del artículo, siempre será el mismo
Insertar CODE, HTML o PHP:<script type="text/javascript">function addLink() { var body_element = document.getElementsByTagName('body')[0]; var selection; selection = window.getSelection(); var pagelink = "<br /><br /> Artículo sustraído de: <a href='"+document.location.href+"' Title="ANCHOR TEXT">ANCHOR TEXT</a>"; // Mensaje que aparecerá al copiar var copytext = selection + pagelink; var newdiv = document.createElement('div'); newdiv.style.position='absolute'; newdiv.style.left='-99999px'; body_element.appendChild(newdiv); newdiv.innerHTML = copytext; selection.selectAllChildren(newdiv); window.setTimeout(function() { body_element.removeChild(newdiv); },0); } document.oncopy = addLink; </script>
Saludos!
genial gracias, hay alguna posibilidad que pase la validación? :encouragement:
<script type="text/javascript">
function addLink() {
var body_element = document.getElementsByTagName('body')[0];
var selection;
selection = window.getSelection();
var pagelink = "<br /><br /> Artículo sustraído de: <a href='"+document.location.href+"' href='"+document.title+"'>"+document.title+"</a>"; // Mensaje que aparecerá al copiar
var copytext = selection + pagelink;
var newdiv = document.createElement('div');
newdiv.style.position='absolute';
newdiv.style.left='-99999px';
body_element.appendChild(newdiv);
newdiv.innerHTML = copytext;
selection.selectAllChildren(newdiv);
window.setTimeout(function() {
body_element.removeChild(newdiv);
},0);
}
document.oncopy = addLink;
</script>
Utilizamos cookies y tecnologías similares para los siguientes fines:
¿Aceptas las cookies y estas tecnologías?
Utilizamos cookies y tecnologías similares para los siguientes fines:
¿Aceptas las cookies y estas tecnologías?