decaf / monkeytype ctrl+p

// ==UserScript==
// @name         monkeytype ctrl+p
// @namespace    http://monkeytype.com/
// @version      0.1
// @description  Binds ctrl+p to command line and ctrl+shift+p to single command mode
// @author       decaf
// @match        https://monkeytype.com/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function () {
  'use strict';

  $(document).bind('keydown', (event) => {
    if (event.ctrlKey && event.keyCode == 80) {
      event.preventDefault();
      if (!$("#leaderboardsWrapper").hasClass("hidden")) {
        event.preventDefault();
        hideLeaderboards();
        return;
      }
      else if ($("#commandLineWrapper").hasClass("hidden")) {
        if (config.singleListCommandLine == "on")
          useSingleListCommandLine(false);
        else currentCommands = [commands];

        if (event.shiftKey)
          useSingleListCommandLine(false);
        showCommandLine();
      }
      else {
        if (currentCommands.length > 1) {
          currentCommands.pop();
          $("#commandLine").removeClass("allCommands");
          showCommandLine();
        }
        else {
          hideCommandLine();
        }
        setFontFamily(config.fontFamily, true);
        if (config.customTheme === true) {
          applyCustomThemeColors();
        }
        else {
          setTheme(config.theme);
        }
      }
    }
  });
})();