<commit_before>/**
 * The content script
 *
 * @author <NAME> (@bgotink)
 * @license MIT
 */

/*
 * Use the following script on G+ pages to identify the elements containing a 'oid' attribute:
 *
 * (function () {
 * var result = {}, elems = document.querySelectorAll('[oid]'), i, length = elems.length, elem, key;
 * for(i = 0; i < length; i++) {
 *     elem = elems.item(i);
 *     key = elem.tagName.toLowerCase() + '.' + elem.className.split(' ').join('.');
 *     if (key in result) {
 *         result[key] ++;
 *     } else {
 *         result[key] = 1;
 *     }
 * }
 * console.log(result);
 * })();
 */

window.iidentity = window.iidentity || {};

(function (module, window, $) {
    'use strict';

    var doOnceTimestamp,
        doOnce = function (elem, callback) {
            var $elem = $(elem),
                callbackArguments = Array.prototype.slice.call(arguments, 1);
            callbackArguments[0] = elem;

            if ($elem.attr('data-iidentity') === doOnceTimestamp) {
                // already performed
                return;
            }

            $elem.attr('data-iidentity', doOnceTimestamp);

            callback.apply(null, callbackArguments);
        },

        createBlockElement = function (oid, match, callback) {
            module.comm.getPlayer(oid, function (err, player) {
                if (err !== null) {
                    callback(err, null);
                    return;
                }

                var $groupInfo,
                    $extraInfo,
                    $name,
                    level,
                    $elem = $('<div>')
                        .addClass('iidentity-wrapper')
                        .attr('data-oid', oid)
                        .append(
                            $name = $('<div>')
                                .addClass('iidentity-name')
                                .addClass('iidentity-faction-' + player.faction)
                                .text(player.nickname)
                        )
                        .append(
                            $extraInfo = $('<div>')
                                .addClass('iidentity-extra')
                        )
                        .append(
                            $groupInfo = $('<div>')
                                .addClass('iidentity-group')
                        );

                if (Object.isNumber(player.level)) {
                    level = '' + Number.range(0, 16).clamp(player.level);
                } else {
                    if (Object.isString(player.level) && player.level.match(/([0-9]|1[0-6])/)) {
                        level = player.level;
                    } else {
                        level = '0';
                    }
                }

                $extraInfo.append(
                    $('<span>')
                        .addClass('iidentity-level iidentity-level' + level)
                        .text('L' + ('0' == level ? '?' : level))
                );

                if (Object.has(player.extra, 'anomaly')) {
                    if (!Array.isArray(player.extra.anomaly)) {
                        player.extra.anomaly = [ player.extra.anomaly ];
                    }

                    var anomalyList = [];

                    player.extra.anomaly.each(function (anomaly) {
                        anomalyList.push(
                            $('<img>')
                                .attr('src', chrome.extension.getURL('img/anomalies/' + anomaly + '.png'))
                                .attr('alt', anomaly)
                                .attr('title', anomaly.capitalize(true))
                                .addClass('iidentity-anomaly')
                        );
                    });

                    $name.append(
                        $('<div>')
                            .addClass('iidentity-anomalies')
                            .append(anomalyList)
                    );
                }

                if (Object.has(player.extra, 'community')) {
                    if (!Array.isArray(player.extra.community)) {
                        player.extra.community = [ player.extra.community ];
                    }

                    player.extra.community.each(function (community, i) {
                        var seperatorposition = community.indexOf(":");

                        if (i > 4) {
                            return;
                        }
                        if (i === 4) {
                            $groupInfo.append(
                                $('<div>').html('&ldots;')
                            );
                            return;
                        }

                        if (seperatorposition === -1) {
                            return;
                        }

                        $groupInfo.append(
                            $('<div>')
                                .append(
                                    $('<a>')
                                        .attr('href', 'https://plus.google.com/communities/' + community.to(seperatorposition).compact())
                                        .text(community.from(seperatorposition + 1).compact())
                                )
                        );
                    });
                }

                if (Object.has(player.extra, 'event')) {
                    if (!Array.isArray(player.extra.event)) {
                        player.extra.event = [ player.extra.event ];
                    }

                    player.extra.event.each(function (event, i) {
                        var seperatorposition = event.indexOf(":");

                        if (i > 4) {
                            return;
                        }
                        if (i === 4) {
                            $groupInfo.append(
                                $('<div>').html('&ldots;')
                            );
                            return;
                        }

                        if (seperatorposition === -1) {
                            return;
                        }

                        $groupInfo.append(
                            $('<div>')
                                .append(
                                    $('<a>')
                                        .attr('href', 'https://plus.google.com/events/' + event.to(seperatorposition).compact())
                                        .text(event.from(seperatorposition + 1).compact())
                                )
                        );<commit_msg>[content] layout tweak for profile pop-up<commit_after>/**
 * The content script
 *
 * @author <NAME> (@bgotink)
 * @license MIT
 */

/*
 * Use the following script on G+ pages to identify the elements containing a 'oid' attribute:
 *
 * (function () {
 * var result = {}, elems = document.querySelectorAll('[oid]'), i, length = elems.length, elem, key;
 * for(i = 0; i < length; i++) {
 *     elem = elems.item(i);
 *     key = elem.tagName.toLowerCase() + '.' + elem.className.split(' ').join('.');
 *     if (key in result) {
 *         result[key] ++;
 *     } else {
 *         result[key] = 1;
 *     }
 * }
 * console.log(result);
 * })();
 */

window.iidentity = window.iidentity || {};

(function (module, window, $) {
    'use strict';

    var doOnceTimestamp,
        doOnce = function (elem, callback) {
            var $elem = $(elem),
                callbackArguments = Array.prototype.slice.call(arguments, 1);
            callbackArguments[0] = elem;

            if ($elem.attr('data-iidentity') === doOnceTimestamp) {
                // already performed
                return;
            }

            $elem.attr('data-iidentity', doOnceTimestamp);

            callback.apply(null, callbackArguments);
        },

        createBlockElement = function (oid, match, callback) {
            module.comm.getPlayer(oid, function (err, player) {
                if (err !== null) {
                    callback(err, null);
                    return;
                }

                var $groupInfo,
                    $extraInfo,
                    $name,
                    level,
                    $elem = $('<div>')
                        .addClass('iidentity-wrapper')
                        .attr('data-oid', oid)
                        .append(
                            $name = $('<div>')
                                .addClass('iidentity-name')
                                .addClass('iidentity-faction-' + player.faction)
                                .text(player.nickname)
                        )
                        .append(
                            $extraInfo = $('<div>')
                                .addClass('iidentity-extra')
                        )
                        .append(
                            $groupInfo = $('<div>')
                                .addClass('iidentity-group')
                        );

                if (Object.isNumber(player.level)) {
                    level = '' + Number.range(0, 16).clamp(player.level);
                } else {
                    if (Object.isString(player.level) && player.level.match(/([0-9]|1[0-6])/)) {
                        level = player.level;
                    } else {
                        level = '0';
                    }
                }

                $extraInfo.append(
                    $('<span>')
                        .addClass('iidentity-level iidentity-level' + level)
                        .text('L' + ('0' == level ? '?' : level))
                );

                if (Object.has(player.extra, 'anomaly')) {
                    if (!Array.isArray(player.extra.anomaly)) {
                        player.extra.anomaly = [ player.extra.anomaly ];
                    }

                    var anomalyList = [];

                    player.extra.anomaly.each(function (anomaly) {
                        anomalyList.push(
                            $('<img>')
                                .attr('src', chrome.extension.getURL('img/anomalies/' + anomaly + '.png'))
                                .attr('alt', anomaly)
                                .attr('title', anomaly.capitalize(true))
                                .addClass('iidentity-anomaly')
                        );
                    });

                    $name.append(
                        $('<div>')
                            .addClass('iidentity-anomalies')
                            .append(anomalyList)
                    );
                }

                if (Object.has(player.extra, 'community')) {
                    if (!Array.isArray(player.extra.community)) {
                        player.extra.community = [ player.extra.community ];
                    }

                    player.extra.community.each(function (community, i) {
                        var seperatorposition = community.indexOf(":");

                        if (i > 3) {
                            return;
                        }
                        if (i === 3) {
                            $groupInfo.append(
                                $('<div>').html('&hellip;')
                            );
                            return;
                        }

                        if (seperatorposition === -1) {
                            return;
                        }

                        $groupInfo.append(
                            $('<div>')
                                .append(
                                    $('<a>')
                                        .attr('href', 'https://plus.google.com/communities/' + community.to(seperatorposition).compact())
                                        .text(community.from(seperatorposition + 1).compact())
                                )
                        );
                    });
                }

                if (Object.has(player.extra, 'event')) {
                    if (!Array.isArray(player.extra.event)) {
                        player.extra.event = [ player.extra.event ];
                    }

                    player.extra.event.each(function (event, i) {
                        var seperatorposition = event.indexOf(":");

                        if (i > 3) {
                            return;
                        }
                        if (i === 3) {
                            $groupInfo.append(
                                $('<div>').html('&hellip;')
                            );
                            return;
                        }

                        if (seperatorposition === -1) {
                            return;
                        }

                        $groupInfo.append(
                            $('<div>')
                                .append(
                                    $('<a>')
                                        .attr('href', 'https://plus.google.com/events/' + event.to(seperatorposition).compact())
                                        .text(event.from(seperatorposition + 1).compact())
                                )
                        );
{'fraction_non_alphanumeric': 0.12448731581345891, 'fraction_numerical': 0.0033419413641197025, 'mean_word_length': 0.8325678496868476, 'pattern_counts': {'":': 4, '<': 33, '<?xml version=': 0, '>': 35, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4373048', 'n_tokens_mistral': 3213, 'n_tokens_neox': 2916, 'n_words': 497}