Disable 'disable right click'

Disables the ugly feature that disables right click

目前為 2019-09-06 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name Disable 'disable right click'
  3. // @namespace https://github.com/mosaicer
  4. // @author mosaicer
  5. // @description Disables the ugly feature that disables right click
  6. // @version 1.4.1
  7. // @include *
  8. // @run-at document-idle
  9. // @grant GM_addStyle
  10. // ==/UserScript==
  11. (() => {
  12. 'use strict';
  13. document.querySelectorAll('[oncontextmenu]').forEach(
  14. e => e.removeAttribute('oncontextmenu')
  15. );
  16. document.querySelectorAll('[onselectstart="return false;"]').forEach(
  17. e => e.removeAttribute('onselectstart')
  18. );
  19. document.querySelectorAll('[onmousedown="return false;"]').forEach(
  20. e => e.removeAttribute('onselectstart')
  21. );
  22. document.querySelectorAll('[oncopy]').forEach(
  23. e => e.removeAttribute('oncopy')
  24. );
  25. document.querySelectorAll('[unselectable]').forEach(
  26. e => e.removeAttribute('unselectable')
  27. );
  28.  
  29. if (document.onmousedown === 'rightclick') {
  30. document.onmousedown = '';
  31. }
  32. if (document.oncontextmenu) {
  33. document.oncontextmenu = '';
  34. }
  35. GM_addStyle(`* {
  36. user-select: text !important;
  37. -moz-user-select: text !important;
  38. -webkit-user-select: text !important;
  39. -webkit-user-drag: text !important;
  40. -khtml-user-select: text !important;
  41. -khtml-user-drag: text !important;
  42. pointer-events: auto !important;
  43. }`);
  44. })();