<commit_before>const ChampionSocket     = require('./socket');
const ChampionRouter     = require('./router');
const ChampionSignup     = require('./../pages/signup');
const ChampionNewVirtual = require('./../pages/new_account/virtual');
const ChampionNewReal    = require('./../pages/new_account/real');
const ChampionContact    = require('./../pages/contact');
const ChampionEndpoint   = require('./../pages/endpoint');
const ChampionSettings   = require('./../pages/user/settings');
const ChangePassword     = require('./../pages/user/change_password');
const TNCApproval        = require('./../pages/user/tnc_approval');
const MetaTrader         = require('./../pages/user/metatrader/metatrader');
const LostPassword       = require('./../pages/lost_password');
const ResetPassword      = require('./../pages/reset_password');
const BinaryOptions      = require('./../pages/binary_options');
const Client             = require('./client');
const LoggedIn           = require('./logged_in');
const Login              = require('./login');
const Utility            = require('./utility');
const Cashier             = require('./../pages/cashier/cashier');
const CashierTopUpVirtual = require('./../pages/cashier/top_up_virtual');
const CashierPaymentMethods = require('./../pages/cashier/payment_methods');
const CashierPassword       = require('./../pages/cashier/cashier_password');
const FinancialAssessment   = require('./../pages/user/financial_assessment');
const checkRiskClassification = require('./../pages/user/check_risk_classification');

const Champion = (function() {
    'use strict';

    let _container,
        _active_script = null;

    const init = () => {
        _container = $('#champion-container');
        _container.on('champion:before', beforeContentChange);
        _container.on('champion:after', afterContentChange);
        Client.init();
        ChampionSocket.init();
        ChampionRouter.init(_container, '#champion-content');
        if (!Client.is_logged_in()) {
            $('#main-login').find('a').on('click', () => { Login.redirect_to_login(); });
        }
    };

    const beforeContentChange = () => {
        if (_active_script) {
            if (typeof _active_script.unload === 'function') {
                _active_script.unload();
            }
            _active_script = null;
        }
    };

    const afterContentChange = (e, content) => {
        const page = content.getAttribute('data-page');
        const pages_map = {
            assessment        : FinancialAssessment,
            cashier           : Cashier,
            contact           : ChampionContact,
            endpoint          : ChampionEndpoint,
            logged_inws       : LoggedIn,
            metatrader        : MetaTrader,
            real              : ChampionNewReal,
            settings          : ChampionSettings,
            virtual           : ChampionNewVirtual,
            'binary-options'  : BinaryOptions,
            'cashier-password': <PASSWORD>,
            'change-password' : <PASSWORD>,
            'lost-password'   : <PASSWORD>,
            'payment-methods' : CashierPaymentMethods,
            'reset-password'  : <PASSWORD>,
            'tnc-approval'    : TNCApproval,
            'top-up-virtual'  : CashierTopUpVirtual,
        };
        if (page in pages_map) {
            _active_script = pages_map[page];
            _active_script.load();
        }

        if (!_active_script) _active_script = ChampionSignup;
        ChampionSignup.load();
        Utility.handleActive();
        checkRiskClassification();
    };

    return {
        init: init,
    };
})();

module.exports = Champion;
<commit_msg>Update logo for logged in user<commit_after>const ChampionSocket     = require('./socket');
const ChampionRouter     = require('./router');
const ChampionSignup     = require('./../pages/signup');
const ChampionNewVirtual = require('./../pages/new_account/virtual');
const ChampionNewReal    = require('./../pages/new_account/real');
const ChampionContact    = require('./../pages/contact');
const ChampionEndpoint   = require('./../pages/endpoint');
const ChampionSettings   = require('./../pages/user/settings');
const ChangePassword     = require('./../pages/user/change_password');
const TNCApproval        = require('./../pages/user/tnc_approval');
const MetaTrader         = require('./../pages/user/metatrader/metatrader');
const LostPassword       = require('./../pages/lost_password');
const ResetPassword      = require('./../pages/reset_password');
const BinaryOptions      = require('./../pages/binary_options');
const Client             = require('./client');
const LoggedIn           = require('./logged_in');
const Login              = require('./login');
const Utility            = require('./utility');
const Cashier             = require('./../pages/cashier/cashier');
const CashierTopUpVirtual = require('./../pages/cashier/top_up_virtual');
const CashierPaymentMethods = require('./../pages/cashier/payment_methods');
const CashierPassword       = require('./../pages/cashier/cashier_password');
const FinancialAssessment   = require('./../pages/user/financial_assessment');
const checkRiskClassification = require('./../pages/user/check_risk_classification');
const default_redirect_url    = require('./url').default_redirect_url;

const Champion = (function() {
    'use strict';

    let _container,
        _active_script = null;

    const init = () => {
        _container = $('#champion-container');
        _container.on('champion:before', beforeContentChange);
        _container.on('champion:after', afterContentChange);
        Client.init();
        ChampionSocket.init();
        ChampionRouter.init(_container, '#champion-content');
        if (!Client.is_logged_in()) {
            $('#main-login').find('a').on('click', () => { Login.redirect_to_login(); });
        } else {
            $('a.logo-parent').attr('href', default_redirect_url());
        }
    };

    const beforeContentChange = () => {
        if (_active_script) {
            if (typeof _active_script.unload === 'function') {
                _active_script.unload();
            }
            _active_script = null;
        }
    };

    const afterContentChange = (e, content) => {
        const page = content.getAttribute('data-page');
        const pages_map = {
            assessment        : FinancialAssessment,
            cashier           : Cashier,
            contact           : ChampionContact,
            endpoint          : ChampionEndpoint,
            logged_inws       : LoggedIn,
            metatrader        : MetaTrader,
            real              : ChampionNewReal,
            settings          : ChampionSettings,
            virtual           : ChampionNewVirtual,
            'binary-options'  : BinaryOptions,
            'cashier-password': <PASSWORD>,
            'change-password' : <PASSWORD>,
            'lost-password'   : <PASSWORD>Password,
            'payment-methods' : CashierPaymentMethods,
            'reset-password'  : <PASSWORD>,
            'tnc-approval'    : TNCApproval,
            'top-up-virtual'  : CashierTopUpVirtual,
        };
        if (page in pages_map) {
            _active_script = pages_map[page];
            _active_script.load();
        }

        if (!_active_script) _active_script = ChampionSignup;
        ChampionSignup.load();
        Utility.handleActive();
        checkRiskClassification();
    };

    return {
        init: init,
    };
})();

module.exports = Champion;

{'fraction_non_alphanumeric': 0.1453365129835718, 'fraction_numerical': 0.0, 'mean_word_length': 2.265138408304498, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 19, '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': '3608653', 'n_tokens_mistral': 1978, 'n_tokens_neox': 1957, 'n_words': 351}