<commit_before>(function ($) {
  $(document).ready(function () {
    // Media queries
    var mqExtraSmall = 480;
    var mqSmall = 768;
    var mqMedium = 992;
    var mqLarge = 1200;

    // Smooth scrolling for anchor links
    $('a[href*="#"]:not([href="#"],[data-toggle],[data-slide])').click(function() {
      if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
        var target = $(this.hash);
        target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
        if (target.length) {
          $('html, body').animate({
            scrollTop: target.offset().top
          }, 500);
          return false;
        }
      }
    });

    // Functions
    // ------------------------------------------------------------------

    function checkWindowWidth() {
      var windowsize = $(window).width();
      return windowsize;
    }
  });
})(jQuery);
<commit_msg>Update smooth scrolling script with focus added<commit_after>(function ($) {
  $(document).ready(function () {
    // Media queries
    var mqExtraSmall = 480;
    var mqSmall = 768;
    var mqMedium = 992;
    var mqLarge = 1200;

    // Smooth scrolling for anchor links
    $('a[href*="#"]')
    // Remove links that don't actually link to anything
    .not('[href="#"]')
    .click(function (event) {
      if (
        location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') &&
        location.hostname == this.hostname
      ) {
        // Figure out element to scroll to
        var target = $(this.hash);
        target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
        // Does a scroll target exist?
        if (target.length) {
          // Only prevent default if animation is actually gonna happen
          event.preventDefault();
          $('html, body').animate({
            scrollTop: target.offset().top
          }, 1000, function () {
            // Callback after animation
            // Must change focus!
            var $target = $(target);
            $target.focus();
            if ($target.is(":focus")) { // Checking if the target was focused
              return false;
            } else {
              $target.attr('tabindex', '-1'); // Adding tabindex for elements not focusable
              $target.focus(); // Set focus again
            };
          });
        }
      }
    });

    // Functions
    // ------------------------------------------------------------------

    function checkWindowWidth() {
      var windowsize = $(window).width();
      return windowsize;
    }
  });
})(jQuery);

{'fraction_non_alphanumeric': 0.20894956389836936, 'fraction_numerical': 0.013651877133105802, 'mean_word_length': 1.659274193548387, 'pattern_counts': {'":': 1, '<': 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': '1636315', 'n_tokens_mistral': 752, 'n_tokens_neox': 703, 'n_words': 177}