User:Elominius/gadget/diff arrow keys without CTRL.js

Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
// diff arrow keys: navigate revisions conveniently with ← and →.

var prev_diff_link=document.getElementById("differences-prevlink");
var next_diff_link=document.getElementById("differences-nextlink");

window.addEventListener("keydown", function(key_bind) {
  key_bind = key_bind || window.event;
  if (key_bind.type=="keydown" && key_bind.which == 37 ) { if (prev_diff_link) { document.location.href=prev_diff_link.href; return false; } }
  if (key_bind.type=="keydown" && key_bind.which == 39 ) { if (next_diff_link) { document.location.href=next_diff_link.href; return false; } }
  return true;
	}
);