<commit_before>// https://jsfiddle.net/upqwhou2/

$(document).ready(function() {
    window.location = window.location.href;
    var navigationLinks = $('#sidebar-wrapper > ul > li > a');
    var sectionIdTonavigationLink = {};
    var sections = $("#page-content-wrapper").children().map(function(index, node) {
        if (node.id) {
            sectionIdTonavigationLink[node.id] = $('#sidebar-wrapper > ul > li > a[href="#' + node.id + '"]');
            return node;
        }
    });
    var sectionsReversed = $(sections.get().reverse());

    function checkScroll() {
        var scrollPosition = $(window).scrollTop();
        var offset = 250;
        scrollPosition += offset;
        sections.each(function() {
            var currentSection = $(this);
            var sectionTop = $(this).offset().top;
            var id = $(this).attr('id');
            if (scrollPosition >= sectionTop) {
                navigationLinks.removeClass('selected');
                console.log("section navigation link ", navigationLinks);
                sectionIdTonavigationLink[id].addClass('selected');
            }
        });
    }
    checkScroll();
    $(window).scroll(checkScroll);
});<commit_msg>Removed hash location on load.<commit_after>// https://jsfiddle.net/upqwhou2/

$(document).ready(function() {
    var navigationLinks = $('#sidebar-wrapper > ul > li > a');
    var sectionIdTonavigationLink = {};
    var sections = $("#page-content-wrapper").children().map(function(index, node) {
        if (node.id) {
            sectionIdTonavigationLink[node.id] = $('#sidebar-wrapper > ul > li > a[href="#' + node.id + '"]');
            return node;
        }
    });
    var sectionsReversed = $(sections.get().reverse());

    function checkScroll() {
        var scrollPosition = $(window).scrollTop();
        var offset = 50;
        scrollPosition += offset;
        sections.each(function() {
            var currentSection = $(this);
            var sectionTop = $(this).offset().top;
            var id = $(this).attr('id');
            if (scrollPosition >= sectionTop) {
                navigationLinks.removeClass('selected');
                console.log("section navigation link ", navigationLinks);
                sectionIdTonavigationLink[id].addClass('selected');
            }
        });
    }
    checkScroll();
    $(window).scroll(checkScroll);
});
{'fraction_non_alphanumeric': 0.16036943744752308, 'fraction_numerical': 0.002938706968933669, 'mean_word_length': 2.3563380281690143, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, 'https://': 2, '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': '3125957', 'n_tokens_mistral': 647, 'n_tokens_neox': 623, 'n_words': 124}