mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-09 14:45:35 +00:00
Refactoring of just about everything, interface beginning to come together
This commit is contained in:
@@ -1,12 +1,25 @@
|
||||
angular.module('app', ['ngRoute','shipyard','ngLodash','app.templates'])
|
||||
.config(['$routeProvider', function($routeProvider) {
|
||||
//$locationProvider.html5Mode(true);
|
||||
angular.module('app', ['ngRoute', 'shipyard', 'ngLodash', 'n3-line-chart', 'app.templates'])
|
||||
.config(['$routeProvider', '$locationProvider', function($routeProvider, $locationProvider) {
|
||||
$locationProvider.html5Mode(true);
|
||||
$routeProvider
|
||||
.when('/:ship', { templateUrl: 'views/ship.html', controller: 'ShipController' })
|
||||
.when('/:ship/:code', { 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) {
|
||||
.run(['$rootScope','$document','$location','$route','commonArray','shipPurpose','shipSize','hardPointClass','internalGroupMap', function ($rootScope, $doc, $loc, $route, CArr, shipPurpose, sz, hpc, igMap) {
|
||||
// Allow URL changes without reloading controllers/view
|
||||
var original = $loc.path;
|
||||
$loc.path = function (path, reload) {
|
||||
if (reload === false) {
|
||||
var lastRoute = $route.current;
|
||||
var un = $rootScope.$on('$locationChangeSuccess', function () {
|
||||
$route.current = lastRoute;
|
||||
un();
|
||||
});
|
||||
}
|
||||
return original.apply($loc, [path]);
|
||||
};
|
||||
|
||||
// Global Reference variables
|
||||
$rootScope.CArr = CArr;
|
||||
@@ -19,19 +32,18 @@ angular.module('app', ['ngRoute','shipyard','ngLodash','app.templates'])
|
||||
// Formatters
|
||||
$rootScope.fCrd = d3.format(',.0f');
|
||||
$rootScope.fPwr = d3.format(',.2f');
|
||||
$rootScope.fMass = d3.format(',.2r');
|
||||
$rootScope.fPct = d3.format(',.2%');
|
||||
$rootScope.fRound = function(d) { return d3.round(d, 2) };
|
||||
$rootScope.fPct = d3.format('.2%');
|
||||
$rootScope.fRPct = d3.format('%');
|
||||
$rootScope.fTime = function(d) { return Math.floor(d/60) + ":" + ("00" + (d%60)).substr(-2,2); };
|
||||
|
||||
$rootScope.calcJumpRange = function(mass, fsd, fuel) {
|
||||
return Math.pow( (fuel || fsd.maxfuel) / fsd.fuelmul, 1 / fsd.fuelpower ) * fsd.optmass / mass;
|
||||
};
|
||||
// Global Event Listeners
|
||||
$doc.bind('keyup', function (e) {
|
||||
$rootScope.$broadcast('keyup', e);
|
||||
});
|
||||
|
||||
// TODO: Load Saved Ships List from Local Storage
|
||||
|
||||
// TODO: Save Ship
|
||||
|
||||
// TODO: Load Ship
|
||||
|
||||
// TODO: Generate Link for Ship
|
||||
$rootScope.bgClicked = function (e) {
|
||||
$rootScope.$broadcast('bgClicked', e);
|
||||
}
|
||||
|
||||
}]);
|
||||
|
||||
Reference in New Issue
Block a user