<commit_before>/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

$(document).ready(function() {
    /* show / hide NOSCRIPT support */
    $('.bug_ids_extra').hide();
    $('.bug_ids_more').show();

    var bugzillaIds = [],
    scrubbedIds = [];
    $('.bug-link').each(function(i, v) {
        bugzillaIds.push(v.innerHTML);
    });
    //remove duplicates from array
    scrubbedIds = jQuery.unique(bugzillaIds);

    var batchSize = 100,
    scrubbedIdsLength = scrubbedIds.length,
    updateBugStatus = function(bugzilla_ids) {
        $.ajax({
            url: "/buginfo/bug?bug_ids=" + bugzilla_ids + "&include_fields=summary,status,id,resolution",
            dataType: 'json',
            success: function(data) {
                var bugTable = {};
                if (data.bugs) {
                    $.each(data.bugs, function(i, v) {
                        if (!("resolution" in v)) {
                            v.resolution = "---";
                        }
                        bugTable[v.id] = v;
                    });
                }

                $('.bug-link').each(function(i, v) {
                    var bug = bugTable[v.innerHTML];
                    if (bug) {
                        $(this).attr("title", bug.status + " " + bug.resolution + " " + bug.summary);

                        if(bug.status.length > 0 &&
                            !(bug.status in {'UNCONFIRMED': 1,'NEW': 1,'ASSIGNED': 1,'REOPENED': 1})) {
                            $(this).addClass("strike");
                        }
                    }
                });

                $('.bug_ids_expanded .bug-link').each(function(i, v) {
                    var bug = bugTable[v.innerHTML],
                    current;

                    if (bug) {
                        current = $(this).html();
                        $(this).after(" " + bug.status + " " + bug.resolution + " " + bug.summary);
                    }
                });
            }
        });
    };

    if (scrubbedIdsLength) {
        var startIndex = 0,
        endIndex = 1;

        while(startIndex < scrubbedIdsLength) {
            endIndex += batchSize;
            updateBugStatus(scrubbedIds.slice(startIndex, endIndex));
            startIndex = endIndex;
        }
    }

    $('.bug_ids_more').hover(function() {
        var inset = 10,
        cell = $(this),
        bugList = cell.find('.bug_ids_expanded_list');

        bugList.css({
            top: cell.position().top - inset,
            left: cell.position().left - (bugList.width() + inset)
        }).toggle();
    });
});
<commit_msg>fixes bug 915430 - /query/ signature links in search results do not work, r=espressive<commit_after>/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

// from https://github.com/janl/mustache.js/blob/master/mustache.js#L82
var entityMap = {
    "&": "&amp;",
    "<": "&lt;",
    ">": "&gt;",
    '"': '&quot;',
    "'": '&#39;',
    "/": '&#x2F;'
};
function escapeHtml(string) {
    return String(string).replace(/[&<>"'\/]/g, function (s) {
        return entityMap[s];
    });
}

$(document).ready(function() {
    /* show / hide NOSCRIPT support */
    $('.bug_ids_extra').hide();
    $('.bug_ids_more').show();

    var bugzillaIds = [],
    scrubbedIds = [];
    $('.bug-link').each(function(i, v) {
        bugzillaIds.push(v.innerHTML);
    });
    //remove duplicates from array
    scrubbedIds = jQuery.unique(bugzillaIds);

    var batchSize = 100,
    scrubbedIdsLength = scrubbedIds.length,
    updateBugStatus = function(bugzilla_ids) {
        $.ajax({
            url: "/buginfo/bug?bug_ids=" + bugzilla_ids + "&include_fields=summary,status,id,resolution",
            dataType: 'json',
            success: function(data) {
                var bugTable = {};
                if (data.bugs) {
                    $.each(data.bugs, function(i, v) {
                        if (!("resolution" in v)) {
                            v.resolution = "---";
                        }
                        bugTable[v.id] = v;
                    });
                }

                $('.bug-link').each(function(i, v) {
                    var bug = bugTable[v.innerHTML];
                    if (bug) {
                        $(this).attr("title", escapeHtml(bug.status + " " + bug.resolution + " " + bug.summary));

                        if(bug.status.length > 0 &&
                            !(bug.status in {'UNCONFIRMED': 1,'NEW': 1,'ASSIGNED': 1,'REOPENED': 1})) {
                            $(this).addClass("strike");
                        }
                    }
                });

                $('.bug_ids_expanded .bug-link').each(function(i, v) {
                    var bug = bugTable[v.innerHTML],
                    current;

                    if (bug) {
                        current = $(this).html();
                        $(this).after(escapeHtml(" " + bug.status + " " + bug.resolution + " " + bug.summary));
                    }
                });
            }
        });
    };

    if (scrubbedIdsLength) {
        var startIndex = 0,
        endIndex = 1;

        while(startIndex < scrubbedIdsLength) {
            endIndex += batchSize;
            updateBugStatus(scrubbedIds.slice(startIndex, endIndex));
            startIndex = endIndex;
        }
    }

    $('.bug_ids_more').hover(function() {
        var inset = 10,
        cell = $(this),
        bugList = cell.find('.bug_ids_expanded_list');

        bugList.css({
            top: cell.position().top - inset,
            left: cell.position().left - (bugList.width() + inset)
        }).toggle();
    });
});

{'fraction_non_alphanumeric': 0.15473790322580644, 'fraction_numerical': 0.0072244623655913975, 'mean_word_length': 1.4357610474631752, 'pattern_counts': {'":': 5, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 1, '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': '7486372', 'n_tokens_mistral': 1809, 'n_tokens_neox': 1664, 'n_words': 334}