<commit_before>var notifications = (function () {

var exports = {};

var notice_memory = {};
var window_has_focus = true;
var new_message_count = 0;
var asked_permission_already = false;
var names;

function browser_desktop_notifications_on () {
    return (window.webkitNotifications &&
            // Firefox on Ubuntu claims to do webkitNotifications but its notifications are terrible
            $.browser.webkit &&
            // 0 is PERMISSION_ALLOWED
            window.webkitNotifications.checkPermission() === 0);
}

function update_title_count(new_count) {
    // Update window title and favicon to reflect new_message_count.
    //
    // If new_count is given, set new_message_count to that first.
    var n;

    if (new_count !== undefined) {
        if (new_message_count === new_count)
            return;
        new_message_count = new_count;
    }

    document.title = (new_message_count ? ("(" + new_message_count + ") ") : "")
        + domain + " - Humbug";

    // IE doesn't support PNG favicons, *shrug*
    if (! $.browser.msie) {
        // Indicate the message count in the favicon
        if (new_message_count) {
            // Make sure we're working with a number, as a defensive programming
            // measure.  And we don't have images above 99, so display those as
            // 'infinite'.
            n = (+new_message_count);
            if (n > 99)
                n = 'infinite';

            util.set_favicon('/static/images/favicon/favicon-'+n+'.png');
        } else {
            util.set_favicon('/static/favicon.ico?v=2');
        }
    }
}

exports.initialize = function () {
    names = fullname.toLowerCase().split(" ");
    names.push(email.split("@")[0].toLowerCase());
    names.push("all");
    names.push("everyone");
    names.push("<strong>" + fullname.toLowerCase() + "</strong>");

    $(window).focus(function () {
        window_has_focus = true;
        update_title_count(0);

        $.each(notice_memory, function (index, notice_mem_entry) {
           notice_mem_entry.obj.cancel();
        });
    }).blur(function () {
        window_has_focus = false;
    }).mouseover(function () {
        update_title_count(0);
    });

    if (!window.webkitNotifications) {
        return;
    }

    $(document).click(function () {
        if (!desktop_notifications_enabled || asked_permission_already) {
            return;
        }
        if (window.webkitNotifications.checkPermission() !== 0) { // 0 is PERMISSION_ALLOWED
            window.webkitNotifications.requestPermission();
            asked_permission_already = true;
        }
    });
};

function gravatar_url(message) {
    return "https://secure.gravatar.com/avatar/" + message.gravatar_hash +
           "?d=identicon&s=30?stamp=" + ui.get_gravatar_stamp();
}

function process_desktop_notification(message) {
    var i, notification_object, key;
    var title = message.sender_full_name;
    var content = $('<div/>').html(message.content).text();
    var other_recipients;
    var msg_count = 1;

    if (message.type === "private") {
        key = message.display_reply_to;
        other_recipients = message.display_reply_to;
        // Remove the sender from the list of other recipients
        other_recipients = other_recipients.replace(", " + message.sender_full_name, "");
        other_recipients = other_recipients.replace(message.sender_full_name + ", ", "");<commit_msg>Allow Safari desktop notifications.<commit_after>var notifications = (function () {

var exports = {};

var notice_memory = {};
var window_has_focus = true;
var new_message_count = 0;
var asked_permission_already = false;
var names;

function browser_desktop_notifications_on () {
    return (window.webkitNotifications &&
            // Firefox on Ubuntu claims to do webkitNotifications but its notifications are terrible
            $.browser.webkit &&
            // 0 is PERMISSION_ALLOWED
            window.webkitNotifications.checkPermission() === 0);
}

function update_title_count(new_count) {
    // Update window title and favicon to reflect new_message_count.
    //
    // If new_count is given, set new_message_count to that first.
    var n;

    if (new_count !== undefined) {
        if (new_message_count === new_count)
            return;
        new_message_count = new_count;
    }

    document.title = (new_message_count ? ("(" + new_message_count + ") ") : "")
        + domain + " - Humbug";

    // IE doesn't support PNG favicons, *shrug*
    if (! $.browser.msie) {
        // Indicate the message count in the favicon
        if (new_message_count) {
            // Make sure we're working with a number, as a defensive programming
            // measure.  And we don't have images above 99, so display those as
            // 'infinite'.
            n = (+new_message_count);
            if (n > 99)
                n = 'infinite';

            util.set_favicon('/static/images/favicon/favicon-'+n+'.png');
        } else {
            util.set_favicon('/static/favicon.ico?v=2');
        }
    }
}

exports.initialize = function () {
    names = fullname.toLowerCase().split(" ");
    names.push(email.split("@")[0].toLowerCase());
    names.push("all");
    names.push("everyone");
    names.push("<strong>" + fullname.toLowerCase() + "</strong>");

    $(window).focus(function () {
        window_has_focus = true;
        update_title_count(0);

        $.each(notice_memory, function (index, notice_mem_entry) {
           notice_mem_entry.obj.cancel();
        });
    }).blur(function () {
        window_has_focus = false;
    }).mouseover(function () {
        update_title_count(0);
    });

    if (!window.webkitNotifications) {
        return;
    }

    $(document).click(function () {
        if (!desktop_notifications_enabled || asked_permission_already) {
            return;
        }
        if (window.webkitNotifications.checkPermission() !== 0) { // 0 is PERMISSION_ALLOWED
            window.webkitNotifications.requestPermission(function () {});
            asked_permission_already = true;
        }
    });
};

function gravatar_url(message) {
    return "https://secure.gravatar.com/avatar/" + message.gravatar_hash +
           "?d=identicon&s=30?stamp=" + ui.get_gravatar_stamp();
}

function process_desktop_notification(message) {
    var i, notification_object, key;
    var title = message.sender_full_name;
    var content = $('<div/>').html(message.content).text();
    var other_recipients;
    var msg_count = 1;

    if (message.type === "private") {
        key = message.display_reply_to;
        other_recipients = message.display_reply_to;
        // Remove the sender from the list of other recipients
        other_recipients = other_recipients.replace(", " + message.sender_full_name, "");
        other_recipients = other_recipients.replace(message.sender_full_name + ", ", "");
{'fraction_non_alphanumeric': 0.12779877871474266, 'fraction_numerical': 0.004652515266065717, 'mean_word_length': 2.5846795205836375, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, 'https://': 2, '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': '5609011', 'n_tokens_mistral': 2080, 'n_tokens_neox': 1983, 'n_words': 427}