<commit_before>// Hide all hideable fields
$(".hideable").hide();

function setup_fieldset(node) {
    filter_name = $(node).find(".field_filter select").val();
    $(node).find(".hideable").hide();
    $(node).find(".filter_field_" + filter_name).show();
}

// Add triggers to hide/show fields based on filter
$("#filter-form fieldset").each(function (index) {
    var filter_node = this;
    setup_fieldset(filter_node);
    $(filter_node).find(".field_filter select").on("change", function () {
        setup_fieldset(filter_node);
    })
});
<commit_msg>Generalise field enable/disable filter.<commit_after>// Hide all hideable fields
$(".hideable").hide();

var field_types = "input,select";

function setup_fieldset(node) {
    filter_name = $(node).find(".field_filter select").val();
    filter_class = ".filter_field_" + filter_name;
    $(node).find(".hideable").hide();
    $(node).find(".hideable").find(field_types).prop("disabled", true);
    $(node).find(filter_class).show();
    $(node).find(filter_class).find(field_types).prop("disabled", false);
}

// Add triggers to hide/show fields based on filter
$("#filter-form fieldset").each(function (index) {
    var filter_node = this;
    setup_fieldset(filter_node);
    $(filter_node).find(".field_filter select").on("change", function () {
        setup_fieldset(filter_node);
    })
});

{'fraction_non_alphanumeric': 0.1873156342182891, 'fraction_numerical': 0.0, 'mean_word_length': 4.584362139917696, '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': '3586806', 'n_tokens_mistral': 419, 'n_tokens_neox': 414, 'n_words': 78}