<commit_before>M.wrap('github/jillix/bind-filter/dev/list.js', function (require, module, exports) {
// TODO use bind for dom interaction/manipulation
function get(s,c) {
    try {
        return (c||document).querySelector(s);
    } catch (err) {
        return null;
    }
}

function buildItem (elem, content) {
    var elem = elem.cloneNode();
    elem.innerHTML = content;
    return elem;
}

var getFieldLabel = require('./validate').getFieldLabel;

function createFilterItem (hash) {
    var self = this;

    var item = buildItem(self.domRefs.listItem, self.domRefs.listItemContent);

    var checkbox = get(self.config.ui.item.onoff, item);
    var field = get(self.config.ui.item.field, item);
    var operator = get(self.config.ui.item.operator, item);
    var value = get(self.config.ui.item.value, item);
    var edit = get(self.config.ui.item.edit, item);
    var rm = get(self.config.ui.item.remove, item);

    // enable/disable filter
    if (self.filters[hash].disabled) {
        item.setAttribute('class', 'disabled');
        if (checkbox) {
            checkbox.removeAttribute('checked');
        }
    }

    // hide filter item
    if (self.filters[hash].hidden) {
        item.style.display = 'none';
    }

    // set content
    if (field) {
        field.innerHTML = getFieldLabel.call(self, self.filters[hash].field);
    }
    if (operator) {

        var myOperator = self.filters[hash].operator;

        self.emit("message", myOperator, function (err, newOperator) {
            if(err) { return; }
            operator.innerHTML = newOperator.message;
        });
    }
    if (value) {
        value.innerHTML = self.filters[hash].value === undefined ? '' : (typeof self.filters[hash].originalValue === 'string' ? self.filters[hash].originalValue : self.filters[hash].value);
    }

    // hide edit if it's a core field
    if (edit && self.filters[hash].field[0] === '_') {
        edit.style.display = 'none';
    }<commit_msg>Translate values when creating the filters. Code optimization<commit_after>M.wrap('github/jillix/bind-filter/dev/list.js', function (require, module, exports) {
// TODO use bind for dom interaction/manipulation
function get(s,c) {
    try {
        return (c||document).querySelector(s);
    } catch (err) {
        return null;
    }
}

function buildItem (elem, content) {
    var elem = elem.cloneNode();
    elem.innerHTML = content;
    return elem;
}

var getFieldLabel = require('./validate').getFieldLabel;

function createFilterItem (hash) {
    var self = this;

    var item = buildItem(self.domRefs.listItem, self.domRefs.listItemContent);

    var checkbox = get(self.config.ui.item.onoff, item);
    var field = get(self.config.ui.item.field, item);
    var operator = get(self.config.ui.item.operator, item);
    var value = get(self.config.ui.item.value, item);
    var edit = get(self.config.ui.item.edit, item);
    var rm = get(self.config.ui.item.remove, item);

    // enable/disable filter
    if (self.filters[hash].disabled) {
        item.setAttribute('class', 'disabled');
        if (checkbox) {
            checkbox.removeAttribute('checked');
        }
    }

    // hide filter item
    if (self.filters[hash].hidden) {
        item.style.display = 'none';
    }

    // set content
    if (field) {
        field.innerHTML = getFieldLabel.call(self, self.filters[hash].field);
    }
    
    if (operator) {
        var myOperator = self.filters[hash].operator;
        operator.innerHTML = self.config.i18n[myOperator] || myOperator;
    }
    
    if (value) {
        var myValue = self.filters[hash].value === undefined ? '' : (typeof self.filters[hash].originalValue === 'string' ? self.filters[hash].originalValue : self.filters[hash].value);
        value.innerHTML = self.config.i18n[myValue] || myValue;
    }

    // hide edit if it's a core field
    if (edit && self.filters[hash].field[0] === '_') {
        edit.style.display = 'none';
    }
{'fraction_non_alphanumeric': 0.14726720647773278, 'fraction_numerical': 0.0015182186234817814, 'mean_word_length': 2.743371212121212, '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': '2661189', 'n_tokens_mistral': 1229, 'n_tokens_neox': 1209, 'n_words': 259}