Skip to content

Instantly share code, notes, and snippets.

@mauricioschneider
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mauricioschneider/9906064 to your computer and use it in GitHub Desktop.
Save mauricioschneider/9906064 to your computer and use it in GitHub Desktop.
Habilitar paste en formulario transferencia.
// llamar el frame que contiene el formulario. Porque aún estamos en 1995, los desarrolladores del sitio aún usan frames.
var frame = document.getElementsByTagName("frame")[2]; var frame_doc = frame.contentWindow.document || frame.contentDocument;
// obtener todos los elementos del DOM que corresponden a inputs
var elements = frame_doc.getElementsByTagName("input");
// generar un arreglo con los input, para poder iterarlo usando forEach, porque NodeList no implementa ese método
var nodes = Array.prototype.slice.call(elements,0);
// iterar cada nodo cambiando su atributo onpaste por un lindo string vacio
nodes.forEach(function(node){
node.setAttribute("onpaste", "");
});
// ahora es posible pegar lo que a uno se le antoje en el formulario de la ctm.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment