<commit_before>import { Meteor } from 'meteor/meteor';

export class TopicFilterConfig {

    /**
     * @callback TopicFilterCallback
     * @param {string} searchQuery
     */

    /**
     * Constructor to create a config object
     * for the Topic-Filter-UI-Component.
     *
     * @param {TopicFilterCallback} callback - The callback triggered after the search query has changed
     */
    constructor(callback) {
        this.callback = callback;
    }
}

const MATCH_CASE = 'do:match-case ';

let toggleMatchCase = function (enable, input) {
    if (enable) {
        input.value = MATCH_CASE + input.value;
    } else {
        if (input.value.indexOf(MATCH_CASE) === -1) {
            input.value = input.value.replace(MATCH_CASE.substr(0, MATCH_CASE.length-1), '');
        } else {
            input.value = input.value.replace(MATCH_CASE, '');
        }
    }
};

Template.topicFilter.onCreated(function() {
    this.callback = this.data.config.callback;
});

Template.topicFilter.helpers({

});

Template.topicFilter.events({
    'keyup #inputFilter': function(evt, tmpl) {
        evt.preventDefault();
        let query = tmpl.find('#inputFilter').value;
        Template.instance().callback(query);

        let caseSensitive = (query.indexOf(MATCH_CASE.substr(0, MATCH_CASE.length-1)) !== -1);
        tmpl.$('#cbCaseSensitiveFilter').prop("checked", caseSensitive);
    },

    'change #cbCaseSensitiveFilter': function(evt, tmpl) {
        evt.preventDefault();
        let input = tmpl.find('#inputFilter');
        toggleMatchCase(evt.target.checked, input);
        Template.instance().callback(input.value);
    }
});<commit_msg>Item filter: Request focus after selecting 'match-case'-Checkbox<commit_after>import { Meteor } from 'meteor/meteor';

export class TopicFilterConfig {

    /**
     * @callback TopicFilterCallback
     * @param {string} searchQuery
     */

    /**
     * Constructor to create a config object
     * for the Topic-Filter-UI-Component.
     *
     * @param {TopicFilterCallback} callback - The callback triggered after the search query has changed
     */
    constructor(callback) {
        this.callback = callback;
    }
}

const MATCH_CASE = 'do:match-case ';

let toggleMatchCase = function (enable, input) {
    if (enable) {
        input.value = MATCH_CASE + input.value;
    } else {
        if (input.value.indexOf(MATCH_CASE) === -1) {
            input.value = input.value.replace(MATCH_CASE.substr(0, MATCH_CASE.length-1), '');
        } else {
            input.value = input.value.replace(MATCH_CASE, '');
        }
    }
};

Template.topicFilter.onCreated(function() {
    this.callback = this.data.config.callback;
});

Template.topicFilter.helpers({

});

Template.topicFilter.events({
    'keyup #inputFilter': function(evt, tmpl) {
        evt.preventDefault();
        let query = tmpl.find('#inputFilter').value;
        Template.instance().callback(query);

        let caseSensitive = (query.indexOf(MATCH_CASE.substr(0, MATCH_CASE.length-1)) !== -1);
        tmpl.$('#cbCaseSensitiveFilter').prop("checked", caseSensitive);
    },

    'change #cbCaseSensitiveFilter': function(evt, tmpl) {
        evt.preventDefault();
        let input = tmpl.find('#inputFilter');
        toggleMatchCase(evt.target.checked, input);
        Template.instance().callback(input.value);
        input.focus();
    }
});
{'fraction_non_alphanumeric': 0.141548463356974, 'fraction_numerical': 0.0035460992907801418, 'mean_word_length': 2.8422247446083997, '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': '6067683', 'n_tokens_mistral': 1023, 'n_tokens_neox': 1015, 'n_words': 189}