PCHOME_intercept_EVENT

intercept mouse down event

  1. // ==UserScript==
  2. // @name PCHOME_intercept_EVENT
  3. // @namespace http://tampermonkey.net/
  4. // @version 2024-12-07
  5. // @description intercept mouse down event
  6. // @author Mesak
  7. // @match https://24h.pchome.com.tw/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=pchome.com.tw
  9. // @license MIT
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. const originalAddEventListener = EventTarget.prototype.addEventListener;
  15. EventTarget.prototype.addEventListener = function(type, listener, options) {
  16. if (type === 'mousedown') {
  17. console.log('Mousedown event intercepted');
  18. // 儲存事件處理器
  19. // 這裡可以進行其他處理
  20. }else{
  21. originalAddEventListener.call(this, type, listener, options);
  22. }
  23.  
  24. };
  25. })();