如何编辑这段代码,以便重新启用已禁用的右键单击和上下文菜单?我不了解 javascript 或任何其他后端语言。这段代码来自我大学的 javaelab 网站,他们在其中禁用了右键单击和复制粘贴。
$.ajax({
type: 'POST',
url: '../flag.checker.php',
success: function(codedata) {
if(codedata == 1) {
console.log("Diasble");
$("body").on("contextmenu",function(e){
window.alert("NOT ALLOWED");
return false;
});
$('body').bind('cut copy paste', function (e) {
e.preventDefault();
window.alert("NOT ALLOWED");
return false;
});
editor.on('paste',function(e){
e.preventDefault();
console.log('Paste is clicked');
});
editor.on('beforeChange',function(instance,changeObj) {
if(changeObj.origin == "paste") {
window.alert("NOT ALLOWED");
changeObj.cancel();
}
});
}
}
});