Cleans the javascript

This commit is contained in:
2016-02-24 12:28:24 +01:00
parent e6e1f6d6b3
commit 17c2f18193
9 changed files with 34 additions and 30 deletions

View File

@@ -1,3 +1,3 @@
{
"varstmt" : true
"varstmt" : false
}

View File

@@ -38,7 +38,7 @@ album.component('album', {
id: '<albumId',
ratio: '<'
}
})
});
album.controller('AlbumModalInstanceCtrl', function($scope,$uibModalInstance,album) {
$scope.album = album;
@@ -47,5 +47,5 @@ album.controller('AlbumModalInstanceCtrl', function($scope,$uibModalInstance,alb
};
$scope.getLink = function(n) {
return $scope.album[n];
}
};
});

View File

@@ -1,11 +1,11 @@
'use strict';
var controllers = angular.module('satbd.satellite.bar.controllers',[
'ui.bootstrap',
'ngAnimate'
]);
controllers.controller('NavBarCtrl',function($scope,$location,$uibModal) {
"use strict";
$scope.isCollapsed = true;
$scope.isActive = function(loc) {
return loc === $location.path();
@@ -15,7 +15,7 @@ controllers.controller('NavBarCtrl',function($scope,$location,$uibModal) {
if (searchTerms) {
$location.url('/search?q='+ encodeURIComponent(searchTerms));
}
}
};
$scope.openHelpModal = function () {
var modalInstance = $uibModal.open({

View File

@@ -1,5 +1,3 @@
'use strict';
angular.module('satbd.satellite.bar',[
'ngRoute',
'satbd.satellite.bar.controllers',
@@ -9,5 +7,7 @@ angular.module('satbd.satellite.bar',[
'satbd.satellite.bar.views.authors',
'satbd.satellite.bar.views.search'
]).config(function($routeProvider) {
'use strict';
$routeProvider.otherwise({redirectTo: '/recents'});
});

View File

@@ -1,4 +1,4 @@
var services = angular.module('satbd.satellite.bar.services',[])
var services = angular.module('satbd.satellite.bar.services',[]);
services.factory('albumService',['$http','$log','$q', function($http,$log,$q) {
var determinantRegexp = /^(.*) \(([Ll][eas']+)\)$/;
@@ -6,11 +6,11 @@ services.factory('albumService',['$http','$log','$q', function($http,$log,$q) {
var removeSerie = /^\(.*\) .*$/;
function cleanupName(name) {
var matchesStr = name.match(determinantRegexp);
if (matchesStr == null) {
var matches = name.match(determinantRegexp);
if (matches === null) {
return name;
}
return matchesStr[2] + ' ' + matchesStr[1];
return matches[2] + ' ' + matches[1];
}
function cleanupFields(album) {
@@ -18,7 +18,7 @@ services.factory('albumService',['$http','$log','$q', function($http,$log,$q) {
album.série = undefined;
album.editeur = album.éditeur;
album.éditeur = undefined;
if (removeSerie.test(album.serie) == true) {
if (removeSerie.test(album.serie) === true) {
album.serieDisplay = '';
} else {
album.serieDisplay = cleanupName(album.serie);
@@ -64,7 +64,7 @@ services.factory('albumService',['$http','$log','$q', function($http,$log,$q) {
"query": terms
}
}).then(function(response) {
if ( fuzzify == true && response.data.total_hits == 0) {
if ( fuzzify === true && response.data.total_hits === 0) {
return search(fuzzifyTerms(terms),from,false,response.data.took);
}
return processResult(response.data,previousTime);

View File

@@ -1,9 +1,10 @@
'use strict';
angular.module('satbd.satellite.bar.views.authors',[
'ngRoute'
]).config(function($routeProvider) {
'use strict';
$routeProvider.when('/authors', {
templateUrl: 'js/views/authors/authors.html',
});
})
});

View File

@@ -1,15 +1,17 @@
'use strict';
angular.module('satbd.satellite.bar.views.recents',[
'ngRoute',
'satbd.satellite.bar.components.album',
'angular-inview'
]).config(function($routeProvider) {
'use strict';
$routeProvider.when('/recents', {
templateUrl: 'js/views/recents/recents.html',
controller: 'RecentsCtrl'
});
}).controller('RecentsCtrl', function( $scope, $http, $log) {
'use strict';
$scope.albumIDs = [];
$scope.allAlbums = [];
$scope.scrollMore = false;
@@ -29,13 +31,12 @@ angular.module('satbd.satellite.bar.views.recents',[
$log.info('Loading more components');
if (!$scope.scrollMore || $scope.albumIDs.length >= $scope.allAlbums.length) {
$scope.scrollMore = false;
$log.info('reached the end of albums')
$log.info('reached the end of albums');
return;
}
var newSize = Math.min($scope.albumIDs.length + batchSize, $scope.allAlbums.length);
for( var i = $scope.albumIDs.length; i < newSize; i++) {
$scope.albumIDs.push($scope.allAlbums[i]);
}
}
};
});

View File

@@ -1,5 +1,3 @@
'use strict';
angular.module('satbd.satellite.bar.views.search',[
'ngRoute',
'ngSanitize',
@@ -7,11 +5,15 @@ angular.module('satbd.satellite.bar.views.search',[
'satbd.satellite.bar.components.album',
'angular-inview'
]).config(function($routeProvider) {
'use strict';
$routeProvider.when('/search', {
templateUrl: 'js/views/search/search.html',
controller: 'SearchCtrl'
});
}).controller('SearchCtrl', function($scope,$routeParams,$log,$sce,albumService) {
'use strict';
$scope.terms=$routeParams.q;
$scope.scrollMore = false;
$scope.allHits = [];
@@ -43,14 +45,14 @@ angular.module('satbd.satellite.bar.views.search',[
};
$scope.inSecond= function(bleveValue) {
return bleveValue / 1e9;
}
return bleveValue / 1e6;
};
$scope.trustedFragment = function(f) {
return $sce.trustAsHtml(f);
}
};
$scope.round4Dec = function(value) {
return Math.round(value * 10000) / 10000;
}
};
});

View File

@@ -1,9 +1,9 @@
'use strict';
angular.module('satbd.satellite.bar.views.series',[
'ngRoute',
'satbd.satellite.bar.directives.responsive-ratio'
]).config(function($routeProvider) {
'use strict';
$routeProvider.when('/series', {
templateUrl: 'js/views/series/series.html'
});