<commit_before>
function SimpleSendController($scope, userService) {
  var wallet = userService.getWallet();

  MySimpleSendHelpers(wallet);

}
function HomeCtrl($scope, $templateCache, $injector, $location, $http, $q) {
  if ($injector.get('userService').getUUID()) {
    $location.url('/wallet/overview');
  } else {
    //DEV ONLY
    console.log('cleared cache');
    $templateCache.removeAll();

    $scope.balanceAddress = "";
    $scope.hasBalances = false;
    $scope.total = 0;
    $scope.validate = function(address) {
     //console.log('checking '+address);
      return Bitcoin.Address.validate(address);
    };
    $scope.checkBalance = function() {
      var balances = {};
      var appraiser = $injector.get('appraiser');
      $injector.get('balanceService').balance($scope.balanceAddress).then(function(result) {
        result.data.balance.forEach(function(currencyItem) {
          if(currencyItem.divisible)
            var value=new Big(currencyItem.value).times(WHOLE_UNIT).valueOf();
          balances[currencyItem.symbol] = {
            "symbol": currencyItem.symbol,
            "balance": +value || currencyItem.value,
            "value": appraiser.getValue(currencyItem.value, currencyItem.symbol),
          };
          if (currencyItem.symbol == 'BTC') {
            balances[currencyItem.symbol].name = "Bitcoin";
          }
        });
        $http.get('/v1/transaction/values.json').then(function(result) {
          currencyInfo = result.data;

          currencyInfo.forEach(function(item) {
            if (balances.hasOwnProperty(item.currency))
              balances[item.currency].name = item.name;
          });

          // Now, any applicable smart properties.
          var spReqs = [];

          for (var b in balances) {
            var spMatch = balances[b].symbol.match(/^SP([0-9]+)$/);

            if (spMatch != null) {
              var updateFunction = function(result) {
                if (result.status == 200) {
                  this.property_type = result.data[0].formatted_property_type;
                  this.name = result.data[0].propertyName + ' (' + this.symbol.match(/^SP([0-9]+)$/)[1] + ')';
                }
              };
              spReqs.push($http.get('/v1/property/' + spMatch[1] + '.json').then(updateFunction.bind(balances[b])));
            }
          }

          if (spReqs.length > 0) {
            $q.all(spReqs).then(function() {
              $scope.balances = balances;
              $scope.hasBalances = true;
            });
          } else {
            $scope.balances = balances;
            $scope.hasBalances = true;
          }

        }
        );

      });
    };

  }
}
function StatsCtrl($scope, $route, $routeParams, $http) {

  $http.get('/v1/system/stats.json', {}).success(function(data) {
    $scope.stats = data;
  });
}

function Ctrl($scope, $route, $routeParams, $modal, $location, browser) {

  $scope.$route = $route;
  $scope.$location = $location;
  $scope.browser = browser;

  /*$scope.$on('$locationChangeStart', function(event, next) {
    if (browser === 'chrome') {
      return;
    }

    event.preventDefault();

    $modal.open({
      backdrop: 'static',
      templateUrl: '/partials/browser_message_modal.html'
    });
  });*/

  $scope.templates = {
    'header': '/header.html',
    'footer': '/footer.html',
    'sidecar': '/partials/sidecar.html',
    'add_address': '/partials/add_address.html',
    'disclaimer': '/partials/disclaimer.html'
  };

}

function HiddenLoginController($scope, $modal, $location) {
  $scope.open = function() {
    $scope.uuid = $location.path().replace("/login/", "");

    $modal.open({
      templateUrl: '/partials/login_modal.html',
      controller: LoginControllerUUID,
      resolve: {
        uuid: function() {
          return $scope.uuid;
        }
      }
    });
  }
}

function RevisionController($scope, $http, $modal, userService) {

  $scope.getData = function() {
    console.log('init 0');
    $http.get('/v1/system/revision.json', {}).success(function(data) {
      $scope.rev = data;
    });
  };
}

function NavigationController($scope, $http, $modal, userService) {

  $scope.getNavData = function() {
    console.log('init 0');
  };
  
  $scope.openCreateModal = function() {
    if (!$scope.modalOpened) {
      $scope.modalOpened = true;
      var modalInstance = $modal.open({
      templateUrl: '/partials/wallet_create_modal.html',
      controller: CreateWalletController
    });
                modalInstance.result.then(function(){},
                                function(){
                                  $scope.modalOpened = false;
                                }
                                );
    }
  };

  $scope.openImportModal = function() {
    $modal.open({
      templateUrl: '/partials/wallet_import_modal.html',
      controller: WalletController
    });
  };

  $scope.openLoginModal = function() {  
      
    $scope.login ={
      title:'Login',
      button:'Open Wallet'
    };
    if (!$scope.modalOpened) {
      $scope.modalOpened = true;
      var modalInstance = $modal.open({
      templateUrl: '/partials/login_modal.html',
      controller: LoginController,
      scope: $scope
    });
                    modalInstance.result.then(function(){},
                                function(){
                                  $scope.modalOpened = false;
                                }
                                );
    }
  };

  $scope.openUUIDmodal = function() {
    $modal.open({
      templateUrl: '/partials/wallet_uuid_modal.html',
      controller: WalletController
    });
  };

  $scope.openNewUUIDmodal = function() {
    $modal.open({
      templateUrl: '/partials/wallet_new_modal.html',
      controller: WalletController<commit_msg>issue_734<commit_after>
function SimpleSendController($scope, userService) {
  var wallet = userService.getWallet();

  MySimpleSendHelpers(wallet);

}
function HomeCtrl($scope, $templateCache, $injector, $location, $http, $q) {
  if ($injector.get('userService').getUUID()) {
    $location.url('/wallet/overview');
  } else {
    //DEV ONLY
    console.log('cleared cache');
    $templateCache.removeAll();

    $scope.balanceAddress = "";
    $scope.hasBalances = false;
    $scope.total = 0;
    $scope.validate = function(address) {
     //console.log('checking '+address);
      return Bitcoin.Address.validate(address);
    };
    $scope.checkBalance = function() {
      var balances = {};
      var appraiser = $injector.get('appraiser');
      $injector.get('balanceService').balance($scope.balanceAddress).then(function(result) {
        result.data.balance.forEach(function(currencyItem) {
          if(currencyItem.divisible)
            var value=new Big(currencyItem.value).times(WHOLE_UNIT).valueOf();
          balances[currencyItem.symbol] = {
            "symbol": currencyItem.symbol,
            "balance": +value || currencyItem.value,
            "value": appraiser.getValue(currencyItem.value, currencyItem.symbol),
          };
          if (currencyItem.symbol == 'BTC') {
            balances[currencyItem.symbol].name = "Bitcoin";
          }
        });
        $http.get('/v1/transaction/values.json').then(function(result) {
          currencyInfo = result.data;

          currencyInfo.forEach(function(item) {
            if (balances.hasOwnProperty(item.currency))
              balances[item.currency].name = item.name;
          });

          // Now, any applicable smart properties.
          var spReqs = [];

          for (var b in balances) {
            var spMatch = balances[b].symbol.match(/^SP([0-9]+)$/);

            if (spMatch != null) {
              var updateFunction = function(result) {
                if (result.status == 200) {
                  this.property_type = result.data[0].formatted_property_type;
                  this.name = result.data[0].propertyName + ' (' + this.symbol.match(/^SP([0-9]+)$/)[1] + ')';
                }
              };
              spReqs.push($http.get('/v1/property/' + spMatch[1] + '.json').then(updateFunction.bind(balances[b])));
            }
          }

          if (spReqs.length > 0) {
            $q.all(spReqs).then(function() {
              $scope.balances = balances;
              $scope.hasBalances = true;
            });
          } else {
            $scope.balances = balances;
            $scope.hasBalances = true;
          }

        }
        );

      });
    };

  }
}
function StatsCtrl($scope, $route, $routeParams, $http) {

  $http.get('/v1/system/stats.json', {}).success(function(data) {
    $scope.stats = data;
  });
}

function Ctrl($scope, $route, $routeParams, $modal, $location, browser) {

  $scope.$route = $route;
  $scope.$location = $location;
  $scope.browser = browser;

  /*$scope.$on('$locationChangeStart', function(event, next) {
    if (browser === 'chrome') {
      return;
    }

    event.preventDefault();

    $modal.open({
      backdrop: 'static',
      templateUrl: '/partials/browser_message_modal.html'
    });
  });*/

  $scope.templates = {
    'header': '/header.html',
    'footer': '/footer.html',
    'sidecar': '/partials/sidecar.html',
    'add_address': '/partials/add_address.html',
    'disclaimer': '/partials/disclaimer.html'
  };

}

function HiddenLoginController($scope, $modal, $location) {
  $scope.open = function() {
    $scope.uuid = $location.path().replace("/login/", "");

    $modal.open({
      templateUrl: '/partials/login_modal.html',
      controller: LoginControllerUUID,
      resolve: {
        uuid: function() {
          return $scope.uuid;
        }
      }
    });
  }
}

function RevisionController($scope, $http, $modal, userService) {

  $scope.getData = function() {
    console.log('init 0');
    $http.get('/v1/system/revision.json', {}).success(function(data) {
      $scope.rev = data;
    });
  };
}

function NavigationController($scope, $http, $modal, userService) {

  $scope.getNavData = function() {
    console.log('init 0');
  };
  
  $scope.openCreateModal = function() {
    if (!$scope.modalOpened) {
      $scope.modalOpened = true;
      var modalInstance = $modal.open({
      templateUrl: '/partials/wallet_create_modal.html',
      controller: CreateWalletController
      });
      modalInstance.result.then(function(){},
      function(){
        $scope.modalOpened = false;
      });
    }
  };

  $scope.openImportModal = function() {
    $modal.open({
      templateUrl: '/partials/wallet_import_modal.html',
      controller: WalletController
    });
  };

  $scope.openLoginModal = function() {  
      
    $scope.login ={
      title:'Login',
      button:'Open Wallet'
    };
    if (!$scope.modalOpened) {
      $scope.modalOpened = true;
      var modalInstance = $modal.open({
      templateUrl: '/partials/login_modal.html',
      controller: LoginController,
      scope: $scope
      });
      modalInstance.result.then(function(){},
      function(){
        $scope.modalOpened = false;
      });
    }
  };

  $scope.openUUIDmodal = function() {
    $modal.open({
      templateUrl: '/partials/wallet_uuid_modal.html',
      controller: WalletController
    });
  };

  $scope.openNewUUIDmodal = function() {
    $modal.open({
      templateUrl: '/partials/wallet_new_modal.html',
      controller: WalletController
{'fraction_non_alphanumeric': 0.1572083186464575, 'fraction_numerical': 0.0036129714487134297, 'mean_word_length': 2.2509309653394443, 'pattern_counts': {'":': 6, '<': 3, '<?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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1163238', 'n_tokens_mistral': 3441, 'n_tokens_neox': 3367, 'n_words': 523}