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
    }
  });
  if ($('a[rel="prev"]').length > 0 || $('a[rel="next"]').length > 0) {
    // check cookie
    var visited = $.cookie("display-navigation")
    if (visited == null) {
	  $('#footer').append('<div id="navigationHelp" class="modal" tabindex="-1" role="dialog"><div class="modal-dialog" role="document"><div class="modal-content"><div class="modal-body"><p>You can navigate between dates by hitting left and right arrows.</p></div><div class="modal-footer"><button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button></div></div></div></div>');
      $('#navigationHelp').modal('show');
    }
    var date = new Date();
    date.setTime(date.getTime() + (30 * 24 * 60 * 60 * 1000));
    // set cookie
    $.cookie('display-navigation', 'yes', { expires: date, path: '/' });
  }
});