Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

window.addEventListener('click', event doesn't work on tampermonkey chrome?

I can't understand why this code doesn't work in chrome with tampermonkey:

    window.addEventListener('click', event => {
  const el = event.target.closest('[href*="forums/topic"]');
  const el2 = event.target.closest('[href*="?do=getNewComment"]');
  const href = el && el.getAttribute('href');
      if (el && (!el2)) {
    el.setAttribute('href', decodeURIComponent(href + '?do=getNewComment'));
  }
}, true);

it works fine on firefox and greasemonkey

Comments