Disable 'disable right click'

Disables the ugly feature that disables right click

目前為 2015-12-19 提交的版本,檢視 最新版本

// ==UserScript==
// @name         Disable 'disable right click'
// @namespace    https://github.com/mosaicer
// @author       mosaicer
// @description  Disables the ugly feature that disables right click
// @version      1.0
// @run-at       document-end
// @grant        GM_addStyle
// ==/UserScript==
(function () {
  'use strict';

  [].forEach.call(document.querySelectorAll('[oncontextmenu]'),
    function (targetNode) {
      targetNode.removeAttribute('oncontextmenu');
    }
  );

  [].forEach.call(document.querySelectorAll('[onselectstart="return false;"]'),
    function (targetNode) {
      targetNode.removeAttribute('onselectstart');
    }
  );

  [].forEach.call(document.querySelectorAll('[onmousedown="return false;"]'),
    function (targetNode) {
      targetNode.removeAttribute('onselectstart');
    }
  );

  if (document.onmousedown === 'rightclick') {
    document.onmousedown = '';
  }

  if (!!document.oncontextmenu) {
    document.oncontextmenu='';
  }

  GM_addStyle('body {user-select: all; -moz-user-select: all; -webkit-user-select: all; -webkit-user-drag: all; -khtml-user-select: all; -khtml-user-drag: all; pointer-events: auto;}');
})();