<commit_before>/*
 * Represents the overall time selection ui(duration & end time)
*/
BetForm.Time = function() {
    this.model = {};
    this.model.expiry_type = BetForm.attributes.model.expiry_type();
    this.trading_time = new BetForm.TradingTime();
    this.duration = new BetForm.Time.Duration(this.trading_time);
    this.end_time = new BetForm.Time.EndTime(this.trading_time);
};

BetForm.Time.prototype = {
    init: function() {
        // spreads doesn't have any concept of expiry
        if (BetForm.attributes.model.form_name() != "spreads") {
            this.trading_time.init();
            this.duration.init();
            this.end_time.init();
        }
        this.register();
        if (BetForm.attributes.model.form_name() == "digits" || BetForm.attributes.model.form_name() == "asian") {
            var expiry_val = 'duration';
            $('#expiry_type').val(expiry_val);
            page.url.invalidate();
            LocalStore.set('bet_page.expiry_type', expiry_val);
            BetForm.attributes.model.expiry_type(expiry_val);
            this.model.expiry_type = expiry_val;
            $('#duration_amount').val(this.trading_time.min_unit().min);
        } else {
            $('#expiry_type').val(this.model.expiry_type);
        }
        this.update_ui();
    },
    register: function() {
        this.on_expiry_type_change();
        this.duration.register();
        this.end_time.register();

        var that = this;
        $(this.duration).on('change', function(event, time) {
            $(that).trigger('change', [ time ]);
        });

        $(this.end_time).on('change', function(event, time) {
            $(that).trigger('change', [ time ]);
        });

        $(this.duration).on('enter_pressed', function() {
            $(that).trigger('enter_pressed');
        });

        $(this.end_time).on('enter_pressed', function() {
            $(that).trigger('enter_pressed');
        });
    },
    unregister: function() {
        $('#expiry_type').off('change');
        if(this.duration) {
            this.duration.unregister();
        }

        if(this.end_time) {<commit_msg>skip the entire Time init()<commit_after>/*
 * Represents the overall time selection ui(duration & end time)
*/
BetForm.Time = function() {
    this.model = {};
    this.model.expiry_type = BetForm.attributes.model.expiry_type();
    this.trading_time = new BetForm.TradingTime();
    this.duration = new BetForm.Time.Duration(this.trading_time);
    this.end_time = new BetForm.Time.EndTime(this.trading_time);
};

BetForm.Time.prototype = {
    init: function() {
        // spreads doesn't have any concept of expiry
        if (BetForm.attributes.model.form_name() != "spreads") {
            this.trading_time.init();
            this.duration.init();
            this.end_time.init();
            this.register();
            if (BetForm.attributes.model.form_name() == "digits" || BetForm.attributes.model.form_name() == "asian") {
                var expiry_val = 'duration';
                $('#expiry_type').val(expiry_val);
                page.url.invalidate();
                LocalStore.set('bet_page.expiry_type', expiry_val);
                BetForm.attributes.model.expiry_type(expiry_val);
                this.model.expiry_type = expiry_val;
                $('#duration_amount').val(this.trading_time.min_unit().min);
            } else {
                $('#expiry_type').val(this.model.expiry_type);
            }
            this.update_ui();
        }
    },
    register: function() {
        this.on_expiry_type_change();
        this.duration.register();
        this.end_time.register();

        var that = this;
        $(this.duration).on('change', function(event, time) {
            $(that).trigger('change', [ time ]);
        });

        $(this.end_time).on('change', function(event, time) {
            $(that).trigger('change', [ time ]);
        });

        $(this.duration).on('enter_pressed', function() {
            $(that).trigger('enter_pressed');
        });

        $(this.end_time).on('enter_pressed', function() {
            $(that).trigger('enter_pressed');
        });
    },
    unregister: function() {
        $('#expiry_type').off('change');
        if(this.duration) {
            this.duration.unregister();
        }

        if(this.end_time) {
{'fraction_non_alphanumeric': 0.16106764841233318, 'fraction_numerical': 0.0, 'mean_word_length': 2.2223869532987397, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4765047', 'n_tokens_mistral': 1336, 'n_tokens_neox': 1287, 'n_words': 182}