<commit_before>'use strict';

app.controller('RootCtrl', ['$scope', '$compile', '$window', '$http', 
               'localStorageService', 
               function($scope, $compile, $window, $http, localStorageService) {
    $scope.currentModal = 'none';

    $scope.loadScript = function(src) {
        (function() { 
            var script  = document.createElement("script")
            script.type = "text/javascript";
            script.src  = src;
            script.async = true;
            var x = document.getElementsByTagName('script')[0];
            x.parentNode.insertBefore(script, x);
        })();
    };
    $scope.loadShareScripts = function() {
        if (!$window.twttr) {
            // inject twitter share widget script
            $scope.loadScript('//platform.twitter.com/widgets.js');
            // load FB share script
            $scope.loadScript('//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.0');
        }
    };

    $scope.showModal = function(val) {
        if (val == 'welcome') {
            $scope.loadShareScripts();
        }

        $scope.currentModal = val;
    };

    $scope.lanternWelcomeKey = localStorageService.get('lanternWelcomeKey');

    $scope.closeModal = function() {

        // if it's our first time opening the UI,
        // show the settings modal first immediately followed by
        // the welcome screen
        if ($scope.currentModal == 'settings' && !$scope.lanternWelcomeKey) {
            if (!$scope.lanternWelcomeKey) {
                $scope.showModal('welcome');
                localStorageService.set('lanternWelcomeKey', true);
            }
        } else {
            $scope.currentModal = 'none';
        }
    };

    if (!$scope.lanternWelcomeKey) {
        $scope.showModal('settings');
    };


}]);

app.controller('UpdateAvailableCtrl', ['$scope', 'MODAL', function($scope, MODAL) {
  $scope.show = false;
  $scope.$watch('model.modal', function (modal) {
    $scope.show = modal === MODAL.updateAvailable;
  });
}]);

app.controller('ContactCtrl', ['$scope', 'MODAL', function($scope, MODAL) {
  $scope.show = false;
  $scope.notify = true; // so the view's interactionWithNotify calls include $scope.message and $scope.diagnosticInfo
  $scope.$watch('model.modal', function (modal) {
    $scope.show = modal === MODAL.contact;
    $scope.resetContactForm($scope);
  });
}]);

app.controller('ConfirmResetCtrl', ['$scope', 'MODAL', function($scope, MODAL) {
  $scope.show = false;
  $scope.$watch('model.modal', function (modal) {
    $scope.show = modal === MODAL.confirmReset;
  });
}]);

app.controller('SettingsCtrl', ['$scope', 'MODAL', 'DataStream', 'gaMgr', function($scope, MODAL, DataStream, gaMgr) {
  $scope.show = false;

  $scope.$watch('model.modal', function (modal) {
    $scope.show = modal === MODAL.settings;
  });

  $scope.$watch('model.settings.autoReport', function(autoreport) {
      if (!autoreport) {
        autoreport = false;
      }
      var obj = {
        autoReport: autoreport
      };
      DataStream.send('Settings', obj);

      if (autoreport) {
        gaMgr.startTracking();
      }
  });

  $scope.$watch('model.settings.runAtSystemStart', function (runAtSystemStart) {
    $scope.runAtSystemStart = runAtSystemStart;
  });

  $scope.$watch('model.settings.systemProxy', function (systemProxy) {
    $scope.systemProxy = systemProxy;
  });

  $scope.$watch('model.settings.proxyAllSites', function (proxyAllSites) {<commit_msg>default auto report to true<commit_after>'use strict';

app.controller('RootCtrl', ['$scope', '$compile', '$window', '$http', 
               'localStorageService', 
               function($scope, $compile, $window, $http, localStorageService) {
    $scope.currentModal = 'none';

    $scope.loadScript = function(src) {
        (function() { 
            var script  = document.createElement("script")
            script.type = "text/javascript";
            script.src  = src;
            script.async = true;
            var x = document.getElementsByTagName('script')[0];
            x.parentNode.insertBefore(script, x);
        })();
    };
    $scope.loadShareScripts = function() {
        if (!$window.twttr) {
            // inject twitter share widget script
            $scope.loadScript('//platform.twitter.com/widgets.js');
            // load FB share script
            $scope.loadScript('//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.0');
        }
    };

    $scope.showModal = function(val) {
        if (val == 'welcome') {
            $scope.loadShareScripts();
        }

        $scope.currentModal = val;
    };

    $scope.lanternWelcomeKey = localStorageService.get('lanternWelcomeKey');

    $scope.closeModal = function() {

        // if it's our first time opening the UI,
        // show the settings modal first immediately followed by
        // the welcome screen
        if ($scope.currentModal == 'settings' && !$scope.lanternWelcomeKey) {
            if (!$scope.lanternWelcomeKey) {
                $scope.showModal('welcome');
                localStorageService.set('lanternWelcomeKey', true);
            }
        } else {
            $scope.currentModal = 'none';
        }
    };

    if (!$scope.lanternWelcomeKey) {
        $scope.showModal('settings');
    };


}]);

app.controller('UpdateAvailableCtrl', ['$scope', 'MODAL', function($scope, MODAL) {
  $scope.show = false;
  $scope.$watch('model.modal', function (modal) {
    $scope.show = modal === MODAL.updateAvailable;
  });
}]);

app.controller('ContactCtrl', ['$scope', 'MODAL', function($scope, MODAL) {
  $scope.show = false;
  $scope.notify = true; // so the view's interactionWithNotify calls include $scope.message and $scope.diagnosticInfo
  $scope.$watch('model.modal', function (modal) {
    $scope.show = modal === MODAL.contact;
    $scope.resetContactForm($scope);
  });
}]);

app.controller('ConfirmResetCtrl', ['$scope', 'MODAL', function($scope, MODAL) {
  $scope.show = false;
  $scope.$watch('model.modal', function (modal) {
    $scope.show = modal === MODAL.confirmReset;
  });
}]);

app.controller('SettingsCtrl', ['$scope', 'MODAL', 'DataStream', 'gaMgr', function($scope, MODAL, DataStream, gaMgr) {
  $scope.show = false;

  $scope.$watch('model.modal', function (modal) {
    $scope.show = modal === MODAL.settings;
  });

  $scope.$watch('model.settings.autoReport', function(autoreport) {
      if (!autoreport) {
        autoreport = false;
      }
      var obj = {
        autoReport: autoreport
      };
      DataStream.send('Settings', obj);

      if (autoreport) {
        gaMgr.startTracking();
      }
  });

  $scope.$watch('model.settings.systemProxy', function (systemProxy) {
    $scope.systemProxy = systemProxy;
  });

  $scope.$watch('model.settings.proxyAllSites', function (proxyAllSites) {
{'fraction_non_alphanumeric': 0.1633939038686987, 'fraction_numerical': 0.0011723329425556857, 'mean_word_length': 2.7132752992383025, 'pattern_counts': {'":': 0, '<': 3, '<?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': '5560989', 'n_tokens_mistral': 2070, 'n_tokens_neox': 2022, 'n_words': 377}