jswanner / DontF-WithPaste

Google Chrome extension that prevents the blocking of pasting into input fields
https://chrome.google.com/webstore/detail/dont-fuck-with-paste/nkgllhigpcljnhoakjkgaieabnkmgdkb
MIT License
812 stars 64 forks source link

[Website Request] IOB #108

Closed the-solipsist closed 11 months ago

the-solipsist commented 3 years ago

This website doesn't allow pasting, even with DFWP enabled on the website (the DFWP toolbar icon glows blue): https://www.iobnet.co.in/ibanking/login.do

It seems to use this code, if I'm reading it correctly:

<body onload="blockHistory();" oncopy="return false" onpaste="return false" oncut="return false">
jswanner commented 3 years ago

@the-solipsist, sorry to hear you are having trouble with the extension.

On the login page you linked to, I'm able to paste into the fields after I enable the extension. I'm able to do so with the macOS keyboard shortcut of command+v and with the Edit > Paste menu option. I cannot paste from the context menu (right click) as that site disables that feature. Unfortunately, that site is also listening for a number of control+ keyboard shortcuts and preventing their use.

This extension intentionally does not try to prevent keyboard shortcut blocking, as I'm worried about the negative side effects of doing that. On this site you should be able to paste when this extension is active using the Edit menu, I know that's less ideal than using the keyboard shortcut.

document.onkeydown = function() {
    if (window.event && event.keyCode == 116) { // Capture and remap F5
        event.keyCode = 505;
        return false;
    }
    if (window.event && event.keyCode == 505) { // New action for F5
        return false;
    // Must return false or the browser will refresh anyway
    }
    /*if (window.event && event.keyCode == 78) {
        return false;
    }*/
    var disabled = {
        a : 0,
        c : 0,
        x : 0,
        v : 0,
        r : 0,
        n : 0
    };
    var ctrlMod = (window.event) ? event.ctrlKey : evt.ctrlKey;
    var key = (window.event) ? event.keyCode : evt.which;
    key = String.fromCharCode(key).toLowerCase();
    return (ctrlMod && (key in disabled)) ? false : true;
}