<commit_before>'use strict';
/* eslint no-inline-comments: 0 */
/* eslint no-unused-vars: 0 */
/* eslint no-undef: 0 */
/* eslint no-console: 0 */

$(document).ready(() => {
  $('.options').mouseenter((event) => { // Adds a border around the key to show which is being edited
    const key = getGuiKey(lastKey);
    $(key).addClass('editing'); // Show the last key
    $(`.center.c${lastKey.join('-')}`).addClass('editing'); // how center key border if center key
    $(event.currentTarget).mouseleave(() => {
      $(key).removeClass('editing'); // Don't show the last key
      $('.center').removeClass('editing'); // Remove border from all center keys
    });
  });

  $('.expandable').click((event) => { // Click to expand/hide option groups
    if (e.target.className === 'clear_opt') return; // Don't expand if the 'Clear' button is what was clicked
    const content = $(event.currentTarget).next(); // Target the content div
    if (content.hasClass('expanded')) {
      content.removeClass('expanded').slideUp(500); // Hide if this was already expanded
    } else {
      $('.expanded').removeClass('expanded').slideUp(500); // Hide all expanded divs
      content.addClass('expanded').slideDown(500); // Expand the div we want
    }
  });

  $('.color_select div').click((event) => {
    const parent = $(event.currentTarget).parent(); // Target the wrapper div for all the colors
    let color = $(event.currentTarget).data('color'); // Get the color we clicked on
    // Determine which action group we are dealing with
    const parentClass = parent.hasClass('active') ? 'active' : 'inactive';
    parent.children().removeClass('selected'); // Remove the selected class from everything
    parent.data('color', color); // Set out parent class' data-color to the color we clicked on
    $(event.currentTarget).addClass('selected'); // Add the selected class to the color we clicked on
    if (color === 'OFF') { // Handle the 'X' image in the OFF color div
      $(`.color_select.${parentClass} div img`).addClass('selected');
    } else {
      $(`.color_select.${parentClass} div img`).removeClass('selected');
    }
    color = color.split('_'); // Format the color name to be gui friendly
    for (let i = 0; i < color.length; i++) {
      color[i] = toTitleCase(color[i]);
    }
    $(`.color_select.${parentClass} span`).text(color.join(' ')); // Set the color name to our new gui friendly name
    const keyConfig = getKeyConfig(); // Get the key config or defaults
    const action = parentClass === 'active' ? 'press' : 'release'; // Set action
    keyConfig.color[action] = $(`#${parentClass}_key_color`).data('color'); // Update the changed color
    config.keys[lastKey.join(',')] = keyConfig; // Save to config<commit_msg>Fix reference error<commit_after>'use strict';
/* eslint no-inline-comments: 0 */
/* eslint no-unused-vars: 0 */
/* eslint no-undef: 0 */
/* eslint no-console: 0 */

$(document).ready(() => {
  $('.options').mouseenter((event) => { // Adds a border around the key to show which is being edited
    const key = getGuiKey(lastKey);
    $(key).addClass('editing'); // Show the last key
    $(`.center.c${lastKey.join('-')}`).addClass('editing'); // how center key border if center key
    $(event.currentTarget).mouseleave(() => {
      $(key).removeClass('editing'); // Don't show the last key
      $('.center').removeClass('editing'); // Remove border from all center keys
    });
  });

  $('.expandable').click((event) => { // Click to expand/hide option groups
    if (event.target.className === 'clear_opt') return; // Don't expand if the 'Clear' button is what was clicked
    const content = $(event.currentTarget).next(); // Target the content div
    if (content.hasClass('expanded')) {
      content.removeClass('expanded').slideUp(500); // Hide if this was already expanded
    } else {
      $('.expanded').removeClass('expanded').slideUp(500); // Hide all expanded divs
      content.addClass('expanded').slideDown(500); // Expand the div we want
    }
  });

  $('.color_select div').click((event) => {
    const parent = $(event.currentTarget).parent(); // Target the wrapper div for all the colors
    let color = $(event.currentTarget).data('color'); // Get the color we clicked on
    // Determine which action group we are dealing with
    const parentClass = parent.hasClass('active') ? 'active' : 'inactive';
    parent.children().removeClass('selected'); // Remove the selected class from everything
    parent.data('color', color); // Set out parent class' data-color to the color we clicked on
    $(event.currentTarget).addClass('selected'); // Add the selected class to the color we clicked on
    if (color === 'OFF') { // Handle the 'X' image in the OFF color div
      $(`.color_select.${parentClass} div img`).addClass('selected');
    } else {
      $(`.color_select.${parentClass} div img`).removeClass('selected');
    }
    color = color.split('_'); // Format the color name to be gui friendly
    for (let i = 0; i < color.length; i++) {
      color[i] = toTitleCase(color[i]);
    }
    $(`.color_select.${parentClass} span`).text(color.join(' ')); // Set the color name to our new gui friendly name
    const keyConfig = getKeyConfig(); // Get the key config or defaults
    const action = parentClass === 'active' ? 'press' : 'release'; // Set action
    keyConfig.color[action] = $(`#${parentClass}_key_color`).data('color'); // Update the changed color
    config.keys[lastKey.join(',')] = keyConfig; // Save to config
{'fraction_non_alphanumeric': 0.1711482558139535, 'fraction_numerical': 0.005087209302325582, 'mean_word_length': 3.443099273607748, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '3983395', 'n_tokens_mistral': 1581, 'n_tokens_neox': 1558, 'n_words': 501}