MediaWiki:Common.js
From Fischer Diaries
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Internet Explorer / Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5
- Opera: Press Ctrl-F5.
/* Any JavaScript here will be loaded for all users on every page load. */ $(document).ready(function() { $(document).keydown(function(e) { switch(e.which) { case 37: // left if ($('a[rel="prev"]').length > 0) { $('a[rel="prev"]')[0].click(); e.preventDefault(); // prevent the default action (scroll / move caret) } break; case 39: // right if ($('a[rel="next"]').length > 0) { $('a[rel="next"]')[0].click(); e.preventDefault(); // prevent the default action (scroll / move caret) } break; default: return; // exit this handler for other keys } }); });