Prevent Right-Click Context Menu Hijaak

Prevent websites from entirely disable web browser's Right-Click context menu by allowing use of SHIFT+RightClick, CTRL+RightClick, or CTRL+SHIFT+RightClick (configurable in the script code). This script is designed for Chrome and Chromium based web browsers. Firefox already has this feature built in via SHIFT+RightClick.

Verze ze dne 16. 07. 2019. Zobrazit nejnovější verzi.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         Prevent Right-Click Context Menu Hijaak
// @namespace    https://greasyfork.org/en/users/85671-jcunews
// @version      1.0.1
// @license      AGPLv3
// @author       jcunews
// @description  Prevent websites from entirely disable web browser's Right-Click context menu by allowing use of SHIFT+RightClick, CTRL+RightClick, or CTRL+SHIFT+RightClick (configurable in the script code). This script is designed for Chrome and Chromium based web browsers. Firefox already has this feature built in via SHIFT+RightClick.
// @match        *://*/*
// @grant        none
// @run-at       document-start
// ==/UserScript==

(() => {
  //=== CONFIGURATION BEGIN ===

  //At least either SHIFT or CTRL should be set to true. 
  let useShift = true;
  let useCtrl  = false;

  //=== CONFIGURATION END ===

  let epd = Event.prototype.preventDefault;
  Event.prototype.preventDefault = function() {
    if ((this.type !== "contextmenu") || ((useShift && this.shiftKey) && (useCtrl && this.ctrlKey)) || (useShift && this.shiftKey) || (useCtrl && this.ctrlKey)) return;
    return epd.apply(this, arguments);
  };
})();