<commit_before>var OpenEyes = OpenEyes || {};

OpenEyes.OphCiExamination = OpenEyes.OphCiExamination || {};

OpenEyes.OphCiExamination.AutoReportHandler = (function () {
    function AutoReportHandler(_drawing, options)
    {
        this.drawing = _drawing;
        this.options = $.extend(true, {}, AutoReportHandler._defaultOptions, options);
        this.initialise();
    }

    AutoReportHandler._defaultOptions = {
        containerSelector: '.ed-widget:first'
    };

    AutoReportHandler.prototype.initialise = function()
    {
        this.drawing.registerForNotifications(this, 'drawingNotifications');
        this.$container = $(this.drawing.canvas).parents(this.options.containerSelector);
        this.$edReportField = this.$container.find("input[id$='" + this.options.side + "_ed_report']");
        this.$edReportDisplay = this.$container.find("span[id$='" + this.options.side + "_ed_report_display']");

        this.updateReport();
    };

    AutoReportHandler.prototype.updateReport = function()
    {
        var markup = this.$edReportField.val().replace(/\n/g,'<br />');
        markup = markup.replace('<br />', ''); // remove first <br>
        this.$edReportDisplay.html(markup);
    };

    AutoReportHandler.prototype.drawingNotifications = function(msgArray)
    {
        this.updateReport();
    };

    return AutoReportHandler;
})();


function autoReportListener(_drawing)
{
    var canvas = $(_drawing.canvas);
    var controller = canvas.data('controller');
    if (!controller) {
        controller = new OpenEyes.OphCiExamination.AutoReportHandler(
            _drawing,
            {side: (_drawing.eye === 1 ? 'left' : 'right')}
        );
        canvas.data('controller', controller);
    }

}
<commit_msg>[OE-6461] timeout on autoreporting to work with tweaks to eyedraw<commit_after>var OpenEyes = OpenEyes || {};

OpenEyes.OphCiExamination = OpenEyes.OphCiExamination || {};

OpenEyes.OphCiExamination.AutoReportHandler = (function () {
    function AutoReportHandler(_drawing, options)
    {
        this.drawing = _drawing;
        this.options = $.extend(true, {}, AutoReportHandler._defaultOptions, options);
        this.initialise();
    }

    AutoReportHandler._defaultOptions = {
        containerSelector: '.ed-widget:first'
    };

    AutoReportHandler.prototype.initialise = function()
    {
        this.drawing.registerForNotifications(this, 'drawingNotifications');
        this.$container = $(this.drawing.canvas).parents(this.options.containerSelector);
        this.$edReportField = this.$container.find("input[id$='" + this.options.side + "_ed_report']");
        this.$edReportDisplay = this.$container.find("span[id$='" + this.options.side + "_ed_report_display']");

        this.updateReport();
    };

    AutoReportHandler.prototype.updateReport = function()
    {
        var markup = this.$edReportField.val().replace(/\n/g,'<br />');
        markup = markup.replace('^<br />', ''); // remove first <br>
        this.$edReportDisplay.html(markup);
    };

    AutoReportHandler.prototype.drawingNotifications = function(msgArray)
    {
        clearTimeout(this.updateTimer);
        this.updateTimer = setTimeout(function() {
            this.updateReport();
        }.bind(this), 300);
    };

    return AutoReportHandler;
})();


function autoReportListener(_drawing)
{
    var canvas = $(_drawing.canvas);
    var controller = canvas.data('controller');
    if (!controller) {
        controller = new OpenEyes.OphCiExamination.AutoReportHandler(
            _drawing,
            {side: (_drawing.eye === 1 ? 'left' : 'right')}
        );
        canvas.data('controller', controller);
    }

}

{'fraction_non_alphanumeric': 0.14662676822633297, 'fraction_numerical': 0.0024483133841131663, 'mean_word_length': 3.14543404735062, 'pattern_counts': {'":': 0, '<': 9, '<?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': '3224936', 'n_tokens_mistral': 1101, 'n_tokens_neox': 1061, 'n_words': 158}