<commit_before>// =================================
// Global variables (jshint):

/*global touchSupport*/
/*global isAndroid*/
///*global isIOS*/
// =================================

jQuery(function($) {
    // Caching variables
    var $html = $('html');
    var $mainNavigation = $('.js__main-navigation');
    var $openSubMenuLink = $('.js__main-navigation__open-sub-menu-link');
    var $mainNavigationItemsList = $mainNavigation.find('.js__main-navigation__items-list').children('li');

    //var $mainNavigationItemsListSub = ('.main-navigation__item._sub');
    var $dropdownMenuWithColumns = $('.js__dropdown-menu-with-columns .js__main-navigation__item._sub');
    if (!touchSupport) {
        $dropdownMenuWithColumns.hover(function() {
            $(this).toggleClass('open');
        });
    }

    // Cleanup function to clean unneeded classes
    var cleanup = function cleanup() {
        if ($mainNavigationItemsList.hasClass('_open-mobile-dropdown')) {
            $mainNavigationItemsList.removeClass('_open-mobile-dropdown');
        }
        if ($mainNavigationItemsList.hasClass('_open-tablet-dropdown')) {
            $mainNavigationItemsList.removeClass('_open-tablet-dropdown');
        }
        if ($html.hasClass('mobile-menu-opened')) {
            $html.removeClass('mobile-menu-opened');
        }

        if (isAndroid && screen.width < 992 && !$html.hasClass('mobile-menu-opened')) {
            $('.js__navigation__items-wrp').hide();
        } else if (!isAndroid /* or with 'isIOS' variable instead of '!isAndroid' */ && $(window).width() < 992 && !$html.hasClass('mobile-menu-opened')) {
            $('.js__navigation__items-wrp').hide();
        } else {
            $('.js__navigation__items-wrp').show();
        }
    };

    // Add click event to dropdown link on mobile devices.
    $openSubMenuLink.on('click', function(e) {
        e.preventDefault();
        // if (touchSupport && $(window).width() > 992) {
        if ($(window).width() > 992) {
            $mainNavigationItemsList.not($(this).parents()).removeClass('_open-tablet-dropdown');
            $(this).parents('.main-navigation__item').toggleClass('_open-tablet-dropdown');
        }
        if ($(window).width() < 992) {
            $(this).parents('.main-navigation__item').toggleClass('_open-mobile-dropdown');
        }
    });

    $(window).on('orientationchange',function() {
        cleanup();
    });

    var mobileMenuAnimationComplete = true;
    $('.js__main-navigation__toggle-btn').on('click', function(e) {
        e.preventDefault();
        if (mobileMenuAnimationComplete) {
            mobileMenuAnimationComplete = false;
            $html.toggleClass('mobile-menu-opened');
        }
        $('.js__navigation__items-wrp').not(':animated').slideToggle(300, function() {
            mobileMenuAnimationComplete = true;
        });
    });

});

// ====== class fo fixed main navigation bar   =======
jQuery(function($) {
    var navbar = $('.js__main-navigation');

    if (navbar.length) {
        var offsetTop = navbar.offset().top;
        $(window).on('orientationchange',function() {
            if ($(window).width() > 992 && touchSupport) {
                var navbarPos = navbar.css('position');
                offsetTop = $('header').height() - (navbarPos === 'fixed' ? 0 : navbar.outerHeight());
            }
        });
        $(window).on('load scroll', function() {
            var scrollPos = $(window).scrollTop();
            if (scrollPos > offsetTop) {
                $('body:not(.main-navigation-fixed)').addClass('main-navigation-fixed');
            } else {
                $('body.main-navigation-fixed').removeClass('main-navigation-fixed');
            }
        });
    }
});

jQuery(function($) {
    var $mainNavigationSearchBtn = $('.js__main-navigation__search-btn');
    var $mainNavigationSearchBox = $('.js__main-navigation__search-box');
    var $mainNavigationSearchBoxOverlay = $('.js__main-navigation__search-box-overlay');

    var $languageMenuOverlay = $('.js__header-top__language-menu-overlay');
    var $languageMenuBtn = $('.js__header-top__language-menu-btn');
    var $languageMenuBox = $('.js__header-top__language-menu-box');
    var $languageMenuBoxCloseBtn = $('.js__header-top__language-menu-box-close-btn');

    $mainNavigationSearchBtn.on('click', function(e) {
        e.preventDefault();
        $(this).toggleClass('_search-close-btn');
        $mainNavigationSearchBox.toggleClass('_search-box-visible');
        if ($mainNavigationSearchBox.hasClass('_search-box-visible')) {
            $mainNavigationSearchBox.find('input[type="search"]').focus();<commit_msg>[BUGFIX] Fixed menu looks buggy when scrolling (Podio bug_25) (#52)<commit_after>// =================================
// Global variables (jshint):

/*global touchSupport*/
/*global isAndroid*/
///*global isIOS*/
// =================================

jQuery(function($) {
    // Caching variables
    var $html = $('html');
    var $mainNavigation = $('.js__main-navigation');
    var $openSubMenuLink = $('.js__main-navigation__open-sub-menu-link');
    var $mainNavigationItemsList = $mainNavigation.find('.js__main-navigation__items-list').children('li');

    //var $mainNavigationItemsListSub = ('.main-navigation__item._sub');
    var $dropdownMenuWithColumns = $('.js__dropdown-menu-with-columns .js__main-navigation__item._sub');
    if (!touchSupport) {
        $dropdownMenuWithColumns.hover(function() {
            $(this).toggleClass('open');
        });
    }

    // Cleanup function to clean unneeded classes
    var cleanup = function() {
        $mainNavigationItemsList.removeClass('_open-mobile-dropdown _open-tablet-dropdown');
        $html.removeClass('mobile-menu-opened');

        if (window.matchMedia('(min-width: 992px)').matches) {
            $('.js__navigation__items-wrp').show();
        } else {
            $('.js__navigation__items-wrp').hide();
        }
    };

    // Add click event to dropdown link on mobile devices.
    $openSubMenuLink.on('click', function(e) {
        e.preventDefault();
        
        if (window.matchMedia('(min-width: 992px)').matches) {
            $mainNavigationItemsList.not($(this).parents()).removeClass('_open-tablet-dropdown');
            $(this).parents('.main-navigation__item').toggleClass('_open-tablet-dropdown');
        } else {
            $(this).parents('.main-navigation__item').toggleClass('_open-mobile-dropdown');
        }
    });

    // detect if we cross 992px window width.
    window.matchMedia('(min-width: 992px)').addListener(cleanup);

    var mobileMenuAnimationComplete = true;
    $('.js__main-navigation__toggle-btn').on('click', function(e) {
        e.preventDefault();
        if (mobileMenuAnimationComplete) {
            mobileMenuAnimationComplete = false;
            $html.toggleClass('mobile-menu-opened');
        }
        $('.js__navigation__items-wrp').not(':animated').slideToggle(300, function() {
            mobileMenuAnimationComplete = true;
        });
    });

});

// ====== class fo fixed main navigation bar   =======
jQuery(function($) {
    var navbar = $('.js__main-navigation');

    if (navbar.length) {
        var offsetTop = navbar.offset().top;

        // function that calculates offsetTop-value.
        var calcOffsetTop = function() {
            if (window.matchMedia('(min-width: 992px)').matches) {
                var navbarPos = navbar.css('position');
                offsetTop = $('header').height() - (navbarPos === 'fixed' ? 0 : navbar.outerHeight());
            }
        };

        // detect if we cross 992px window width.
        window.matchMedia('(min-width: 992px)').addListener(calcOffsetTop);

        $(window).on('load scroll', function() {
            var scrollPos = $(window).scrollTop();
            if (scrollPos > offsetTop) {
                $('body').addClass('main-navigation-fixed');
            } else {
                $('body').removeClass('main-navigation-fixed');
            }
        });
    }
});

jQuery(function($) {
    var $mainNavigationSearchBtn = $('.js__main-navigation__search-btn');
    var $mainNavigationSearchBox = $('.js__main-navigation__search-box');
    var $mainNavigationSearchBoxOverlay = $('.js__main-navigation__search-box-overlay');

    var $languageMenuOverlay = $('.js__header-top__language-menu-overlay');
    var $languageMenuBtn = $('.js__header-top__language-menu-btn');
    var $languageMenuBox = $('.js__header-top__language-menu-box');
    var $languageMenuBoxCloseBtn = $('.js__header-top__language-menu-box-close-btn');

    $mainNavigationSearchBtn.on('click', function(e) {
        e.preventDefault();
        $(this).toggleClass('_search-close-btn');
        $mainNavigationSearchBox.toggleClass('_search-box-visible');
        if ($mainNavigationSearchBox.hasClass('_search-box-visible')) {
            $mainNavigationSearchBox.find('input[type="search"]').focus();
{'fraction_non_alphanumeric': 0.18085344057193922, 'fraction_numerical': 0.005697050938337802, 'mean_word_length': 2.940580985915493, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 8, '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': '7560979', 'n_tokens_mistral': 2576, 'n_tokens_neox': 2469, 'n_words': 380}