timesaver / EasyNav for DDF

// ==UserScript==
// @name         EasyNav for DDF
// @namespace    https://openuserjs.org/scripts/timesaver/EasyNav_for_DDF
// @version      0.4
// @description  Dansdeals Forums - visit next/previous page with keyboard shortcuts
// @author       etech0
// @match        http://forums.dansdeals.com/index.php*
// @grant        none
// @require      http://code.jquery.com/jquery-latest.js
// ==/UserScript==

(function() {
    'use strict';
    var map = [];
    var loc = '';
    onkeydown = onkeyup = function(e){
        map[e.keyCode] = e.type == 'keydown';

        if (!!$('.pagelinks')){
            if(map[17] && map[16] && map[32]){ // CMD+SHIFT+Space - Goes to previous page
                loc = $('.pagelinks > strong').prev().attr('href');
                map = [];
            }

            else if(map[17] &&  map[32]){ // CMD+Space - Goes to next page
                loc = $('.pagelinks > strong').next().attr('href');
                map = [];

            }
        }

        if (!!$('.pagesection')){
            if(map[17] && map[16] && map[32]){ // CMD+SHIFT+Space - Goes to previous page
                loc = $('.pagesection >> strong').prev().attr('href');
                map = [];
            }

            else if(map[17] &&  map[32]){ // CMD+Space - Goes to next page
                loc = $('.pagesection >> strong').next().attr('href');
                map = [];
            }
        }

        if(!!loc){
            window.location.href = loc;
        }

    };
})();