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