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,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);