<commit_before>/*!
 * conkitty-app v0.0.1, https://github.com/hoho/conkitty-app
 * (c) 2014 Yandex LLC, MIT license
 */
var $CA = (function() {
    var ready = [],
        themeNodes = {},
        curTheme,
        documentLoaded,
        themeLoaded,
        cb,
        $CA = function() {
            documentLoaded = true;
            if (themeLoaded) {
                while ((cb = ready.shift())) {
                    cb();
                }
            }
        };

    $CA.ready = function(callback) { ready.push(callback); };
    $CA.theme = function(theme) {
        var node = themeNodes[theme];
        curTheme = theme;
        if (node) {
            node.onload();
        } else {
            node = themeNodes[theme] = document.createElement('link');
            node.rel = 'stylesheet';
            node.href = $CA_styles[theme];
            node.onload = node.onerror = function(/**/t, e) {
                for (t in themeNodes) {
                    if ((e = themeNodes[t])) { e.disabled = t !== curTheme; }
                }
                if (!themeLoaded) {
                    themeLoaded = true;
                    if (documentLoaded) { $CA(); }
                }
            };
            document.head.appendChild(node);
        }
    };

    if (typeof $CA_styles !== 'undefined') {
        $CA.theme('light');
    }

    return $CA;
})();<commit_msg>Redo theme loader.<commit_after>/*!
 * conkitty-app v0.0.1, https://github.com/hoho/conkitty-app
 * (c) 2014 Yandex LLC, MIT license
 */
var $CA = (function() {
    var ready = [],
        themeNodes = {},
        curTheme,
        defaultTheme,
        documentLoaded,
        themeFilesInProgress = 0,
        $CAthemes,
        themeRing,
        $CA = function() {
            documentLoaded = true;
            readyCallback();
        };

    $CA.ready = function(callback) { ready.push(callback); };
    $CA.themes = function(themes) {
        var t,
            prev;

        $CAthemes = themes;
        themeRing = {};

        for (t in themes) {
            if (!defaultTheme) { defaultTheme = t; }
            if (prev) { themeRing[prev] = t; }
            prev = t;
        }
        themeRing[prev] = defaultTheme;
        $CA.theme();
    };
    $CA.theme = function(theme) {
        var cookieTheme = document.cookie.replace(/^(?:.*\$CAtheme=([^;]+).*|.*)$/, '$1'),
            nodes,
            files,
            i,
            node;

        if (!theme) { theme = curTheme === undefined ? cookieTheme || defaultTheme : themeRing[curTheme]; }
        if (cookieTheme || theme !== defaultTheme) { document.cookie = ('$CAtheme=' + theme); }

        nodes = themeNodes[theme];
        curTheme = theme;

        if (nodes) {
            readyCallback();
        } else {
            nodes = themeNodes[theme] = [];
            files = $CAthemes[theme];
            themeFilesInProgress += files.length;
            for (i = 0; i < files.length; i++) {
                node = document.createElement('link');
                node.rel = 'stylesheet';
                node.href = files[i];
                node.onload = node.onerror = function() {
                    themeFilesInProgress--;
                    readyCallback();
                };
                document.head.appendChild(node);
                nodes.push(node);
            }
        }
    };

    return $CA;


    function readyCallback(/**/cb, theme, nodes, i) {
        if (documentLoaded && themeFilesInProgress === 0) {
            while ((cb = ready.shift())) {
                cb();
            }

            for (theme in themeNodes) {
                nodes = themeNodes[theme];
                for (i = nodes.length; i--;) {
                    nodes[i].disabled = theme !== curTheme;
                }
            }
        }
    }
})();
{'fraction_non_alphanumeric': 0.14442988204456095, 'fraction_numerical': 0.00471821756225426, 'mean_word_length': 1.3760896637608966, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 3, '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': '3640767', 'n_tokens_mistral': 1101, 'n_tokens_neox': 1038, 'n_words': 224}