<commit_before>"use strict";

$(function() {
    var _expandCover,
        _isTagsOverlayOpen,
        _toggleTagsOverlay,
        _defaultLogoNavEvent,
        $navHeader,
        $tagsButton,
        $homeButton,
        $cover,
        $tagsOverlay;

    $cover = $(".cover");
    $navHeader = $("#default-nav-header");
    $tagsButton = $(".tags-button");
    $homeButton = $navHeader.find("#home-button");
    $tagsOverlay = $(".tags-overlay");

    _expandCover = function() {
        $cover.toggleClass("expanded");

        // Toggles the current page between the cover and the current page
        if ($cover.hasClass("expanded")) {
            CaffeineTheme.close();
        } else {
            CaffeineTheme.open();
        }
    };

    // Toggles the search/tags overlay
    _toggleTagsOverlay = function() {
        $tagsOverlay.toggleClass("show");
        $tagsButton.find("i").toggleClass("fa-search fa-close");
    };

    // Checks if the search/tags overlay is visible
    _isTagsOverlayOpen = function() {
        return $tagsOverlay.hasClass("show");
    };

    _defaultLogoNavEvent = function (event) {
        event.preventDefault();
        CaffeineTheme.showIndexPage();

        if (_isTagsOverlayOpen()) {
            _toggleTagsOverlay();
        }

        if (CaffeineTheme.is("page", "home")) {
            CaffeineTheme.showNotification();
        }

        return _expandCover();
    };

    $tagsButton.click(function() {
        _toggleTagsOverlay();
    });

    $(".home-link").click(function(event) {
        if (CaffeineTheme.is("page", "home")) {
            event.preventDefault();
            CaffeineTheme.showIndexPage();

            // Only toggle the cover if it wasn't already open
            if (!CaffeineTheme.isOpen()) {
                return _expandCover();
            }
        }
    });

    $(".subscribe-link").click(function(event) {
        event.preventDefault();

        if (window.toastr) {
            window.toastr.remove();
        }

        if (window.mailchimp_url) {
            $("body").subbscribe({
                title: "<NAME> | .Net Escapades",
                text: "Stay up to the date with the latest posts!",
                name: "<NAME>",
                color: "#206DA8",
                thumbnail: "/assets/img/icons/apple/apple-touch-icon-180x180.png?",
                list: "MailChimp",
                url : window.mailchimp_url
            });
        }
    });

    $homeButton.click(_defaultLogoNavEvent);
    $(".open-link").click(_defaultLogoNavEvent);

    if (CaffeineTheme.is("page", "home")) {
        if (!CaffeineTheme.isOpen()) {
            return _expandCover();
        }
    }
});<commit_msg>Add close on scroll to cover page (better behaviour on mobile<commit_after>"use strict";

$(function() {
    var _expandCover,
        _isTagsOverlayOpen,
        _toggleTagsOverlay,
        _defaultLogoNavEvent,
        $navHeader,
        $tagsButton,
        $homeButton,
        $cover,
        $tagsOverlay;

    $cover = $(".cover");
    $navHeader = $("#default-nav-header");
    $tagsButton = $(".tags-button");
    $homeButton = $navHeader.find("#home-button");
    $tagsOverlay = $(".tags-overlay");

    _expandCover = function() {
        $cover.toggleClass("expanded");

        // Toggles the current page between the cover and the current page
        if ($cover.hasClass("expanded")) {
            CaffeineTheme.close();
            $(window).on('scroll.cover', function(){
                _expandCover();
            })
        } else {
            CaffeineTheme.open();
            $(window).off('scroll.cover');
        }
    };

    // Toggles the search/tags overlay
    _toggleTagsOverlay = function() {
        $tagsOverlay.toggleClass("show");
        $tagsButton.find("i").toggleClass("fa-search fa-close");
    };

    // Checks if the search/tags overlay is visible
    _isTagsOverlayOpen = function() {
        return $tagsOverlay.hasClass("show");
    };

    _defaultLogoNavEvent = function (event) {
        event.preventDefault();
        CaffeineTheme.showIndexPage();

        if (_isTagsOverlayOpen()) {
            _toggleTagsOverlay();
        }

        if (CaffeineTheme.is("page", "home")) {
            CaffeineTheme.showNotification();
        }

        return _expandCover();
    };

    $tagsButton.click(function() {
        _toggleTagsOverlay();
    });

    $(".home-link").click(function(event) {
        if (CaffeineTheme.is("page", "home")) {
            event.preventDefault();
            CaffeineTheme.showIndexPage();

            // Only toggle the cover if it wasn't already open
            if (!CaffeineTheme.isOpen()) {
                return _expandCover();
            }
        }
    });

    $(".subscribe-link").click(function(event) {
        event.preventDefault();

        if (window.toastr) {
            window.toastr.remove();
        }

        if (window.mailchimp_url) {
            $("body").subbscribe({
                title: "<NAME> | .Net Escapades",
                text: "Stay up to the date with the latest posts!",
                name: "<NAME>",
                color: "#206DA8",
                thumbnail: "/assets/img/icons/apple/apple-touch-icon-180x180.png?",
                list: "MailChimp",
                url : window.mailchimp_url
            });
        }
    });

    $homeButton.click(_defaultLogoNavEvent);
    $(".open-link").click(_defaultLogoNavEvent);

    if (CaffeineTheme.is("page", "home")) {
        
        event.preventDefault();
        CaffeineTheme.showIndexPage();
        
        if (!CaffeineTheme.isOpen()) {
            return _expandCover();
        }
    }
});
{'fraction_non_alphanumeric': 0.1438621174815336, 'fraction_numerical': 0.0035174111853675696, 'mean_word_length': 1.898572884811417, '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': '4402318', 'n_tokens_mistral': 1663, 'n_tokens_neox': 1610, 'n_words': 292}