<commit_before>var FireX = FireX || {};

$(function () {
    FireX.ListView = Backbone.View.extend({
        template: _.template($('#list-template').html()),
        events: {
            'click .refresh':    'update',
            'click .h-manage':   'toggleFavorites'
        },
        initialize: function () {
            var that = this;
            
            this.listenTo(FireX.ProxyList, 'reset', this.addAll);
            this.listenTo(FireX.ProxyList, 'change:iFavorite', function (model, value, options) {
                if (!value) {
                    that.addAll();
                }
            });

            FireX.listMode || (FireX.listMode = false);

            addon.port.on('onList', function (response) {
                that.onList(response);
            });

        },
        render: function () {
            this.$el.html(this.template());

            this.table = this.$('#proxy-list-box');
            this.hBox = this.$('.h-box');
            this.favoriteCheckbox = this.$('.checkbox-square');

            this.favoriteCheckbox.toggleClass('active', FireX.listMode);

            this.addAll();

            return this;
        },
        update: function () {
            addon.port.emit('getList');

            FireX.listMode = false;
            this.favoriteCheckbox.toggleClass('active', FireX.listMode);

            this.hBox.addClass('spinner');
            this.table.empty();
        },
        addOne: function (proxy) {
            var view = new FireX.ProxyView({
                model: proxy
            });

            this.table.append(view.render().el);
        },
        addAll: function () {
            this.table.empty();

            _.each(FireX.ProxyList.where({
                iFavorite: FireX.listMode
            }), this.addOne, this);
        },
        onList: function (list) {
            this.hBox.removeClass('spinner');

            FireX.ProxyList.reset(FireX.ProxyList.where({
                iFavorite: true
            }).concat(list));
        },
        toggleFavorites: function () {
            FireX.listMode = !FireX.listMode;
            
            this.favoriteCheckbox.toggleClass('active', FireX.listMode);

            this.addAll();
        }
    });
});<commit_msg>Update on active proxy hotfix<commit_after>var FireX = FireX || {};

$(function () {
    FireX.ListView = Backbone.View.extend({
        template: _.template($('#list-template').html()),
        events: {
            'click .refresh':    'update',
            'click .h-manage':   'toggleFavorites'
        },
        initialize: function () {
            var that = this;
            
            this.listenTo(FireX.ProxyList, 'reset', this.addAll);
            this.listenTo(FireX.ProxyList, 'change:iFavorite', function (model, value, options) {
                if (!value) {
                    that.addAll();
                }
            });

            FireX.listMode || (FireX.listMode = false);

            addon.port.on('onList', function (response) {
                that.onList(response);
            });

        },
        render: function () {
            this.$el.html(this.template());

            this.table = this.$('#proxy-list-box');
            this.hBox = this.$('.h-box');
            this.favoriteCheckbox = this.$('.checkbox-square');

            this.favoriteCheckbox.toggleClass('active', FireX.listMode);

            this.addAll();

            return this;
        },
        update: function () {
            addon.port.emit('getList');

            FireX.listMode = false;
            this.favoriteCheckbox.toggleClass('active', FireX.listMode);

            this.hBox.addClass('spinner');
            this.table.empty();
        },
        addOne: function (proxy) {
            var view = new FireX.ProxyView({
                model: proxy
            });

            this.table.append(view.render().el);
        },
        addAll: function () {
            this.table.empty();

            _.each(FireX.ProxyList.where({
                iFavorite: FireX.listMode
            }), this.addOne, this);
        },
        onList: function (list) {
            this.hBox.removeClass('spinner');

            FireX.ProxyList.reset(FireX.ProxyList.filter(function (item) {
                return item.get('iFavorite') || item.get('iActive');
            }).concat(list));
        },
        toggleFavorites: function () {
            FireX.listMode = !FireX.listMode;
            
            this.favoriteCheckbox.toggleClass('active', FireX.listMode);

            this.addAll();
        }
    });
});
{'fraction_non_alphanumeric': 0.14459400781589232, 'fraction_numerical': 0.0, 'mean_word_length': 1.5024443237370995, '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': '5253824', 'n_tokens_mistral': 1287, 'n_tokens_neox': 1244, 'n_words': 196}