javascriptbrowsergreasemonkeyclipboardcopy-paste

Script to enable "paste" on Website


The problem concerns the particular site: tickets order on NS.nl. On that page there is text input field to enter the email, and that field has Ctrl-V (paste) disabled.

Question: What Greasemonkey script will enable paste on the field?

I have looked into various solutions, namely:

and came to the following script which (unfortunately) does not work for the given site (testing with FF v40, Greasemonkey v3.4):

// Taken from http://userscripts-mirror.org/scripts/review/40760
unsafeWindow.disable_paste = function() { return true; };

// jQuery is already available on the page:
var $j = jQuery.noConflict();

// Site generates the form on-the-fly, so we schedule the necessary modifications for later:
setTimeout(function() {
    $j(document).off('copy paste', '[data-regex=email], [data-regex=emailRepeat]');
    $j(document).off('keyup keydown keypress cut copy paste');

    // Taken from https://stackoverflow.com/questions/28266689/how-to-enable-paste-on-html-page-with-locked-cmdv
    $j('*').each(function(){                                                
        $j(this).unbind('paste');
    });
}, 2000);

Delayed execution (via setTimeout()) is used because the site builds the form dynamically. The "problematic" element is shown on the following screenshot:

Form field element that has disabled paste


Solution