Aquí les dejo la versión actualizada del script que agrega un enlace cuando te copian, lo modifiqué para generar anclas de manera aleatoria (AMIGABLE A PENGUIN) y le arreglé un GRAVÍSIMO problema con un div.
Funciona en explorer, chrome, firefox y safari. No funciona en Opera.
* ARREGLADO PARA BLOGGER
Agregar el oncopy en la etiqueta body:
Peguen este script antes de la etiqueta </html>
Cambiar mi.DOMINIO.com y DOMINIO.com
Dejen sus comentarios.
Funciona en explorer, chrome, firefox y safari. No funciona en Opera.
* ARREGLADO PARA BLOGGER
Agregar el oncopy en la etiqueta body:
Insertar CODE, HTML o PHP:
<body oncopy="return addLink()">
Peguen este script antes de la etiqueta </html>
Cambiar mi.DOMINIO.com y DOMINIO.com
Insertar CODE, HTML o PHP:
<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+"'>"+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);
}
</script>
Dejen sus comentarios.
Última edición: