Greasy Fork is available in English.
强制开启右键菜单
// ==UserScript==
// @name 恢复图片右键菜单
// @namespace http://leizingyiu.net/
// @version 20260402
// @description 强制开启右键菜单
// @author leizingyiu
// @license GNU AGPLv3
// @match *://*/*
// @grant none
// @run-at document-start
// ==/UserScript==
(function() {
'use strict';
const originalAddEventListener = EventTarget.prototype.addEventListener;
EventTarget.prototype.addEventListener = function(type, listener, options) {
if (type === 'contextmenu') {
return;
}
originalAddEventListener.call(this, type, listener, options);
};
window.addEventListener('contextmenu', function(e) {
e.stopPropagation();
}, true);
const restoreEvents = () => {
document.oncontextmenu = null;
document.onselectstart = null;
document.onmousedown = null;
document.querySelectorAll('img').forEach(img => {
img.oncontextmenu = null;
img.style.pointerEvents = 'auto';
});
};
window.addEventListener('load', restoreEvents);
setInterval(restoreEvents, 2000);
})();