Opium Pulses middle click fix

Allows you to enter giveaways with middle click (new tab)

  1. // ==UserScript==
  2. // @name Opium Pulses middle click fix
  3. // @namespace vkjpy4t5b830p2
  4. // @version 0.1
  5. // @description Allows you to enter giveaways with middle click (new tab)
  6. // @match https://www.opiumpulses.com/giveaways
  7. // @match https://www.opiumpulses.com/giveaways?*
  8. // @grant none
  9. // @run-at document-start
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. "use strict";
  15.  
  16. document.addEventListener("auxclick", function (event) {
  17. // Dispatch a neutral "click" event to fix the broken site.
  18. // Since this is not a MouseEvent, it will not actually
  19. // activate the link, but will trigger the onclick handler.
  20. event.target.closest?.("a")?.dispatchEvent(
  21. new CustomEvent("click", { bubbles: true, cancelable: true, composed: true })
  22. );
  23. });
  24. })();