<commit_before>define(['app', 'angular', 'text!./bch-footer.html', './bch-header',
        'bootstrap', 'routes/bch', 'ng-breadcrumbs','toastr','angular-animate', 
        'components/scbd-branding/directives/header/header',
        'components/scbd-branding/directives/footer'], function (app, angular, footerHtml) { 'use strict';

    app.directive('bchFooter', [function () { return { restrict: 'E', template: footerHtml }; }]);

    app.controller('BchTemplateController', ['$rootScope', '$location', '$window',
        function ($rootScope, $location, $window) {

            $rootScope.pageTitle = { text: "" };

            $rootScope.$on('$routeChangeSuccess', function () {
                $window.ga('set', 'page', basePath() + $location.path());
                $window.ga('send', 'pageview');
            });

            $rootScope.$on('signOut', function () {
                $window.location.reload();
            });

            //============================================================
            //
            //
            //============================================================
            function basePath() { 
                return (angular.element('base').attr('href') || '').replace(/\/+$/g, '');
            }

            //============================================================
            //
            //
            //============================================================
            function updateSize() {
                $rootScope.$applyAsync(function () {
                    $rootScope.deviceSize = $('.device-size:visible').attr('size');
                });
            }

            updateSize();
            
            angular.element($window).on('resize', updateSize);
            
        }
    ]);
    
    angular.bootstrap(document, [app.name]);
});
<commit_msg>add socketio notifications<commit_after>define(['app', 'angular', 'text!./bch-footer.html', './bch-header',
        'bootstrap', 'routes/bch', 'ng-breadcrumbs','toastr','angular-animate', 
        'components/scbd-branding/directives/header/header',
        'components/scbd-branding/directives/footer',
        'components/scbd-angularjs-services/services/locale'], function (app, angular, footerHtml) { 'use strict';

    app.directive('bchFooter', [function () { return { restrict: 'E', template: footerHtml }; }]);

    app.controller('BchTemplateController', ['$rootScope', '$location', '$window', '$scope', 'locale',
        function ($rootScope, $location, $window, $scope, locale) {

            $rootScope.pageTitle = { text: "" };

            $rootScope.$on('signOut', function () {
                $window.location.reload();
            });

            //============================================================
            //
            //
            //============================================================
            function basePath() { 
                return (angular.element('base').attr('href') || '').replace(/\/+$/g, '');
            }

            //============================================================
            //
            //
            //============================================================
            function updateSize() {
                $rootScope.$applyAsync(function () {
                    $rootScope.deviceSize = $('.device-size:visible').attr('size');
                });
            }

            updateSize();
            
            angular.element($window).on('resize', updateSize);


            //html body attributes lang
            $scope.lang = locale;
            //set default moment lang
            var lang = locale;
            if (lang == 'zh')
                lang = 'zh-cn'; //moment has two ZH, use ZH-CN
            moment.lang(lang);
            if (lang != 'en')
                require(['css!/app/css/translation.css']);
            if (lang == 'ar') {
                require(['css!https://cdn.cbd.int/bootstrap-rtl@3.3.4/dist/css/bootstrap-rtl.min.css']);
            }

            var basePath = (angular.element('base').attr('href') || '').replace(/\/+$/g, '');
            $rootScope.$on('$routeChangeSuccess', function () {
                $window.ga('set', 'page', basePath + $location.path());
                $window.ga('send', 'pageview');
            });

            $scope.$on('signOut', function (evt, data) {
                $window.location.reload();
            });
            $rootScope.$on('event:server-pushNotification', function (evt, pushNotification) {
                if (pushNotification.type == 'documentNotification') {
                    // toastr.info(data.message);
                    if (pushNotification.data && pushNotification.data.realm == appConfigService.currentRealm) {
                        localStorageService.remove('governmentFacets');
                        localStorageService.remove('searchFilters');
                    }
                }
            });
            
            //============================================================
            //
            //
            //============================================================
            $rootScope.$watch('user', _.debounce(function (user) {

                if (!user)
                    return;

                require(["https://www.cbd.int/app/js/slaask.js"], function (_slaask) {

                    if (user.isAuthenticated) {
                        _slaask.identify(user.name, {
                            'user-id': user.userID,
                            'name': user.name,
                            'email': user.email,
                        });

                        if (_slaask.initialized) {
                            if (_slaask.slaaskSendUserInfos)
                                _slaask.slaaskSendUserInfos();
                        }
                    }

                    if (!_slaask.initialized) {
                        _slaask.init('8b989bd6ee0cf49384761d4f86ddd945');
                        _slaask.initialized = true;
                    }
                });

            }, 1000));
        }
    ]);
    
    angular.bootstrap(document, [app.name]);
});

{'fraction_non_alphanumeric': 0.24189889825016203, 'fraction_numerical': 0.004374594944912508, 'mean_word_length': 1.6665226781857452, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 1, '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': '2929883', 'n_tokens_mistral': 1562, 'n_tokens_neox': 1454, 'n_words': 208}