<commit_before>function create_section_listing() {
  $('div#sidebar h3').click(function(e) {
    window.scrollTo(0, 0);
  });

  $('.section_title').each(function (i, e) {
    $("div#sidebar #section_listing").append("<a id='" + e.id + "_link'>" + (e.innerText || e.innerContent) + "</a>");
    just_added = $("div#sidebar #section_listing").children().last();
    if (e.tagName == "H2") {
      just_added.addClass("major");
    }
    else {
      just_added.addClass("minor");
    }
  });
  
  $('#sidebar a').click(function(e) {
    section_id = $(this).attr("id").replace("_link", "");
    window.scrollTo(0, $("#" + section_id)[0].offsetTop);
  })
}<commit_msg>Improve JavaScript for generating section listing<commit_after>function create_section_listing() {
  $('div#sidebar h3').click(function(e) {
    window.scrollTo(0, 0);
  });

  $('.section_title').each(function (i, e) {
    var content = e.innerText || e.textContent
    $("div#sidebar #section_listing").append("<a id='" + e.id + "_link'>" + content + "</a>");
    just_added = $("div#sidebar #section_listing").children().last();
    if (e.tagName == "H2") {
      just_added.addClass("major");
    }
    else {
      just_added.addClass("minor");
    }
  });
  
  $('#sidebar a').click(function(e) {
    section_id = $(this).attr("id").replace("_link", "");
    window.scrollTo(0, $("#" + section_id)[0].offsetTop);
  })
}
{'fraction_non_alphanumeric': 0.23076923076923078, 'fraction_numerical': 0.008626887131560028, 'mean_word_length': 3.8333333333333335, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '1060402', 'n_tokens_mistral': 494, 'n_tokens_neox': 483, 'n_words': 72}