<commit_before>- load staticfiles
script(src='{% static "tablesorter.js" %}', type='text/javascript')
script(type='text/javascript').
    $(document).ready(function () {
        var table = $("#judge-status");
        table.tablesorter();

        var tooltip_classes = 'tooltipped tooltipped-w';
        var active_judge = null;
        var active_lang = null;

        function display_tooltip(where) {
            where.addClass(tooltip_classes).attr('aria-label', where.attr('data-runtime-info'));
        }

        function install_tooltips() {
            $('.runtime-label').each(function () {
                var link = $(this);
                link.mouseenter(function (e) {
                    active_judge = link.attr('data-judge');
                    active_lang = link.attr('data-lang');
                    display_tooltip(link);
                }).mouseleave(function (e) {
                    active_judge = active_lang = null;
                    $(e.target).removeClass(tooltip_classes).removeAttr('aria-label');
                });
            });
        }

        setInterval(function () {
            $.ajax({
                url: '{% url "status_table" %}'
            }).done(function (data) {
                table.html(data);

                var new_node = $(data);

                if (active_lang && active_judge) {
                    var selected = new_node.find('[data-judge=' + active_judge + '][data-lang=' + active_lang + ']').get(0);
                    if (selected)
                        display_tooltip(selected);
                }
                install_tooltips();
            });
        }, 10000);

        install_tooltips();
    });<commit_msg>Minimize tooltip flicker for #429<commit_after>- load staticfiles
script(src='{% static "tablesorter.js" %}', type='text/javascript')
script(type='text/javascript').
    $(document).ready(function () {
        var table = $("#judge-status");
        table.tablesorter();

        var tooltip_classes = 'tooltipped tooltipped-w';
        var active_judge = null;
        var active_lang = null;

        function display_tooltip(where) {
            where.addClass(tooltip_classes).attr('aria-label', where.attr('data-runtime-info'));
        }

        function install_tooltips() {
            $('.runtime-label').each(function () {
                var link = $(this);
                link.mouseenter(function (e) {
                    active_judge = link.attr('data-judge');
                    active_lang = link.attr('data-lang');
                    display_tooltip(link);
                }).mouseleave(function (e) {
                    active_judge = active_lang = null;
                    link.removeClass(tooltip_classes).removeAttr('aria-label');
                });
            });
        }

        setInterval(function () {
            $.ajax({
                url: '{% url "status_table" %}'
            }).done(function (data) {
                // Readd the tooltip classes to minimize flicker on update
                var new_node = $(data);

                if (active_lang && active_judge) {
                    var selected = new_node.find('[data-judge=' + active_judge + '][data-lang=' + active_lang + ']');
                    if (selected) // Might have been removed, when a judge disconnected
                        display_tooltip(selected);
                }

                table.html(new_node);
                install_tooltips();
            });
        }, 10000);

        install_tooltips();
    });
{'fraction_non_alphanumeric': 0.1362992349107396, 'fraction_numerical': 0.003967129498441485, 'mean_word_length': 1.6186943620178043, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5424050', 'n_tokens_mistral': 964, 'n_tokens_neox': 872, 'n_words': 166}