<commit_before>// Things global to the site should go here, such as re-usable helper
// functions and common ui components.

// CSRF Tokens
// Hijack the AJAX requests, and insert a CSRF token as a header.

$('html').ajaxSend(function(event, xhr, ajaxSettings) {
    var csrf, $meta;
    // Block anything that starts with "http:", "https:", "://" or "//"
    if (!/^((https?:)|:?[/]{2})/.test(ajaxSettings.url)) {
        // Only send the token to relative URLs i.e. locally.
        $meta = $('meta[name=csrf]');
        if (!z.anonymous && $meta.exists()) {
            csrf = $meta.attr('content');
        } else {
            csrf = $("#csrfmiddlewaretoken").val();
        }
        if (csrf) xhr.setRequestHeader("X-CSRFToken", csrf);
    }
});

// Tooltip display. If you give an element a class of 'tooltip', it will
// display a tooltip on hover. The contents of the tip will be the element's
// title attribute OR the first title attribute in its children. Titles are
// swapped out by the code so the native title doesn't display. If the title of
// the element is changed while the tooltip is displayed, you can update the
// tooltip by with the following:
//      $el.trigger("tooltip_change");
//<commit_msg>Redraw page when ajax content loads (bug 697594)<commit_after>// Things global to the site should go here, such as re-usable helper
// functions and common ui components.

// CSRF Tokens
// Hijack the AJAX requests, and insert a CSRF token as a header.

$('html').ajaxSend(function(event, xhr, ajaxSettings) {
    var csrf, $meta;
    // Block anything that starts with "http:", "https:", "://" or "//"
    if (!/^((https?:)|:?[/]{2})/.test(ajaxSettings.url)) {
        // Only send the token to relative URLs i.e. locally.
        $meta = $('meta[name=csrf]');
        if (!z.anonymous && $meta.exists()) {
            csrf = $meta.attr('content');
        } else {
            csrf = $("#csrfmiddlewaretoken").val();
        }
        if (csrf) xhr.setRequestHeader("X-CSRFToken", csrf);
    }
}).ajaxSuccess(function(event, xhr, ajaxSettings) {
    $(window).trigger('resize'); // Redraw what needs to be redrawn.
});

// Tooltip display. If you give an element a class of 'tooltip', it will
// display a tooltip on hover. The contents of the tip will be the element's
// title attribute OR the first title attribute in its children. Titles are
// swapped out by the code so the native title doesn't display. If the title of
// the element is changed while the tooltip is displayed, you can update the
// tooltip by with the following:
//      $el.trigger("tooltip_change");
//
{'fraction_non_alphanumeric': 0.14093701996927804, 'fraction_numerical': 0.0030721966205837174, 'mean_word_length': 2.8822652757078986, 'pattern_counts': {'":': 2, '<': 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': '4595270', 'n_tokens_mistral': 784, 'n_tokens_neox': 771, 'n_words': 305}