<commit_before>var charsleft = function(source, maxlength) {
    if(source.val().length > maxlength) {
        source.val(source.val().substring(0, maxlength));
        return 0;
    }
    return maxlength - source.val().length;
};

(function ($) {
    "use strict";
    function add_charsleft_handlers() {
        $('div.charsleft').each(function () {
            var field = this.getAttribute('data-charsleft-field');
            var maxlength = this.getAttribute('data-maxlength');

            var $charsleftfield = $('textarea[name="' + field + '"]', this);

            $charsleftfield.keyup(function (e, data) {
                $(this).parent().find('.current').text(
                    charsleft($(this), maxlength));
            });

            $charsleftfield.change(function (e, data) {
                $(this).parent().find('.current').text(
                    charsleft($(this), maxlength));
            });
        });
    }
    $(function () {
        add_charsleft_handlers();
    });
}(jQuery || django.jQuery));
<commit_msg>small fixes<commit_after>var charsleft = function(source, maxlength) {
    if(source.val().length > maxlength) {
        source.val(source.val().substring(0, maxlength));
        return 0;
    }
    return maxlength - source.val().length;
};

(function ($) {
    "use strict";
    function add_charsleft_handlers() {
        $(".charsleft").each(function () {
            var field = this.getAttribute("data-charsleft-field");
            var maxlength = this.getAttribute("data-maxlength");

            var $charsleftfield = $("textarea[name='" + field + "']", this);

            $charsleftfield.keyup(function (e, data) {
                $(this).parent().find(".current").text(
                    charsleft($(this), maxlength));
            });

            $charsleftfield.change(function (e, data) {
                $(this).parent().find(".current").text(
                    charsleft($(this), maxlength));
            });
        });
    }
    $(function () {
        add_charsleft_handlers();
    });
}(jQuery || django.jQuery));

{'fraction_non_alphanumeric': 0.173621103117506, 'fraction_numerical': 0.0019184652278177458, 'mean_word_length': 2.1321321321321323, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '2365659', 'n_tokens_mistral': 599, 'n_tokens_neox': 575, 'n_words': 93}