-
Notifications
You must be signed in to change notification settings - Fork 0
/
right_click_fixes.1.0.js
53 lines (49 loc) · 1.63 KB
/
right_click_fixes.1.0.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
// ==UserScript==
// @name Right click fixes - regain context menu
// @include *://*alamy.com/*
// @include *://www.twitter.com/*
// @description Right click fixes
// @version 1.0
// @run-at document-idle
// @grant unsafeWindow
// ==/UserScript==
function enable_right_click() {
window.oncontextmenu = null;
var elements = document.getElementsByTagName("*");
for(var id = 0; id < elements.length; ++id) {
elements[id].oncontextmenu = null;
}
}
function tidy() {
enable_right_click();
}
tidy();
setTimeout(tidy, 3000);
(function () {
let events = [
"scroll", "click", "uiHasInjectedNewTimeline", "uiHasInjectedOldTimelineItems",
"uiHasInjectedRangeTimelineItems", "uiHasInjectedNewTimelineItems", "uiOverlayPageChanged",
"uiPermalinkThreadExpanded", "uiExpandedConversationRendered", "uiTweetInserted", "uiPageChanged",
"uiShowRelatedVideoTweets", "uiLoadDynamicContent", "uiDMConversationUpdated"
];
for(var i=0; i < events.length; i++) {
window.addEventListener(events[i], () => {
tidy();
setTimeout(tidy, 3000);
});
}
javascript:(function(w){
var arr = ['contextmenu','copy','cut','paste','mousedown','mouseup','beforeunload','beforeprint'];
for(var i = 0, x; x = arr[i]; i++){
if(w['on' + x]) w['on' + x] = null;
w.addEventListener(x, function(e){
e.stopPropagation()}, true);
};
for(var j = 0, f; f = w.frames[j]; j++){
try{
arguments.callee(f)
} catch(e){}
}
}
)(window);
})();