How to re-enable right click

Some news site still try in 2021 to disable right click and ability to copy content. These tactis are very very poor, and only block the users not interested in copying/stealing your code.

The  idea is to put something like that on body tag:

<body oncopy="return false" oncut="return false" onpaste="return false" onbeforecopy="return false" ondragstart="return false" onselectstart="return false" oncontextmenu="return false">

The code to re-enable it is easy to find out:

var elements = document.getElementsByTagName("*");
for(var id = 0; id < elements.length; ++id) { 
 if (elements[id].oncontextmenu!=null) {
   console.log(elements[id]); 
   elements[id].oncontextmenu=null;   
 }
}