<commit_before>(function($) {
    $.fn.maxChars = function(options) {
        console.log("init maxChars");
        var opts = $.extend({
            'max': 2000,
            'charsLeftString': 'Characters remaining: ',
            'validClass': 'valid-chars',
            'invalidClass': 'invalid-chars'
        }, options);
        var $this = $(this);
        var $container = $('<div />').addClass('validate-chars');
        var $charsLeftString = $('<span>')
                                .text(opts.charsLeftString)
                                .appendTo($container);
        var $charsLeft = $('<span />')
                          .addClass('chars-left-num')
                          .appendTo($container);
        //console.log($container);
        //GLOB = $container;
        $this.after($container);
        $this.on('change keyup', function() {
            var charCount = $this.val().length;
            var charsLeft = opts.max - charCount;
            $charsLeft.text(charsLeft.toString()); //FIXME: number format
            if (charCount <= opts.max) {
                if (!$container.hasClass(opts.validClass)) {
                    $container.removeClass(opts.invalidClass).addClass(opts.validClass);
                }
            } else {
                if (!$container.hasClass(opts.invalidClass)) {
                    $container.removeClass(opts.validClass).addClass(opts.invalidClass);
                }
            }
        });
        $this.change();
    };

})(jQuery);<commit_msg>minor, numberFormat in max chars validation<commit_after>(function($) {
    $.fn.maxChars = function(options) {
        console.log("init maxChars");
        var opts = $.extend({
            'max': 2000,
            'charsLeftString': 'Characters remaining: ',
            'validClass': 'valid-chars',
            'invalidClass': 'invalid-chars'
        }, options);
        var $this = $(this);
        var $container = $('<div />').addClass('validate-chars');
        var $charsLeftString = $('<span>')
                                .text(opts.charsLeftString)
                                .appendTo($container);
        var $charsLeft = $('<span />')
                          .addClass('chars-left-num')
                          .appendTo($container);
        //console.log($container);
        //GLOB = $container;
        $this.after($container);
        $this.on('change keyup', function() {
            var charCount = $this.val().length;
            var charsLeft = opts.max - charCount;
            $charsLeft.text(_.string.numberFormat(charsLeft));
            if (charCount <= opts.max) {
                if (!$container.hasClass(opts.validClass)) {
                    $container.removeClass(opts.invalidClass).addClass(opts.validClass);
                }
            } else {
                if (!$container.hasClass(opts.invalidClass)) {
                    $container.removeClass(opts.validClass).addClass(opts.invalidClass);
                }
            }
        });
        $this.change();
    };

})(jQuery);
{'fraction_non_alphanumeric': 0.15034392400917132, 'fraction_numerical': 0.0026203734032099572, 'mean_word_length': 1.583756345177665, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, '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': '813623', 'n_tokens_mistral': 802, 'n_tokens_neox': 773, 'n_words': 131}