mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
use angular-loading-bar instead of spin.js for ajax indicator
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user