mirror of
https://github.com/EDCD/coriolis.git
synced 2025-12-09 14:45:35 +00:00
Linting fixes
This commit is contained in:
@@ -1,12 +1,13 @@
|
||||
angular.module('app', ['ui.router', 'ct.ui.router.extras.sticky', 'ui.sortable', 'shipyard', 'ngLodash', 'app.templates'])
|
||||
.run(['$rootScope', '$location', '$window', '$document','$state','commonArray','shipPurpose','shipSize','hardPointClass','GroupMap', 'Persist', function ($rootScope, $location, $window, $doc, $state, CArr, shipPurpose, sz, hpc, GroupMap, Persist) {
|
||||
.run(['$rootScope', '$location', '$window', '$document', '$state', 'commonArray', 'shipPurpose', 'shipSize', 'hardPointClass', 'GroupMap', 'Persist',
|
||||
function($rootScope, $location, $window, $doc, $state, CArr, shipPurpose, sz, hpc, GroupMap, Persist) {
|
||||
// App is running as a standalone web app on tablet/mobile
|
||||
var isStandAlone = $window.navigator.standalone || ($window.external && $window.external.msIsSiteMode && $window.external.msIsSiteMode());
|
||||
|
||||
// Redirect any state transition errors to the error controller/state
|
||||
$rootScope.$on('$stateChangeError', function(e, toState, toParams, fromState, fromParams, error){
|
||||
$rootScope.$on('$stateChangeError', function(e, toState, toParams, fromState, fromParams, error) {
|
||||
e.preventDefault();
|
||||
$state.go('error', error, {location:false, reload:true}); // Go to error state, reload the controller, keep the current URL
|
||||
$state.go('error', error, { location: false, reload: true }); // Go to error state, reload the controller, keep the current URL
|
||||
});
|
||||
|
||||
// Track on Google analytics if available
|
||||
@@ -16,12 +17,12 @@ angular.module('app', ['ui.router', 'ct.ui.router.extras.sticky', 'ui.sortable',
|
||||
if (to.url) { // Only track states that have a URL
|
||||
|
||||
if ($window.ga) {
|
||||
ga('send', 'pageview', {page: $location.path()});
|
||||
ga('send', 'pageview', { page: $location.path() });
|
||||
}
|
||||
|
||||
if (isStandAlone) {
|
||||
// Persist the current state
|
||||
Persist.setState({name: to.name, params: toParams});
|
||||
Persist.setState({ name: to.name, params: toParams });
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -32,12 +33,12 @@ angular.module('app', ['ui.router', 'ct.ui.router.extras.sticky', 'ui.sortable',
|
||||
$rootScope.SZ = sz;
|
||||
$rootScope.HPC = hpc;
|
||||
$rootScope.GMAP = GroupMap;
|
||||
$rootScope.STATUS = ['','DISABLED', 'OFF', 'ON'];
|
||||
$rootScope.STATUS_CLASS = ['','disabled', 'warning', 'secondary-disabled'];
|
||||
$rootScope.STATUS = ['', 'DISABLED', 'OFF', 'ON'];
|
||||
$rootScope.STATUS_CLASS = ['', 'disabled', 'warning', 'secondary-disabled'];
|
||||
$rootScope.title = 'Coriolis';
|
||||
|
||||
$rootScope.cName = function (c) {
|
||||
return c.c? c.c.name? c.c.name : GroupMap[c.c.grp] : null;
|
||||
$rootScope.cName = function(c) {
|
||||
return c.c ? c.c.name ? c.c.name : GroupMap[c.c.grp] : null;
|
||||
};
|
||||
|
||||
// Formatters
|
||||
@@ -48,21 +49,21 @@ angular.module('app', ['ui.router', 'ct.ui.router.extras.sticky', 'ui.sortable',
|
||||
$rootScope.fPct = d3.format('.2%');
|
||||
$rootScope.f1Pct = d3.format('.1%');
|
||||
$rootScope.fRPct = d3.format('%');
|
||||
$rootScope.fTime = function(d) { return Math.floor(d/60) + ":" + ("00" + Math.floor(d%60)).substr(-2,2); };
|
||||
$rootScope.fTime = function(d) { return Math.floor(d / 60) + ':' + ('00' + Math.floor(d % 60)).substr(-2, 2); };
|
||||
|
||||
if (isStandAlone) {
|
||||
var state = Persist.getState();
|
||||
// If a previous state has been stored, load that state
|
||||
if (state && state.name && state.params) {
|
||||
$state.go(state.name, state.params, {location:'replace'});
|
||||
$state.go(state.name, state.params, { location: 'replace' });
|
||||
} else {
|
||||
$state.go('shipyard', null, {location:'replace'}); // Default to home page
|
||||
$state.go('shipyard', null, { location: 'replace' }); // Default to home page
|
||||
}
|
||||
}
|
||||
|
||||
// Global Event Listeners
|
||||
$doc.bind('keyup', function (e) {
|
||||
if(e.keyCode == 27) { // Escape Key
|
||||
$doc.bind('keyup', function(e) {
|
||||
if (e.keyCode == 27) { // Escape Key
|
||||
$rootScope.$broadcast('close', e);
|
||||
$rootScope.$apply();
|
||||
} else {
|
||||
@@ -70,7 +71,7 @@ angular.module('app', ['ui.router', 'ct.ui.router.extras.sticky', 'ui.sortable',
|
||||
}
|
||||
});
|
||||
|
||||
$rootScope.bgClicked = function (e) {
|
||||
$rootScope.bgClicked = function(e) {
|
||||
$rootScope.$broadcast('close', e);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user