<commit_before>$(function(){
    var menuBar = $('#menu-bar');
    var menuButton = $('#menu-toggle');
    var menuContent = $('#menu-content');
    var menuBackground = $('#menu-background');
    var menuAnchor = menuContent.find('a');

    /*
    **
    *** MENU EFFECTS ***
    **
    */


    /* mobile menu toggle */
    menuButton.on('click', function(){
        $(this).toggleClass("fa-close");
        $(this).toggleClass("fa-bars");
        if (menuContent.is(':visible')) {
            menuContent.fadeOut(function(){
                menuBackground.slideUp();
                menuBar.addClass('shadow-bar');
            });
        } else {
            menuBackground.slideDown(600, function(){
                menuContent.fadeIn();
                menuBar.removeClass('shadow-bar').removeClass('darker');
            });   
        }
    });

    menuAnchor.each(function(){
        $(this).on('click', function(){
            menuContent.fadeOut();
            menuBackground.fadeOut();
        });
    });

    /* desktop and tablet sticky menu */

    var tablet = window.matchMedia("screen and (max-width: 1023px) and (min-width: 760px)");
    var desktop = window.matchMedia("screen and (min-width: 1024px)");

    function useStickyMenu(event){
        if (event.matches) {
            var menuBarPosition = menuBar.offset().top;
            $(window).on('scroll', function(){
                var scrolledAmount = $(document).scrollTop();
                if (scrolledAmount > menuBarPosition) {
                    menuBar.addClass('sticky');

                } else {
                    menuBar.removeClass('sticky');
                }
            });
        }
    }

    useStickyMenu(tablet);
    useStickyMenu(desktop);

    tablet.addListener(useStickyMenu);
    desktop.addListener(useStickyMenu);


    /* menubar darkening */

    function darkenMenuBar(){
        var headerImageBottom = $('nav').height();
        $(window).on('scroll', function(){
            var scrolledAmount = $(document).scrollTop();
            if (scrolledAmount > headerImageBottom) {
                menuBar.addClass('darker');
            } else {
                menuBar.removeClass('darker');
            }
        });
    }

    darkenMenuBar();

    /*
    **
    *** NAVIGATION EFFECTS ***
    **
    */

    var buttonToTop = $('#arrow-up');

    var headerImageBottom = $('nav').height();

    function showButtonTop(){
        $(window).on('scroll', function(){
            var scrolledAmount = $(document).scrollTop();
            if (scrolledAmount > headerImageBottom) {
                buttonToTop.fadeIn();
            } else {
                buttonToTop.fadeOut();
            }
        });
    }

    showButtonTop();

});<commit_msg>add smooth scrolling<commit_after>$(function(){
    var menuBar = $('#menu-bar');
    var menuButton = $('#menu-toggle');
    var menuContent = $('#menu-content');
    var menuBackground = $('#menu-background');
    var menuAnchor = menuContent.find('a');

    /*
    **
    *** MENU EFFECTS ***
    **
    */


    /* mobile menu toggle */
    menuButton.on('click', function(){
        if (menuContent.is(':visible')) {
            menuContent.fadeOut(function(){
                menuBackground.slideUp();
                menuBar.addClass('shadow-bar');
                menuButton.removeClass('fa-close').addClass('fa-bars');
            });
        } else {
            menuBackground.slideDown(600, function(){
                menuContent.fadeIn();
                menuBar.removeClass('shadow-bar').removeClass('darker');
                menuButton.removeClass('fa-bars').addClass('fa-close');
            });   
        }
    });

    /* hide menu when any anchor clicked */
    var mobile = window.matchMedia("screen and (max-width: 759px)");
    function hideClickedMenu(event){
        if (event.matches) {
            menuAnchor.each(function(){
                $(this).on('click', function(){
                    menuContent.fadeOut();
                    menuBackground.fadeOut();
                    menuButton.removeClass('fa-close').addClass('fa-bars');
                });
            });
        }
    }
    
    hideClickedMenu(mobile);
    mobile.addListener(hideClickedMenu);


    /* desktop and tablet sticky menu */

    var tablet = window.matchMedia("screen and (max-width: 1023px) and (min-width: 760px)");
    var desktop = window.matchMedia("screen and (min-width: 1024px)");

    function useStickyMenu(event){
        if (event.matches) {
            var menuBarPosition = menuBar.offset().top;
            $(window).on('scroll', function(){
                var scrolledAmount = $(document).scrollTop();
                if (scrolledAmount > menuBarPosition) {
                    menuBar.addClass('sticky');

                } else {
                    menuBar.removeClass('sticky');
                }
            });
        }
    }

    useStickyMenu(tablet);
    useStickyMenu(desktop);

    tablet.addListener(useStickyMenu);
    desktop.addListener(useStickyMenu);


    /* menubar darkening */

    function darkenMenuBar(){
        var headerImageBottom = $('nav').height();
        $(window).on('scroll', function(){
            var scrolledAmount = $(document).scrollTop();
            if (scrolledAmount > headerImageBottom) {
                menuBar.addClass('darker');
            } else {
                menuBar.removeClass('darker');
            }
        });
    }

    darkenMenuBar();

    /*
    **
    *** NAVIGATION EFFECTS ***
    **
    */

    /* return to top button */
    
    var buttonToTop = $('#arrow-up');
    var headerImageBottom = $('nav').height();

    function showButtonTop(){
        $(window).on('scroll', function(){
            var scrolledAmount = $(document).scrollTop();
            if (scrolledAmount > headerImageBottom) {
                buttonToTop.fadeIn();
            } else {
                buttonToTop.fadeOut();
            }
        });
    }

    showButtonTop();

    /* smooth scrolling */

    function smoothScrolling(){
        menuAnchor.on('click', function(e){
            e.preventDefault();
            var anchor = $(this).attr('href');
            givenOffset = $(anchor).offset().top;
            $('html, body').animate({scrollTop: givenOffset}, 1200);
        });
    }

    smoothScrolling();

});
{'fraction_non_alphanumeric': 0.15238245007076584, 'fraction_numerical': 0.005504010064475547, 'mean_word_length': 1.8392857142857142, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '2420287', 'n_tokens_mistral': 1774, 'n_tokens_neox': 1663, 'n_words': 288}