N
nicorto
Lambda
genial :encouragement::drunk: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+"' 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>
Aquí con el anchor y el title dinámico de acuerdo al título de la página 🙂
Gracias y saludos
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
¿Qué es lo que básicamente hace este código html?
Tienes un espacio en locat ion.href
Ponlo así:
Insertar CODE, HTML o PHP: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
- - - Actualizado - - -
Cuando copias y pegas el texto inserta un link a tu web.
En Blogger cambia porque las variables se llaman de distinta manera que en Wordpress. En un dato me siento en la compu y lo pongo adaptado Blogger.
Si les intereso pueden visitar tynt.com (creo que era asi). Brinda un script asi y tracking de las copias.
<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>
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?