<commit_before>var app = app || {};

app.global = function() {

    var init = function() {

        initEventHandlers();
        initPlugins();
    };

    var initEventHandlers = function() {

        initUserSelection();
        initTextSearch();
        initReadMore();
        initRequiredCheckbox();
        initDetailedAttributes();
    };

    var initPlugins = function() {

        initTooltips();
    };

    var initUserSelection = function() {
        var form = $('form.dropdown-menu');

        form.on('click', 'li', function(event) {

            var item = $(event.target).closest('li')[0], roleId = item
                    .getAttribute('data-roleId');

            $('<input>').attr({
                type : 'hidden',
                name : 'roleId',
                value : roleId
            }).appendTo(form);

            form[0].submit();
        });
    };

    var initTextSearch = function() {
        var searchButton = $('#sb_id');
        var searchInput = $('#si_id');

        searchButton.click(function(event){
            search(event); 
        });

        searchInput.keydown(function(event){
            if (event.which === 13) {
               search(event);
            }
        });
    }


    var initReadMore = function() {
        var readMoreElms = $('.with-read-more').each(function(index, elm) {
            elm = $(elm);

            if (elm.find('p').length < 2) {
                pElm = elm.find('p');
                if (pElm.length === 0 || $.trim(pElm.text()).length === 0) {
                    elm.remove();
                }
                return;
            }

            var linkText = elm.data('readMoreText');

            elm.append('<a class="toggle-read-more" href="#">' + linkText + '</a>');
            elm.addClass('folded');
        });

        readMoreElms.on('click', '.toggle-read-more', function(e) {
            e.preventDefault();

            var elm = $(this),
                wrapper = elm.closest('.with-read-more').toggleClass('folded');

            if (wrapper.hasClass('folded')) {
                elm.html(wrapper.data('readMoreText'));
            }
            else {
                elm.html(wrapper.data('readLessText'));
            }
        });<commit_msg>JS solution to remove empty P tags from description<commit_after>var app = app || {};

app.global = function() {

    var init = function() {

        initEventHandlers();
        initPlugins();
    };

    var initEventHandlers = function() {

        initUserSelection();
        initTextSearch();
        initReadMore();
        initRequiredCheckbox();
        initDetailedAttributes();
    };

    var initPlugins = function() {

        initTooltips();
    };

    var initUserSelection = function() {
        var form = $('form.dropdown-menu');

        form.on('click', 'li', function(event) {

            var item = $(event.target).closest('li')[0], roleId = item
                    .getAttribute('data-roleId');

            $('<input>').attr({
                type : 'hidden',
                name : 'roleId',
                value : roleId
            }).appendTo(form);

            form[0].submit();
        });
    };

    var initTextSearch = function() {
        var searchButton = $('#sb_id');
        var searchInput = $('#si_id');

        searchButton.click(function(event){
            search(event); 
        });

        searchInput.keydown(function(event){
            if (event.which === 13) {
               search(event);
            }
        });
    }


    var initReadMore = function() {
        var readMoreElms = $('.with-read-more').each(function(index, elm) {
            elm = $(elm);

            var pElm, pElms = elm.find('p');

            for (var i = 0, l = pElms.length; i < l; ++i) {
                pElm = $(pElms[i]);

                if ($.trim(pElm.text()).length === 0) {
                    pElm.remove();
                }
            }

            pElms = elm.find('p');

            if (pElms.length < 2) {
                pElm = pElms.first();
                if (pElm.length === 0 || $.trim(pElm.text()).length === 0) {
                    elm.remove();
                }
                return;
            }

            var linkText = elm.data('readMoreText');

            elm.append('<a class="toggle-read-more" href="#">' + linkText + '</a>');
            elm.addClass('folded');
        });

        readMoreElms.on('click', '.toggle-read-more', function(e) {
            e.preventDefault();

            var elm = $(this),
                wrapper = elm.closest('.with-read-more').toggleClass('folded');

            if (wrapper.hasClass('folded')) {
                elm.html(wrapper.data('readMoreText'));
            }
            else {
                elm.html(wrapper.data('readLessText'));
            }
        });
{'fraction_non_alphanumeric': 0.16098367431287455, 'fraction_numerical': 0.0033064682785699526, 'mean_word_length': 1.4807790876473603, 'pattern_counts': {'":': 0, '<': 12, '<?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': '1560870', 'n_tokens_mistral': 1423, 'n_tokens_neox': 1318, 'n_words': 241}