<commit_before>var isRunning = "no"
var spacePressed = "no"

function initInput() {
  // Prevent SPACE from scrolling down the browser window
  document.documentElement.addEventListener('keydown', function (e) {
    if ( ( e.keycode || e.which ) == 32) {
        e.preventDefault();
    }
  }, false);

  document.body.addEventListener("keyup", spaceUp);
  document.body.addEventListener("keydown", spaceDown);

  function start() {
    chronoReset();
    chronoStart();
    isRunning = "yes";
    hideAll()
  }

  function stop() {
    chronoStop();
    isRunning = "no";
    saveTime();
    updateTimes();
    scrollDown();
    displayScramble();
    showAll()
  }

  function spaceUp() { // Starting at SPACE released
    if (event.which == 32) {
      if (isRunning == "no" && spacePressed == "no") {
        start();
      }
      spacePressed="no"
    }
  }

  function spaceDown() { // Stoping at SPACE pressed
    if (event.which == 32) {
      if (isRunning == "yes") {
        spacePressed = "yes"
        stop();
      }
    }
  }
}<commit_msg>colored time when holding space bar<commit_after>var isRunning = "no"
var spacePressed = "no"

function initInput() {
  // Prevent SPACE from scrolling down the browser window
  document.documentElement.addEventListener('keydown', function (e) {
    if ( ( e.keycode || e.which ) == 32) {
        e.preventDefault();
    }
  }, false);

  document.body.addEventListener("keyup", spaceUp);
  document.body.addEventListener("keydown", spaceDown);

  function start() {
    chronoReset();
    chronoStart();
    isRunning = "yes";
    hideAll()
  }

  function stop() {
    chronoStop();
    isRunning = "no";
    saveTime();
    updateTimes();
    scrollDown();
    displayScramble();
    showAll()
  }

  function spaceUp() { // Starting at SPACE released
    if (event.which == 32) {
      if (isRunning == "no" && spacePressed == "no") {
        document.getElementById('chronotime').style.color = "white"
        start();
      }
      spacePressed="no"
    }
  }

  function spaceDown() { // Stoping at SPACE pressed
    if (event.which == 32) {
      if (isRunning == "yes") {
        spacePressed = "yes"
        stop();
      } else {
        document.getElementById('chronotime').style.color = "#92FE9D"
      }
    }
  }
}
{'fraction_non_alphanumeric': 0.15098468271334792, 'fraction_numerical': 0.006564551422319475, 'mean_word_length': 2.6, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3454704', 'n_tokens_mistral': 731, 'n_tokens_neox': 702, 'n_words': 164}