<commit_before>function initializeTextEditors() {
    console.log("initializeTextEditors");

    jQuery("input[type='text'], textarea").each(function() {
        if (jQuery(this).hasClass('rteInitialized') || jQuery(this).parent().parent().attr('class') == "login_popup_box") {
            return;
        }

        var tmp = this;
        var thiz = jQuery(this);

        var limitCharactersMax = thiz.parent().find(".limit_charactersMax");
        var limitCharacterCount = thiz.parent().find(".limit_characterCount");

        if (limitCharactersMax.length > 0) {
            thiz.attr({maxCharacters: limitCharactersMax.text(), validateLength: true});
            this.limitCharacterCounter = limitCharacterCount;
            updateCharacterCounter(thiz);
        } else {
            thiz.attr({validateLength: false});
        }

        if (thiz.hasClass("ckeditor_placeholder")) {

            var editor = CKEDITOR.replace(thiz.attr("id"));

            thiz.get(0)["ckeditor"] = editor;
            editor.updatedCharCount = false;

            function updateEditorCharCount() {
                try{
                    if (editor == null) return;

                    if (editor &&  editor.document && editor.document['$'] && (editor.checkDirty() || editor.updatedCharCount)) {
                        markEditorDirty(thiz);
                        updateCharacterCounter(thiz, editor);
                        editor.updatedCharCount = true;
                        editor.resetDirty();
                    }

                    setTimeout(updateEditorCharCount, 1000);
                } catch (e) {
                    if (typeof(console) != 'undefined' && typeof(console.log) != 'undefined') {
                        console.log(e);
                    }
                }
            }
            if (! jQuery.browser.ie || jQuery.browser.version.number >= 9) {
                updateEditorCharCount();
            }

            editor.on("blur", function() {
                updateCharacterCounter(thiz, editor);
            });

            // initiate char counters
            setTimeout(function() { updateCharacterCounter(thiz, editor); }, 2000);
        }
        else {
            eventsToBind = {
                keypress: function(event) {
                    if (thiz.attr('validateLength') && tmp.limitCharacterCounter) {
                        updateCharacterCounter(thiz);
                    }
                },
                keyup: function(event) {
                    if (thiz.attr('validateLength') && tmp.limitCharacterCounter) {
                        updateCharacterCounter(thiz);
                    }
                },
                change: function(event) {
                    console.log("asdfasdfasdfasdfasdfasfd");
                    markEditorDirty(thiz);
                }
            };
            thiz.bind(eventsToBind);
        }
        jQuery(this).addClass('rteInitialized');
    });
}

function initializeDropDowns() {
    jQuery("select").each(function() {
        eventsToBind = {
            change: function(event) {
                markEditorDirty(jQuery(jQuery("input[type='text'], textarea")[0]));
            }
        };
        jQuery(this).bind(eventsToBind);
    });
}

function markEditorDirty(editor) {
    editor.addClass('editorDirty');<commit_msg>Removed orphaned log message<commit_after>function initializeTextEditors() {
    console.log("initializeTextEditors");

    jQuery("input[type='text'], textarea").each(function() {
        if (jQuery(this).hasClass('rteInitialized') || jQuery(this).parent().parent().attr('class') == "login_popup_box") {
            return;
        }

        var tmp = this;
        var thiz = jQuery(this);

        var limitCharactersMax = thiz.parent().find(".limit_charactersMax");
        var limitCharacterCount = thiz.parent().find(".limit_characterCount");

        if (limitCharactersMax.length > 0) {
            thiz.attr({maxCharacters: limitCharactersMax.text(), validateLength: true});
            this.limitCharacterCounter = limitCharacterCount;
            updateCharacterCounter(thiz);
        } else {
            thiz.attr({validateLength: false});
        }

        if (thiz.hasClass("ckeditor_placeholder")) {

            var editor = CKEDITOR.replace(thiz.attr("id"));

            thiz.get(0)["ckeditor"] = editor;
            editor.updatedCharCount = false;

            function updateEditorCharCount() {
                try{
                    if (editor == null) return;

                    if (editor &&  editor.document && editor.document['$'] && (editor.checkDirty() || editor.updatedCharCount)) {
                        markEditorDirty(thiz);
                        updateCharacterCounter(thiz, editor);
                        editor.updatedCharCount = true;
                        editor.resetDirty();
                    }

                    setTimeout(updateEditorCharCount, 1000);
                } catch (e) {
                    if (typeof(console) != 'undefined' && typeof(console.log) != 'undefined') {
                        console.log(e);
                    }
                }
            }
            if (! jQuery.browser.ie || jQuery.browser.version.number >= 9) {
                updateEditorCharCount();
            }

            editor.on("blur", function() {
                updateCharacterCounter(thiz, editor);
            });

            // initiate char counters
            setTimeout(function() { updateCharacterCounter(thiz, editor); }, 2000);
        }
        else {
            eventsToBind = {
                keypress: function(event) {
                    if (thiz.attr('validateLength') && tmp.limitCharacterCounter) {
                        updateCharacterCounter(thiz);
                    }
                },
                keyup: function(event) {
                    if (thiz.attr('validateLength') && tmp.limitCharacterCounter) {
                        updateCharacterCounter(thiz);
                    }
                },
                change: function(event) {
                    markEditorDirty(thiz);
                }
            };
            thiz.bind(eventsToBind);
        }
        jQuery(this).addClass('rteInitialized');
    });
}

function initializeDropDowns() {
    jQuery("select").each(function() {
        eventsToBind = {
            change: function(event) {
                markEditorDirty(jQuery(jQuery("input[type='text'], textarea")[0]));
            }
        };
        jQuery(this).bind(eventsToBind);
    });
}

function markEditorDirty(editor) {
    editor.addClass('editorDirty');
{'fraction_non_alphanumeric': 0.12345306368849984, 'fraction_numerical': 0.003622094778146695, 'mean_word_length': 1.6214398734177216, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '1367868', 'n_tokens_mistral': 1709, 'n_tokens_neox': 1602, 'n_words': 243}