Skip to content
Snippets Groups Projects
Select Git revision
  • 907edffef7a0d05de3bd74689e6baa17a38a233c
  • master default protected
  • chrome-manifest-v3
  • feature/migrate-cordova-13
  • feat/improve-network-scan
  • feat/force-migration-check
  • develop
  • feature/encrypted_comment
  • feature/android_api_19
  • gitlab_migration_1
  • rml8
  • v1.7.15-rc1
  • v1.7.14
  • v1.7.13
  • v1.7.12
  • v1.7.11
  • v1.7.10
  • v1.7.9
  • v1.7.8
  • v1.7.7
  • v1.7.6
  • v1.7.5
  • v1.7.4
  • v1.7.3
  • v1.7.2
  • v1.7.1
  • v1.7.0
  • v1.7.0-rc2
  • v1.7.0-rc1
  • v1.6.12
  • v1.6.11
31 results

app.js

Blame
  • app.js 14.42 KiB
    // 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.controllers' is found in controllers.js
    angular.module('cesium', ['ionic', 'ionic-material', 'ngMessages', 'pascalprecht.translate',
      'ngApi', 'angular-cache', 'angular.screenmatch', 'angular.bind.notifier','ImageCropper', 'ngFileSaver',
      // removeIf(no-device)
      'ngCordova',
      // endRemoveIf(no-device)
      // removeIf(no-plugin)
      'cesium.plugins',
      // endRemoveIf(no-plugin)
      'cesium.controllers', 'cesium.templates', 'cesium.translations'
      ])
    
      .filter('formatInteger', function() {
        return function(input) {
          return !input ? '0' : (input < 10000000 ? numeral(input).format('0,0') : numeral(input).format('0,0.000 a'));
        };
      })
    
      .filter('formatAmount', function(csConfig, csSettings, csWallet, $filter) {
        var minValue = 1 / Math.pow(10, csConfig.decimalCount || 4);
        var format = '0,0.0' + Array(csConfig.decimalCount || 4).join('0');
    
        function formatRelative(input, options) {
          var currentUD = options && options.currentUD ? options.currentUD : csWallet.data.currentUD;
          if (!currentUD) {
            console.warn("formatAmount: currentUD not defined");
            return;
          }
          var amount = input / currentUD;
          if (Math.abs(amount) < minValue && input !== 0) {
            amount = '~ 0';
          }
          else {
            amount = numeral(amount).format(format);
          }
          if (options && options.currency) {
            return amount + ' ' + $filter('currencySymbol')(options.currency, true);
          }
          return amount;
        }
    
        function formatQuantitative(input, options) {
          var amount = numeral(input/100).format((input > -1000000000 && input < 1000000000) ? '0,0.00' : '0,0.000 a');
          if (options && options.currency) {
            return amount + ' ' + $filter('currencySymbol')(options.currency, false);
          }
          return amount;
        }
    
        return function(input, options) {
          if (input === undefined) return;
          return (options && angular.isDefined(options.useRelative) ? options.useRelative : csSettings.data.useRelative) ?
            formatRelative(input, options) :
            formatQuantitative(input, options);
        };
      })
    
      .filter('currencySymbol', function($rootScope, $filter, csSettings) {
        return function(input, useRelative) {
          if (!input) return '';
          return (angular.isDefined(useRelative) ? useRelative : csSettings.data.useRelative) ?
            ($rootScope.translations.UD + '<sub>' + $filter('abbreviate')(input) + '</sub>') :
            $filter('abbreviate')(input);
        };
      })