Last active
November 7, 2024 15:44
-
-
Save klondikemarlen/928a44be8e383d24035dc7ff4ca03b8f to your computer and use it in GitHub Desktop.
Removes paste restrictions on TD's authentication page input fields only for paste actions.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name TD Paste Block Remover | |
// @namespace http://tampermonkey.net/ | |
// @version 2024-11-07 | |
// @description Removes paste restrictions on TD's authentication page input fields only for paste actions. | |
// @author Marlen | |
// @match https://authentication.td.com/uap-ui/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=td.com | |
// @grant none | |
// @run-at document-body | |
// @updateURL https://gist.githubusercontent.com/klondikemarlen/928a44be8e383d24035dc7ff4ca03b8f/raw/23957a44af431c6f14eaca47bbd57f7735fd0085/td-paste-block-remover.js | |
// @downloadURL https://gist.githubusercontent.com/klondikemarlen/928a44be8e383d24035dc7ff4ca03b8f/raw/23957a44af431c6f14eaca47bbd57f7735fd0085/td-paste-block-remover.js | |
// ==/UserScript== | |
(function () { | |
"use strict"; | |
function removePasteBlock() { | |
document.querySelectorAll("input").forEach((input) => { | |
input.removeAttribute("onpaste"); | |
input.addEventListener("paste", (e) => e.stopPropagation(), true); | |
}); | |
} | |
removePasteBlock(); | |
const observer = new MutationObserver(function (mutations) { | |
mutations.forEach(function (mutation) { | |
if (mutation.addedNodes && mutation.addedNodes.length > 0) { | |
removePasteBlock(); | |
} | |
}); | |
}); | |
observer.observe(document.body, { | |
childList: true, | |
subtree: true, | |
attributes: true, | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment