<commit_before>// Ionic Starter App

// angular.module is a global place for creating, registering and retrieving Angular modules
// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html)
// the 2nd parameter is an array of 'requires'
// 'starter.services' is found in services.js
// 'starter.controllers' is found in controllers.js
angular.module('app', ['ionic', 'ngWebSocket', 'LocalStorageModule'])

.run(function($ionicPlatform) {
    $ionicPlatform.ready(function() {
        // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
        // for form inputs)
        if (window.cordova && window.cordova.plugins.Keyboard) {
            cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
        }
        if (window.StatusBar) {
            // org.apache.cordova.statusbar required
            StatusBar.styleDefault();
        }
    });
})

.config(function($stateProvider, $urlRouterProvider) {

    // Ionic uses AngularUI Router which uses the concept of states
    // Learn more here: https://github.com/angular-ui/ui-router
    // Set up the various states which the app can be in.
    // Each state's controller can be found in controllers.js
    $stateProvider

        .state('app', {
        url: "/app",
        abstract: true,
        templateUrl: "templates/menu.html",
        controller: 'AppCtrl'
    })

    .state('app.capture', {
        cache: false,
        url: "/capture",
        views: {
            'menuContent': {
                templateUrl: "templates/capture.html"
            }
        }
    })

    .state('app.timelapse', {
        cache: false,
        url: "/timelapse",
        views: {
            'menuContent': {
                templateUrl: "templates/timelapse.html"
            }
        }
    })

    .state('app.view', {
        cache: false,
        url: "/view",
        views: {
            'menuContent': {
                templateUrl: "templates/view.html"
            }
        }
    })

    // if none of the above states are matched, use this as the fallback

    $urlRouterProvider.otherwise('/app/capture');


})

.controller('AppCtrl', ['$scope', '$timeout', '$http', '$websocket', '$location', '$ionicPopup', '$ionicActionSheet', '$interval', '$ionicModal', '$state', 'localStorageService', '$ionicHistory', function($scope, $timeout, $http, $websocket, $location, $ionicPopup, $ionicActionSheet, $interval, $ionicModal, $state, localStorageService, $ionicHistory) {
    console.log("AppCtrl");

    $scope.moment = moment;

    $scope.sid = localStorageService.get('sid');
    console.log("current sid: ", $scope.sid);

    $scope.secondsDescription = function(seconds, index) {
        var hours = Math.floor(seconds / 3600);
        seconds -= (hours * 3600);
        var minutes = Math.floor(seconds / 60);
        seconds -= (minutes * 60);
        var seconds = Math.round(seconds);

        var time = "";

        if (hours > 0) time += hours + 'h ';
        if (minutes > 0) time += minutes + 'm ';
        if (hours == 0 && minutes < 10) time += seconds + 's ';

        if (index > 1) {
            time += "from last keyframe";
        } else {
            time += "from start";
        }

        return time;
    }

    var previousState = localStorageService.get('state');
    if(previousState != null && typeof previousState == "string" && previousState.match(/^app\./)) {
        console.log("starting at " + previousState);
        $ionicHistory.nextViewOptions({
            disableBack: true,
            disableAnimate: true,
            historyRoot: true
        });
        $ionicHistory.clearCache();
        $ionicHistory.clearHistory();
        $state.go(previousState, {}, {location: "replace", reload: false});
    }

    $scope.$on('$stateChangeSuccess', function(event, toState, toParams, fromState, fromParams) {
        console.log("new state:", toState);
        localStorageService.set('state', toState.name);
        if (toState.name == "app.view") {<commit_msg>updated ionic lib<commit_after>// Ionic Starter App

// angular.module is a global place for creating, registering and retrieving Angular modules
// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html)
// the 2nd parameter is an array of 'requires'
// 'starter.services' is found in services.js
// 'starter.controllers' is found in controllers.js
angular.module('app', ['ionic', 'ngWebSocket', 'LocalStorageModule'])

.run(function($ionicPlatform) {
    $ionicPlatform.ready(function() {
        // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
        // for form inputs)
        if (window.cordova && window.cordova.plugins.Keyboard) {
            cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
        }
        if (window.StatusBar) {
            // org.apache.cordova.statusbar required
            StatusBar.styleDefault();
        }
    });
})

.config(function($stateProvider, $urlRouterProvider) {

    // Ionic uses AngularUI Router which uses the concept of states
    // Learn more here: https://github.com/angular-ui/ui-router
    // Set up the various states which the app can be in.
    // Each state's controller can be found in controllers.js
    $stateProvider

        .state('app', {
        url: "/app",
        abstract: true,
        templateUrl: "templates/menu.html",
        controller: 'AppCtrl'
    })

    .state('app.capture', {
        cache: false,
        url: "/capture",
        views: {
            'menuContent': {
                templateUrl: "templates/capture.html"
            }
        }
    })

    .state('app.timelapse', {
        cache: false,
        url: "/timelapse",
        views: {
            'menuContent': {
                templateUrl: "templates/timelapse.html"
            }
        }
    })

    .state('app.view', {
        cache: false,
        url: "/view",
        views: {
            'menuContent': {
                templateUrl: "templates/view.html"
            }
        }
    })

    // if none of the above states are matched, use this as the fallback

    $urlRouterProvider.otherwise('/app/capture');


})

.controller('AppCtrl', ['$scope', '$timeout', '$http', '$websocket', '$location', '$ionicPopup', '$ionicActionSheet', '$interval', '$ionicModal', '$state', 'localStorageService', '$ionicHistory', function($scope, $timeout, $http, $websocket, $location, $ionicPopup, $ionicActionSheet, $interval, $ionicModal, $state, localStorageService, $ionicHistory) {
    console.log("AppCtrl");

    $scope.moment = moment;

    $scope.sid = localStorageService.get('sid');
    console.log("current sid: ", $scope.sid);

    $scope.secondsDescription = function(seconds, index) {
        var hours = Math.floor(seconds / 3600);
        seconds -= (hours * 3600);
        var minutes = Math.floor(seconds / 60);
        seconds -= (minutes * 60);
        var seconds = Math.round(seconds);

        var time = "";

        if (hours > 0) time += hours + 'h ';
        if (minutes > 0) time += minutes + 'm ';
        if (hours == 0 && minutes < 10) time += seconds + 's ';

        if (index > 1) {
            time += "from last keyframe";
        } else {
            time += "from start";
        }

        return time;
    }

    var previousState = localStorageService.get('state');
    if(previousState != null && typeof previousState == "string" && previousState.match(/^app\./)) {
        console.log("starting at " + previousState);
        $ionicHistory.nextViewOptions({
            disableBack: true,
            disableAnimate: true,
            historyRoot: true
        });
        $state.go(previousState);
        $ionicHistory.clearCache();
        $ionicHistory.clearHistory();
    }

    $scope.$on('$stateChangeSuccess', function(event, toState, toParams, fromState, fromParams) {
        console.log("new state:", toState);
        localStorageService.set('state', toState.name);
        if (toState.name == "app.view") {
{'fraction_non_alphanumeric': 0.13950892857142858, 'fraction_numerical': 0.004712301587301587, 'mean_word_length': 2.3354011579818033, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 2, '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': '883254', 'n_tokens_mistral': 2352, 'n_tokens_neox': 2211, 'n_words': 596}