Files
coriolis/app/js/app.js
Colin McLeod 0d2fd2804f JShint fixes
2015-04-16 20:44:27 -07:00

38 lines
1.2 KiB
JavaScript

angular.module('app', ['ngRoute','shipyard','ngLodash','app.templates'])
.config(['$routeProvider', function($routeProvider) {
//$locationProvider.html5Mode(true);
$routeProvider
.when('/:ship', { templateUrl: 'views/ship.html', controller: 'ShipController' })
.when('/', { templateUrl: 'views/ships.html', controller: 'ShipyardController' });
}])
.run(['$rootScope','commonArray','shipPurpose', 'shipSize', 'hardPointClass', 'internalGroupMap', function ($rootScope, CArr, shipPurpose, sz, hpc, igMap) {
// Global Reference variables
$rootScope.CArr = CArr;
$rootScope.SP = shipPurpose;
$rootScope.SZ = sz;
$rootScope.HPC = hpc;
$rootScope.igMap = igMap;
$rootScope.ships = DB.ships;
// Formatters
$rootScope.fCrd = d3.format(',.0f');
$rootScope.fPwr = d3.format(',.2f');
$rootScope.fMass = d3.format(',.2r');
$rootScope.fPct = d3.format(',.2%');
$rootScope.calcJumpRange = function(mass, fsd, fuel) {
return Math.pow( (fuel || fsd.maxfuel) / fsd.fuelmul, 1 / fsd.fuelpower ) * fsd.optmass / mass;
};
// TODO: Load Saved Ships List from Local Storage
// TODO: Save Ship
// TODO: Load Ship
// TODO: Generate Link for Ship
}]);