Skip to content

Instantly share code, notes, and snippets.

@rummik
Created June 27, 2015 03:56
Show Gist options
  • Save rummik/fe33303af585ce3be0fb to your computer and use it in GitHub Desktop.
Save rummik/fe33303af585ce3be0fb to your computer and use it in GitHub Desktop.
Fix stupid `onpaste="false"` password fields. >.>
// ==UserScript==
// @name Allow password paste
// @namespace http://www.rummik.com/
// @version 0.1
// @description Removes paste event from elements with `onpaste` set
// @author rummik
// @match http://*/*
// @match https://*/*
// @grant none
// ==/UserScript==
[].slice.apply(document.querySelectorAll('input[type=password]'))
.forEach(function(ele) {
if (typeof ele.onpaste == 'function' && /return false/.test(ele.onpaste.toString())) {
ele.onpaste = new Function();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment