MediaWiki:Common.js

/* Any JavaScript here will be loaded for all users on every page load. */ (function($, mw) {   'use strict';

if (window.location.pathname.indexOf("Read") > -1) { $('html').on('keydown', function (e) {           var url = window.location.pathname;            var urlBlank = window.location.href.substring(0, window.location.href.lastIndexOf('/'));            url = url.split("/");            if(url[url.length-1] == "Read") {                if(e.keyCode == 39) {                    window.location.replace(window.location.href + "/2");                }            } else if(url[url.length-2] == "Read") {                var num = parseInt(url[url.length-1], 10)                if(e.keyCode == 39) {                    window.location.replace(urlBlank + "/" + (num+1));                } else if(e.keyCode == 37) {                    if(num == 2) {                        window.location.replace(urlBlank);                    } else {                        window.location.replace(urlBlank + "/" + (num-1));                    }                }            } }); } })(jQuery, mediaWiki);