<commit_before>angular.module('shopper', [
    'ngTouch',
    'ngAnimate',
    'angular-gestures',
    'angular-carousel',
    'templates-app',
    'templates-common',
    'ui.router',
    'ui.bootstrap',
    'shopper.auth',
    'shopper.home',
    'shopper.list'
])
.config(function myAppConfig($stateProvider, $urlRouterProvider, $httpProvider) {
    $urlRouterProvider.otherwise('/home');

    $httpProvider.defaults.useXDomain = true;
    delete $httpProvider.defaults.headers.common['X-Requested-With'];
})
.run(function run () {

})
.controller('AppCtrl', function($scope, $location, Session) {
    $scope.$on('$stateChangeSuccess', function(event, toState, toParams, fromState, fromParams){
        if (! Session.isLoggedIn()) {
            $location.path('/auth');
        }
    });

    $scope.logout = function() {
        if (confirm('Sure you want to log out?')) {
            Session.logout();
        }
    };
    
    $scope.bodyClicked = function() {
        $scope.$broadcast('bodyClicked');
    };

    if (typeof localStorage.user !== 'undefined') {
        Session.login(JSON.parse(localStorage.user));
        $location.path('/home');
    }
})
.service('Session', function($location) {
    var self = this;
    this.user = undefined;

    this.login = function(user) {
        self.user = user;
    };

    this.logout = function() {
        self.user = undefined;
        localStorage.removeItem('user');
        $location.path('/auth');
    };

    this.isLoggedIn = function() {
        return (self.user) ? true : false;
    };
})
.service('Api', function(Session) {
    this.url = '../api/';

    this.getParams = function() {
        var params = {};
        if (Session.user !== undefined) {
            params =  {
                email: Session.user.email,
                password: <PASSWORD>
            };
        }
        return params;
    };
})
.directive('myTap', function($timeout) {
    return function(scope, element, attrs) {
        element.bind('touchstart click', function(event) {
            event.preventDefault();
            event.stopPropagation();
            $timeout(function() {
                scope.$apply(attrs['myTap']);
            });
        });
    };
})
;<commit_msg>Use touchend instead of touchstart, because otherwise clicks get recognized before sliding for example<commit_after>angular.module('shopper', [
    'ngTouch',
    'ngAnimate',
    'angular-gestures',
    'angular-carousel',
    'templates-app',
    'templates-common',
    'ui.router',
    'ui.bootstrap',
    'shopper.auth',
    'shopper.home',
    'shopper.list'
])
.config(function myAppConfig($stateProvider, $urlRouterProvider, $httpProvider) {
    $urlRouterProvider.otherwise('/home');

    $httpProvider.defaults.useXDomain = true;
    delete $httpProvider.defaults.headers.common['X-Requested-With'];
})
.run(function run () {

})
.controller('AppCtrl', function($scope, $location, Session) {
    $scope.$on('$stateChangeSuccess', function(event, toState, toParams, fromState, fromParams){
        if (! Session.isLoggedIn()) {
            $location.path('/auth');
        }
    });

    $scope.logout = function() {
        if (confirm('Sure you want to log out?')) {
            Session.logout();
        }
    };
    
    $scope.bodyClicked = function() {
        $scope.$broadcast('bodyClicked');
    };

    if (typeof localStorage.user !== 'undefined') {
        Session.login(JSON.parse(localStorage.user));
        $location.path('/home');
    }
})
.service('Session', function($location) {
    var self = this;
    this.user = undefined;

    this.login = function(user) {
        self.user = user;
    };

    this.logout = function() {
        self.user = undefined;
        localStorage.removeItem('user');
        $location.path('/auth');
    };

    this.isLoggedIn = function() {
        return (self.user) ? true : false;
    };
})
.service('Api', function(Session) {
    this.url = '../api/';

    this.getParams = function() {
        var params = {};
        if (Session.user !== undefined) {
            params =  {
                email: Session.user.email,
                password: <PASSWORD>
            };
        }
        return params;
    };
})
.directive('myTap', function($timeout) {
    return function(scope, element, attrs) {
        element.bind('touchend click', function(event) {
            event.preventDefault();
            event.stopPropagation();
            $timeout(function() {
                scope.$apply(attrs['myTap']);
            });
        });
    };
})
;
{'fraction_non_alphanumeric': 0.16465157177401626, 'fraction_numerical': 0.0, 'mean_word_length': 2.3260233918128654, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '5236656', 'n_tokens_mistral': 1355, 'n_tokens_neox': 1342, 'n_words': 231}