<commit_before>'use strict';
/**
 * The chat window.
 * Parent scope must have $scope.selectedChat. (TODO refactor)
 */
exports = module.exports = [
    '$rootScope',
    '$timeout',
    function ($rootScope, $timeout) {
        return {
            scope: false,
            link: function (scope, element, attrs) {
                $rootScope.autoScrollDisabled = false;

                var apOnscrolltop = attrs.apOnscrolltop
                    ? scope.$eval(attrs.apOnscrolltop)
                    : function (data) { };

                // load previous elements
                element.on('scroll', function (evt) {
                    if (evt.target.scrollTop === 0) {
                        apOnscrolltop();
                    }
                    // scroll automatically when close to the bottom of the chat window.
                    var bottomTopDiffSmall = evt.target.scrollHeight - evt.target.scrollTop < 500;
                    if (bottomTopDiffSmall) {
                        $rootScope.autoScrollDisabled = false;
                    }
                    else {
                        $rootScope.autoScrollDisabled = true;
                    }
                    console.log('autoscrollDisabled', evt.target.scrollHeight,
                        evt.target.scrollTop, $rootScope.autoScrollDisabled);
                });
            },
            controller: 'ChatController'
        };
    }
];
<commit_msg>removed console<commit_after>'use strict';
/**
 * The chat window.
 * Parent scope must have $scope.selectedChat. (TODO refactor)
 */
exports = module.exports = [
    '$rootScope',
    '$timeout',
    function ($rootScope, $timeout) {
        return {
            scope: false,
            link: function (scope, element, attrs) {
                $rootScope.autoScrollDisabled = false;

                var apOnscrolltop = attrs.apOnscrolltop
                    ? scope.$eval(attrs.apOnscrolltop)
                    : function (data) { };

                // load previous elements
                element.on('scroll', function (evt) {
                    if (evt.target.scrollTop === 0) {
                        apOnscrolltop();
                    }
                    // scroll automatically when close to the bottom of the chat window.
                    var bottomTopDiffSmall = evt.target.scrollHeight - evt.target.scrollTop < 500;
                    if (bottomTopDiffSmall) {
                        $rootScope.autoScrollDisabled = false;
                    }
                    else {
                        $rootScope.autoScrollDisabled = true;
                    }
                });
            },
            controller: 'ChatController'
        };
    }
];

{'fraction_non_alphanumeric': 0.09679793890320205, 'fraction_numerical': 0.002944423997055576, 'mean_word_length': 1.2802013422818792, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1662501', 'n_tokens_mistral': 667, 'n_tokens_neox': 631, 'n_words': 145}