addEventListener-defuser conversion

Discussion in 'Custom Filters' started by patrickdrd, Dec 20, 2018.

  1. patrickdrd

    patrickdrd Member

    Joined:
    Oct 15, 2017
    Messages:
    50
    is there any way this is converted to work with AG?

    Code:
    kingbet.net##+js(addEventListener-defuser.js, /cut|copy|paste/)
     
  2. Alex302

    Alex302 Filters Developer Staff Member Administrator

    Joined:
    Jul 20, 2012
    Messages:
    24,402
    No. This is uBO's syntax. We have our own.
     
  3. patrickdrd

    patrickdrd Member

    Joined:
    Oct 15, 2017
    Messages:
    50
    I know, that's why I asked for conversion, can somebody convert this for me?
    I'm enabling copy, which is by default disabled
     
  4. Alex302

    Alex302 Filters Developer Staff Member Administrator

    Joined:
    Jul 20, 2012
    Messages:
    24,402
    What the purpose of your rule?
     
  5. patrickdrd

    patrickdrd Member

    Joined:
    Oct 15, 2017
    Messages:
    50
    to enable copy text which is otherwise disabled
     
  6. avatar

    avatar Administrator Staff Member Administrator

    Joined:
    Oct 26, 2010
    Messages:
    13,138
    We're going to start automatically converting some of the uBO scriptlets to our syntax in the future updates.
    Making an alternative for every scriptlet manually is just too hard.

    I'll make an exception for this particular rule, though:)

    Code:
    kingbet.net#%#(function(){z=self.EventTarget.prototype.addEventListener;self.EventTarget.prototype.addEventListener=function(a,b){if(!/cut|copy|paste/.test(a.toString()))return z.apply(this,arguments)}})();
    
    Please note that this sort of rules works only from if they're added to the user filter.
     
    patrickdrd likes this.
  7. patrickdrd

    patrickdrd Member

    Joined:
    Oct 15, 2017
    Messages:
    50
    it works great, thanks!

    I thought there was an easy way to convert them and
    in order to try the conversion myself,
    but I see it's not easy