use angular-loading-bar instead of spin.js for ajax indicator

This commit is contained in:
Athou
2014-04-29 10:44:39 +02:00
parent 517ce1a726
commit ba04d2adfe
10 changed files with 41 additions and 63 deletions

View File

@@ -430,7 +430,6 @@ module.controller('TagDetailsCtrl', ['$scope', '$state', '$stateParams', 'FeedSe
module.controller('ToolbarCtrl', [
'$scope',
'$http',
'$state',
'$stateParams',
'$route',
@@ -442,24 +441,15 @@ module.controller('ToolbarCtrl', [
'ServerService',
'FeedService',
'MobileService',
function($scope, $http, $state, $stateParams, $route, $location, SettingsService, EntryService, ProfileService, AnalyticsService,
function($scope, $state, $stateParams, $route, $location, SettingsService, EntryService, ProfileService, AnalyticsService,
ServerService, FeedService, MobileService) {
function totalActiveAjaxRequests() {
return ($http.pendingRequests.length + $.active);
}
$scope.keywords = $location.search().q;
$scope.session = ProfileService.get();
$scope.ServerService = ServerService.get();
$scope.settingsService = SettingsService;
$scope.MobileService = MobileService;
$scope.loading = true;
$scope.$watch(totalActiveAjaxRequests, function() {
$scope.loading = (totalActiveAjaxRequests() !== 0);
});
$scope.$watch('settingsService.settings.readingMode', function(newValue, oldValue) {
if (newValue && oldValue && newValue != oldValue) {
SettingsService.save();

View File

@@ -273,46 +273,6 @@ module.directive('category', [function() {
};
}]);
/**
* Reusable spinner component
*/
module.directive('spinner', function() {
return {
scope : {
shown : '='
},
restrict : 'A',
link : function($scope, element) {
element.addClass('spinner');
var opts = {
lines : 11, // The number of lines to draw
length : 5, // The length of each line
width : 3, // The line thickness
radius : 8, // The radius of the inner circle
corners : 1, // Corner roundness (0..1)
rotate : 0, // The rotation offset
color : '#000', // #rgb or #rrggbb
speed : 1.3, // Rounds per second
trail : 60, // Afterglow percentage
shadow : false, // Whether to render a shadow
hwaccel : true, // Whether to use hardware acceleration
zIndex : 2e9, // The z-index (defaults to 2000000000)
top : 'auto', // Top position relative to parent in px
left : 'auto' // Left position relative to parent in px
};
var spinner = new Spinner(opts);
$scope.$watch('shown', function(shown) {
if (shown) {
spinner.spin();
element.append(spinner.el);
} else {
spinner.stop();
}
});
}
};
});
module.directive('draggable', function() {
return {
restrict : 'A',

View File

@@ -1,8 +1,12 @@
var app = angular.module('commafeed', ['ngRoute', 'ngTouch', 'ui.utils', 'ui.bootstrap', 'ui.router', 'ui.select2', 'commafeed.directives',
'commafeed.controllers', 'commafeed.services', 'commafeed.filters', 'ngSanitize', 'infinite-scroll', 'ngGrid']);
var app = angular.module('commafeed', ['ngRoute', 'ngTouch', 'ngAnimate', 'ui.utils', 'ui.bootstrap', 'ui.router', 'ui.select2',
'commafeed.directives', 'commafeed.controllers', 'commafeed.services', 'commafeed.filters', 'ngSanitize', 'infinite-scroll',
'ngGrid', 'chieffancypants.loadingBar']);
app.config(['$routeProvider', '$stateProvider', '$urlRouterProvider', '$httpProvider', '$compileProvider',
function($routeProvider, $stateProvider, $urlRouterProvider, $httpProvider, $compileProvider) {
app.config(['$routeProvider', '$stateProvider', '$urlRouterProvider', '$httpProvider', '$compileProvider', 'cfpLoadingBarProvider',
function($routeProvider, $stateProvider, $urlRouterProvider, $httpProvider, $compileProvider, cfpLoadingBarProvider) {
cfpLoadingBarProvider.includeSpinner = false;
cfpLoadingBarProvider.latencyThreshold = 0;
$compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|javascript):/);
var interceptor = ['$rootScope', '$q', function(scope, $q) {