<commit_before>'use strict';

/**
 * @ngdoc overview
 * @name dresdenjsApp
 * @description
 * # dresdenjsApp
 *
 * activate current tab on scroll.
 */
angular
    .module('dresdenjsApp')
    .directive('scrollUpdateTabs', function ($rootScope, $window, $timeout, $log) {
        return {
            restrict: 'A',
            require: '^mdTabs',
            link: function (scope, element, attrs, tabsCtrl) {
                angular.element($window).bind('scroll', function () {
                    // prevent directive to pull in when
                    // scrolling is animated by click action
                    if (!$rootScope.scrolledByClick) {
                        var currentIndex = tabsCtrl.selectedIndex,
                            nextIndex = currentIndex,
                            offsetTop = $window.scrollY,
                            sectionElements = document.querySelectorAll('section.linked'),
                            offsets = [],
                            closest = 0;

                        // collect offsets of sections
                        angular.forEach(sectionElements, function (section) {
                            //offsets.push(section.offsetTop + section.getBoundingClientRect().height / 2);
                            offsets.push(section.offsetTop);
                        });

                        // find closest section to current viewport
                        closest = offsets.reduce(function (prev, curr) {
                            return (Math.abs(curr - offsetTop) < Math.abs(prev - offsetTop) ? curr : prev);
                        });
                        nextIndex = offsets.indexOf(closest);

                        // update tabs and ink bar color
                        if (currentIndex != nextIndex) {
                            $timeout(function () {<commit_msg>fixed directive with strict operators<commit_after>'use strict';

/**
 * @ngdoc overview
 * @name dresdenjsApp
 * @description
 * # dresdenjsApp
 *
 * activate current tab on scroll.
 */
angular
    .module('dresdenjsApp')
    .directive('scrollUpdateTabs', function ($rootScope, $window, $timeout) {
        return {
            restrict: 'A',
            require: '^mdTabs',
            link: function (scope, element, attrs, tabsCtrl) {
                angular.element($window).bind('scroll', function () {
                    // prevent directive to pull in when
                    // scrolling is animated by click action
                    if (!$rootScope.scrolledByClick) {
                        var currentIndex = tabsCtrl.selectedIndex,
                            nextIndex = currentIndex,
                            offsetTop = $window.scrollY,
                            sectionElements = document.querySelectorAll('section.linked'),
                            offsets = [],
                            closest = 0;

                        // collect offsets of sections
                        angular.forEach(sectionElements, function (section) {
                            //offsets.push(section.offsetTop + section.getBoundingClientRect().height / 2);
                            offsets.push(section.offsetTop);
                        });

                        // find closest section to current viewport
                        closest = offsets.reduce(function (prev, curr) {
                            return (Math.abs(curr - offsetTop) < Math.abs(prev - offsetTop) ? curr : prev);
                        });
                        nextIndex = offsets.indexOf(closest);

                        // update tabs and ink bar color
                        if (currentIndex !== nextIndex) {
                            $timeout(function () {
{'fraction_non_alphanumeric': 0.0942281879194631, 'fraction_numerical': 0.0010738255033557046, 'mean_word_length': 1.2886977886977886, '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': '7654708', 'n_tokens_mistral': 853, 'n_tokens_neox': 813, 'n_words': 203}