<commit_before>/*
    This runs JS required across all pages -
    runs various things inside $(document).ready() and then calls the klp.init()
    method. Each page is responsible to define a klp.init function to run
    page-specific JS.

 */

(function() {

    //can be used by other modules to hold data in memory
    klp.data = {};

    //we will use this in other places to close the currently open modal, etc.
    klp.openModal = null;

    //we need headerHeight in a few places, so we calculate it just once on ready
    var headerHeight;
    $(document).ready(function() {
        headerHeight = $(".main-header").height() + 10;
    });


    $(document).ready(function() {
        //style guide
        $(".style-block").each(function(){  
          $demo = $(this).find('.style-block-demo');
          var code = escapeHtml($demo.html());
          $(this).append("<div class='style-block-code js-toggled'><code><pre>"+ code +  "</pre></code></div>");
        });

        $(".js-toggle").click(function(){
          $(this).parents(".style-block").find(".js-toggled").slideToggle("fast");
        });
        // $(document).on('click', ".btn-modal-close", function(e){
        //     e.preventDefault();

        //     var $modal = $(e.target).closest(".modal").removeClass("show");
        //     $(".modal-overlay").removeClass("show");
        //     if (klp.openModal) {
        //         klp.openModal.close();
        //         klp.openModal = null;
        //     }
        // });

        //dropdown navigation - used for top menu navigation
        $(".js-dropdown li:has(ul)").click(function(event){
            event.stopPropagation();
            var thisNav = $(this).closest(".js-dropdown").find('ul');
            $(".js-dropdown ul").not(thisNav).slideUp().closest('.js-dropdown').children('li:has(ul)').removeClass('clicked');
            if (this == event.target || this == $(event.target).parent()[0]) {
                $(this).toggleClass('clicked').children('ul').slideToggle(200);
                $(this).find('li:has(ul)').removeClass('clicked').find("ul").slideUp();
                $(this).siblings().removeClass('clicked').find("ul").slideUp();
                return false;
            }
        }).addClass('has_ul');

        $(".js-dropdown li").click(function() {
            $(".js-dropdown li").removeClass("selected");
            $(this).addClass("selected");
        });
    
        $(window).click(function(){
            //slide up an open menu if user clicks anywhere else on window        
            $(".js-dropdown ul").slideUp(200).closest('.js-dropdown').children('li:has(ul)').removeClass('clicked');
            $('.js-dropdown').removeClass("nav-open");
        });


        //menu on mobile (hamburger menu) navigation    
        $('.js-nav-trigger').click(function(event){
            event.stopPropagation();
            $('.js-dropdown').toggleClass('nav-open');
        });

        $('.js-dropdown').click(function(event){<commit_msg>#429: styleguide: add selected menu styling<commit_after>/*
    This runs JS required across all pages -
    runs various things inside $(document).ready() and then calls the klp.init()
    method. Each page is responsible to define a klp.init function to run
    page-specific JS.

 */

(function() {

    //can be used by other modules to hold data in memory
    klp.data = {};

    //we will use this in other places to close the currently open modal, etc.
    klp.openModal = null;

    //we need headerHeight in a few places, so we calculate it just once on ready
    var headerHeight;
    $(document).ready(function() {
        headerHeight = $(".main-header").height() + 10;
    });


    $(document).ready(function() {
        //style guide
        $(".style-block").each(function(){  
          $demo = $(this).find('.style-block-demo');
          var code = escapeHtml($demo.html());
          $(this).append("<div class='style-block-code js-toggled'><code><pre>"+ code +  "</pre></code></div>");
        });

        $(".js-toggle").click(function(){
          $(this).parents(".style-block").find(".js-toggled").slideToggle("fast");
        });
        // $(document).on('click', ".btn-modal-close", function(e){
        //     e.preventDefault();

        //     var $modal = $(e.target).closest(".modal").removeClass("show");
        //     $(".modal-overlay").removeClass("show");
        //     if (klp.openModal) {
        //         klp.openModal.close();
        //         klp.openModal = null;
        //     }
        // });

        //dropdown navigation - used for top menu navigation
        $(".js-dropdown li:has(ul)").click(function(event){
            event.stopPropagation();
            var thisNav = $(this).closest(".js-dropdown").find('ul');
            $(".js-dropdown ul").not(thisNav).slideUp().closest('.js-dropdown').children('li:has(ul)').removeClass('clicked');
            if (this == event.target || this == $(event.target).parent()[0]) {
                $(this).toggleClass('clicked').children('ul').slideToggle(200);
                $(this).find('li:has(ul)').removeClass('clicked').find("ul").slideUp();
                $(this).siblings().removeClass('clicked').find("ul").slideUp();
                return false;
            }
        }).addClass('has_ul');

        $(".js-dropdown ul li").click(function() {
            $(".js-dropdown li").removeClass("selected");
            $(this).addClass("selected");
        });
    
        $(window).click(function(){
            //slide up an open menu if user clicks anywhere else on window        
            $(".js-dropdown ul").slideUp(200).closest('.js-dropdown').children('li:has(ul)').removeClass('clicked');
            $('.js-dropdown').removeClass("nav-open");
        });


        //menu on mobile (hamburger menu) navigation    
        $('.js-nav-trigger').click(function(event){
            event.stopPropagation();
            $('.js-dropdown').toggleClass('nav-open');
        });

        $('.js-dropdown').click(function(event){
{'fraction_non_alphanumeric': 0.19259381715986112, 'fraction_numerical': 0.0034716482063150934, 'mean_word_length': 2.199365415124273, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '2722941', 'n_tokens_mistral': 1697, 'n_tokens_neox': 1668, 'n_words': 341}