-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRightClickEnable.user.js
57 lines (51 loc) · 1.39 KB
/
RightClickEnable.user.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// ==UserScript==
// @name Allow Right-Click with Tampermonkey Menu Option
// @namespace https://github.com/Nick2bad4u/UserStyles
// @version 1.6
// @description Allows right-clicking on websites that prevent it by clicking the menu button in the Tampermonkey extension.
// @author Nick2bad4u
// @match *://*/*
// @grant GM_registerMenuCommand
// @icon https://i.gyazo.com/353b60294e0dc77af7119d58ab0aa1ad.png
// @updateURL https://github.com/Nick2bad4u/UserStyles/raw/refs/heads/main/RightCLickEnable.user.js
// @downloadURL https://github.com/Nick2bad4u/UserStyles/raw/refs/heads/main/RightCLickEnable.user.js
// @license UnLicense
// @tag all
// ==/UserScript==
(function () {
'use strict';
// Function to enable right-click
function enableRightClick() {
document.addEventListener(
'contextmenu',
function (event) {
event.stopPropagation();
},
true,
);
document.addEventListener(
'mousedown',
function (event) {
if (event.button === 2) {
event.stopPropagation();
}
},
true,
);
document.addEventListener(
'mouseup',
function (event) {
if (event.button === 2) {
event.stopPropagation();
}
},
true,
);
alert('Right-click has been enabled!');
}
// Register the option in the Tampermonkey menu
GM_registerMenuCommand(
'Enable Right-Click',
enableRightClick,
);
})();