$localStorage.$default({
ui: {
'simfilesPerPage': 10,
+ 'simfilesPerPageAuto': true,
'showDownloadWarning' : 'Yes'
}
});
UiSettingsService.setDirective = function(directive, value)
{
- if($localStorage.ui[directive]) $localStorage.ui[directive] = value;
+ if($localStorage.ui.hasOwnProperty(directive)) $localStorage.ui[directive] = value;
};
UiSettingsService.getDirective = function(directive)
</div>
<div class="modal-body">
<h2>Simfiles per page</h2>
- <input type="text" ng-model="simfilesPerPage"/>
+ <input type="text" ng-model="simfilesPerPage" ng-disabled="simfilesPerPageAuto"/><br />
+ <label for="auto">Automatic</label>
+ <input name="auto" type="checkbox" ng-model="simfilesPerPageAuto"/>
<h2>Download Warnings</h2>
<select ng-model="downloadWarnings">
<option value="Yes">Yes</option>
{
$scope.hidden = true;
$scope.simfilesPerPage = UiSettingsService.getDirective('simfilesPerPage');
+ $scope.simfilesPerPageAuto = UiSettingsService.getDirective('simfilesPerPageAuto');
$scope.downloadWarnings = UiSettingsService.getDirective('showDownloadWarning');
$scope.ok = function()
{
UiSettingsService.setDirective('simfilesPerPage', $scope.simfilesPerPage);
+ UiSettingsService.setDirective('simfilesPerPageAuto', $scope.simfilesPerPageAuto);
UiSettingsService.setDirective('showDownloadWarning', $scope.downloadWarnings);
$scope.hidden = false;
$scope.messageType = 'success';
angular.module("DivinElegy.pages.packs", ["DivinElegy.components.simfiles","DivinElegy.components.user","DivinElegy.components.config","DivinElegy.components.ui", "ui.bootstrap"])
-.controller("PackController", ['$scope', 'SimfileService', 'UiSettingsService', 'filterFilter', '$routeParams', '$location', function($scope, SimfileService, UiSettingsService, filterFilter, $routeParams, $location)
+.controller("PackController", ['$scope', 'SimfileService', 'UiSettingsService', 'filterFilter', '$routeParams', '$location', '$window', function($scope, SimfileService, UiSettingsService, filterFilter, $routeParams, $location, $window)
{
$scope.packTitleFilterKeyword = null;
$scope.artistFilterKeyWord = null;
// //TODO: 404 page?
// if(!$scope.pack) $location.path('/');
} else {
- $scope.pageSize = UiSettingsService.getDirective('simfilesPerPage');
+ $scope.pageSize = UiSettingsService.getDirective('simfilesPerPageAuto') ? Math.floor(($window.innerHeight - 280)/40) : UiSettingsService.getDirective('simfilesPerPage');
$scope.currentPage = 1;
$scope.packList = packs;
$scope.filteredPackList = packs;