Assume I'm a junior Wikipedia user that just want to experiment with changing some wikipedian content with the Wiki text editor in an edit-page, but not saving my changes in any way (not even by mistake), thus seeking a way to prevent any saving functionality in an edit-page, via vanilla JavaScript.
If I go for some edit-page in Hebrew Wikipedia I can save or publish a page by mouse-clinking the Save page button (illustration), which I can remove from DOM with:
document.querySelector("#wpSave").remove();
But let's assume I can still save or publish content by alt+shift+s and I'd like to prevent this possible saving behavior as well; I tried the following code for that:
// ==UserScript==
// @name wiki
// @match https://*.wikipedia.org/*
// ==/UserScript==
document.addEventListener("DOMContentLoaded", ()=>{
document.addEventListener('keypress', function(e) {
if (e.key == 16 && e.key == 18 && e.key == 83) {
return false;
}
});
});
The code failed (no special error is given in console). Why it failed?