<commit_before>module.exports = (function() {
    var toolio = require('../app/toolio');

    var search = window.location.search;
    var matches = search.split('&');
    var query_params = {};

    matches.forEach(function(match) {
        if (match.indexOf('?') == 0) {
            match = match.slice(1);
        }

        var parts = match.split('=');
        query_params[parts[0]] = parts[1];
    });

        var domain = window.location.protocol + '//' + window.location.hostname;
    if (window.location.port != 80) {
        domain += ":" + window.location.port
    }

    var user_agent = navigator.userAgent.toLowerCase();
    var is_android = user_agent.indexOf("android") > -1;
    var is_iphone = user_agent.indexOf("iphone") > -1;

    window.app = {
        event_bus: require('../../../shared/event_bus'),
        toolio: require('../app/toolio'),
        domain: domain,
        settings: {},
        profile: {},
        emu_list: [],
        is_mobile: is_android || is_iphone,
        world: {user_settings: {}} // Users and shit.
    };

    app.ws = require('../app/wupsocket'); // for Lustmord

    // Dialog stuff.
    $.widget("yehrye.dialog", $.ui.dialog, {
        close: function() {
            var _this = this;
            setTimeout(function() {
                _this.uiDialog.remove();
            }, 0);
            this._superApply(arguments);
        }
    });

    var shared_config = require('../../../shared/shared_config'); // TODO - consider copying shared/* to a more relative folder.

    var server_settings = {
        server: 'wss://localhost:' + shared_config.chat_port,
        binary_server: 'wss://localhost:' + shared_config.binary_port
    };

    for (var server in server_settings) {
        if (server_settings[server].match('wss://localhost') !== null) {
            server_settings[server] = server_settings[server].replace('localhost', window.location.hostname);
        }
    }

    $.extend(app.settings, server_settings);
    window.get_page = require('../app/page');

    switch (query_params.wup) {
        case 'crabble':
            require('../pages/crabble')();
            break;

        case 'black_board':
            if (window.opener && window.opener.app) {
                window.app = window.opener.app;
            }
            require('../pages/black_board')();
            break;

        default:
            require('../pages/login')();
            break;
    }
<commit_msg>Close one<commit_after>module.exports = (function() {
    var toolio = require('../app/toolio');

    var search = window.location.search;
    var matches = search.split('&');
    var query_params = {};

    matches.forEach(function(match) {
        if (match.indexOf('?') == 0) {
            match = match.slice(1);
        }

        var parts = match.split('=');
        query_params[parts[0]] = parts[1];
    });

        var domain = window.location.protocol + '//' + window.location.hostname;
    if (window.location.port != 80) {
        domain += ":" + window.location.port
    }

    var user_agent = navigator.userAgent.toLowerCase();
    var is_android = user_agent.indexOf("android") > -1;
    var is_iphone = user_agent.indexOf("iphone") > -1;

    window.app = {
        event_bus: require('../../../shared/event_bus'),
        toolio: require('../app/toolio'),
        domain: domain,
        settings: {},
        profile: {},
        emu_list: [],
        is_mobile: is_android || is_iphone,
        world: {user_settings: {}} // Users and shit.
    };

    app.ws = require('../app/wupsocket'); // for Lustmord

    // Dialog stuff.
    $.widget("yehrye.dialog", $.ui.dialog, {
        close: function() {
            var _this = this;
            setTimeout(function() {
                _this.uiDialog.remove();
            }, 0);
            this._superApply(arguments);
        }
    });

    var shared_config = require('../../../shared/shared_config'); // TODO - consider copying shared/* to a more relative folder.

    var server_settings = {
        server: 'ws://localhost:' + shared_config.chat_port,
        binary_server: 'ws://localhost:' + shared_config.binary_port
    };

    for (var server in server_settings) {
        if (server_settings[server].match('ws://localhost') !== null) {
            server_settings[server] = server_settings[server].replace('localhost', window.location.hostname);
        }
    }

    $.extend(app.settings, server_settings);
    window.get_page = require('../app/page');

    switch (query_params.wup) {
        case 'crabble':
            require('../pages/crabble')();
            break;

        case 'black_board':
            if (window.opener && window.opener.app) {
                window.app = window.opener.app;
            }
            require('../pages/black_board')();
            break;

        default:
            require('../pages/login')();
            break;
    }

{'fraction_non_alphanumeric': 0.1633068621462024, 'fraction_numerical': 0.0036652412950519244, 'mean_word_length': 1.9878345498783454, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 7, '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': '3354383', 'n_tokens_mistral': 1461, 'n_tokens_neox': 1424, 'n_words': 265}