<commit_before>var width = 930,
    height = 600;

var cola = cola.d3adaptor()
    .linkDistance(90)
    .avoidOverlaps(true)
    .size([width, height]);

$(function() {

    // Select field
    $('.selectpicker').selectpicker()

    // Collapse slide down/up
    function collapseOpen(button) {
        var glyphicon = button.children('.glyphicon')
        glyphicon.removeClass('glyphicon-triangle-bottom').addClass('glyphicon-triangle-top')
    }
    function collapseClose(button) {
        var glyphicon = button.children('.glyphicon')
        glyphicon.removeClass('glyphicon-triangle-top').addClass('glyphicon-triangle-bottom')
    }
    function bindBtnCollapse() {
        $('.btn-collapse').on('click', function () {
            if ($($(this).attr('data-target')).hasClass('in')) {
                collapseClose($(this))
            } else {
                collapseOpen($(this))
            }
        })
    }
    bindBtnCollapse()

    // Word card button group show/hide
    function bindBtnGrp() {
        $('.w-item').on('mouseover', function () {
            $(this).children('.sns-btn-wrap').show()
            var button = $(this).children('.sns-btn-wrap').children('.btn-collapse')
            if ($(button.attr('data-target')).hasClass('in')) {
                collapseClose(button)
            } else {
                collapseOpen(button)
            }
        })
        $('.w-item').on('mouseleave', function () {
            $(this).children('.sns-btn-wrap').hide()
        })
    }
    bindBtnGrp()

    // Searchbox
    var wordSearch = new Bloodhound({
        datumTokenizer: Bloodhound.tokenizers.obj.whitespace('word'),
        queryTokenizer: Bloodhound.tokenizers.whitespace,
        remote: {
            url: '/ajax/search?name=%QUERY',
            wildcard: '%QUERY'
        }
    });
    $('#w-search').typeahead({
        minLength: 2
    }, {
        name: 'word-search',
        display: 'name',
        source: wordSearch,
        templates: {
            header: '<div class="tt-suggestion tt-notfound">Add word<button type="button" id="btn-add-w" class="btn btn-success btn-sm" data-toggle="modal" data-target="#add-w-modal"><span class="glyphicon glyphicon-plus"></span></button></div>',
            notFound: '<div class="tt-suggestion tt-notfound">Add word<button type="button" id="btn-add-w" class="btn btn-success btn-sm" data-toggle="modal" data-target="#add-w-modal"><span class="glyphicon glyphicon-plus"></span></button></div>',
        },
    });
    $('#w-search').bind('typeahead:select', function(ev, suggestion) {
        // window.location.href = '/home?lang=' + suggestion.lang + '&name=' + suggestion.name;<commit_msg>Fix collapse button<commit_after>var width = 930,
    height = 600;

var cola = cola.d3adaptor()
    .linkDistance(90)
    .avoidOverlaps(true)
    .size([width, height]);

$(function() {

    // Select field
    $('.selectpicker').selectpicker()

    // Collapse slide down/up
    function collapseOpen(button) {
        var glyphicon = button.children('.glyphicon')
        glyphicon.removeClass('glyphicon-triangle-bottom').addClass('glyphicon-triangle-top')
    }
    function collapseClose(button) {
        var glyphicon = button.children('.glyphicon')
        glyphicon.removeClass('glyphicon-triangle-top').addClass('glyphicon-triangle-bottom')
    }
    function bindBtnCollapse() {
        $('.btn-collapse').on('click', function () {
            if ($($(this).attr('data-target')).hasClass('in')) {
                collapseClose($(this))
            } else {
                collapseOpen($(this))
            }
        })
    }
    bindBtnCollapse()

    // Word card button group show/hide
    function bindBtnGrp() {
        $('.w-item').on('mouseover', function () {
            $(this).children('.sns-btn-wrap').show()
            var button = $(this).children('.sns-btn-wrap').children('.btn-collapse')
            if ($(button.attr('data-target')).hasClass('in')) {
                // collapseClose(button)
                collapseOpen(button)
            } else {
                // collapseOpen(button)
                collapseClose(button)
            }
        })
        $('.w-item').on('mouseleave', function () {
            $(this).children('.sns-btn-wrap').hide()
        })
    }
    bindBtnGrp()

    // Searchbox
    var wordSearch = new Bloodhound({
        datumTokenizer: Bloodhound.tokenizers.obj.whitespace('word'),
        queryTokenizer: Bloodhound.tokenizers.whitespace,
        remote: {
            url: '/ajax/search?name=%QUERY',
            wildcard: '%QUERY'
        }
    });
    $('#w-search').typeahead({
        minLength: 2
    }, {
        name: 'word-search',
        display: 'name',
        source: wordSearch,
        templates: {
            header: '<div class="tt-suggestion tt-notfound">Add word<button type="button" id="btn-add-w" class="btn btn-success btn-sm" data-toggle="modal" data-target="#add-w-modal"><span class="glyphicon glyphicon-plus"></span></button></div>',
            notFound: '<div class="tt-suggestion tt-notfound">Add word<button type="button" id="btn-add-w" class="btn btn-success btn-sm" data-toggle="modal" data-target="#add-w-modal"><span class="glyphicon glyphicon-plus"></span></button></div>',
        },
    });
    $('#w-search').bind('typeahead:select', function(ev, suggestion) {
        // window.location.href = '/home?lang=' + suggestion.lang + '&name=' + suggestion.name;
{'fraction_non_alphanumeric': 0.17527099026272278, 'fraction_numerical': 0.0036744442403086534, 'mean_word_length': 2.4046278924327704, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, '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': '5127990', 'n_tokens_mistral': 1647, 'n_tokens_neox': 1579, 'n_words': 249}