<commit_before>/* theme selector
*/

(function() {
  'use strict';

  var themeActive = '';
  var $container = document.querySelector('.themes-box');

  function hashChange () {
    themeActive = window.util.hash('theme');

    // if no theme in the url
    if (!themeActive) {
      // select the first in the list
      $container.querySelector('.theme-item').click();

      return;
    }

    // uncheck previous active theme
    var $themeActive = $container.querySelector('.active');
    if ($themeActive) {
      window.util.removeClass($themeActive, 'active');
    }

    $themeActive = $container.querySelector('.js-' + themeActive);
    window.util.addClass($themeActive, 'active');
  }

  hashChange();
  window.addEventListener('hashchange', hashChange, false);
})();<commit_msg>Check if the dom node for the theme about to be activated exists. To minimize js errors.<commit_after>/* theme selector
*/

(function() {
  'use strict';

  var themeActive = '';
  var $themeActive;
  var $container = document.querySelector('.themes-box');

  function hashChange () {
    themeActive = window.util.hash('theme');

    // if no theme in the url
    if (!themeActive) {
      // select the first in the list
      $container.querySelector('.theme-item').click();

      return;
    }

    // uncheck previous active theme
    $themeActive = $container.querySelector('.active');
    if ($themeActive) {
      window.util.removeClass($themeActive, 'active');
    }

    $themeActive = $container.querySelector('.js-' + themeActive);
    if ($themeActive) {
      window.util.addClass($themeActive, 'active');
    }
  }

  hashChange();
  window.addEventListener('hashchange', hashChange, false);
})();
{'fraction_non_alphanumeric': 0.15190615835777127, 'fraction_numerical': 0.0, 'mean_word_length': 3.243781094527363, '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': '619641', 'n_tokens_mistral': 483, 'n_tokens_neox': 474, 'n_words': 121}