apply new js formatter

This commit is contained in:
Athou
2013-07-31 11:16:50 +02:00
parent 7497b88c26
commit da65e85081
6 changed files with 1420 additions and 1438 deletions

View File

@@ -120,8 +120,8 @@ function($scope, FeedService, CategoryService, MobileService) {
};
}]);
module.controller('CategoryTreeCtrl', ['$scope', '$timeout', '$stateParams', '$window',
'$location', '$state', '$route', 'CategoryService', 'AnalyticsService',
module.controller('CategoryTreeCtrl', ['$scope', '$timeout', '$stateParams', '$window', '$location', '$state', '$route', 'CategoryService',
'AnalyticsService',
function($scope, $timeout, $stateParams, $window, $location, $state, $route, CategoryService, AnalyticsService) {
$scope.selectedType = $stateParams._type;
@@ -295,14 +295,12 @@ module.controller('FeedDetailsCtrl', ['$scope', '$state', '$stateParams', 'FeedS
cssClass : 'btn-primary'
}];
$dialog.messageBox(title, msg, btns).open().then(
function(result) {
$dialog.messageBox(title, msg, btns).open().then(function(result) {
if (result == 'ok') {
var data = {
id : sub.id
};
FeedService.unsubscribe(data,
function() {
FeedService.unsubscribe(data, function() {
CategoryService.init();
});
$state.transitionTo('feeds.view', {
@@ -330,8 +328,8 @@ module.controller('FeedDetailsCtrl', ['$scope', '$state', '$stateParams', 'FeedS
};
}]);
module.controller('CategoryDetailsCtrl', ['$scope', '$state', '$stateParams', 'FeedService', 'CategoryService', 'ProfileService', '$dialog',
function($scope, $state, $stateParams, FeedService, CategoryService, ProfileService, $dialog) {
module.controller('CategoryDetailsCtrl', ['$scope', '$state', '$stateParams', 'FeedService', 'CategoryService', 'ProfileService',
'$dialog', function($scope, $state, $stateParams, FeedService, CategoryService, ProfileService, $dialog) {
$scope.CategoryService = CategoryService;
$scope.user = ProfileService.get();
@@ -389,8 +387,7 @@ module.controller('CategoryDetailsCtrl', ['$scope', '$state', '$stateParams', 'F
cssClass : 'btn-primary'
}];
$dialog.messageBox(title, msg, btns).open().then(
function(result) {
$dialog.messageBox(title, msg, btns).open().then(function(result) {
if (result == 'ok') {
CategoryService.remove({
id : category.id
@@ -422,10 +419,22 @@ module.controller('CategoryDetailsCtrl', ['$scope', '$state', '$stateParams', 'F
};
}]);
module.controller('ToolbarCtrl', ['$scope', '$http', '$state', '$stateParams',
'$route', '$location', 'SettingsService', 'EntryService', 'ProfileService', 'AnalyticsService', 'ServerService', 'FeedService', 'MobileService',
function($scope, $http, $state, $stateParams, $route, $location,
SettingsService, EntryService, ProfileService, AnalyticsService, ServerService, FeedService, MobileService) {
module.controller('ToolbarCtrl', [
'$scope',
'$http',
'$state',
'$stateParams',
'$route',
'$location',
'SettingsService',
'EntryService',
'ProfileService',
'AnalyticsService',
'ServerService',
'FeedService',
'MobileService',
function($scope, $http, $state, $stateParams, $route, $location, SettingsService, EntryService, ProfileService, AnalyticsService,
ServerService, FeedService, MobileService) {
function totalActiveAjaxRequests() {
return ($http.pendingRequests.length + $.active);
@@ -441,20 +450,17 @@ function($scope, $http, $state, $stateParams, $route, $location,
$scope.loading = (totalActiveAjaxRequests() !== 0);
});
$scope.$watch('settingsService.settings.readingMode', function(
newValue, oldValue) {
$scope.$watch('settingsService.settings.readingMode', function(newValue, oldValue) {
if (newValue && oldValue && newValue != oldValue) {
SettingsService.save();
}
});
$scope.$watch('settingsService.settings.readingOrder', function(
newValue, oldValue) {
$scope.$watch('settingsService.settings.readingOrder', function(newValue, oldValue) {
if (newValue && oldValue && newValue != oldValue) {
SettingsService.save();
}
});
$scope.$watch('settingsService.settings.viewMode', function(
newValue, oldValue) {
$scope.$watch('settingsService.settings.viewMode', function(newValue, oldValue) {
if (newValue && oldValue && newValue != oldValue) {
SettingsService.save();
$scope.$emit('emitReload');
@@ -651,9 +657,20 @@ function($scope, $state, $filter, $timeout, CategoryService) {
}]);
module.controller('FeedListCtrl', ['$scope', '$stateParams', '$http', '$route', '$state',
'$window', 'EntryService', 'SettingsService', 'FeedService', 'CategoryService', 'AnalyticsService',
function($scope, $stateParams, $http, $route, $state, $window, EntryService, SettingsService, FeedService, CategoryService, AnalyticsService) {
module.controller('FeedListCtrl', [
'$scope',
'$stateParams',
'$http',
'$route',
'$state',
'$window',
'EntryService',
'SettingsService',
'FeedService',
'CategoryService',
'AnalyticsService',
function($scope, $stateParams, $http, $route, $state, $window, EntryService, SettingsService, FeedService, CategoryService,
AnalyticsService) {
AnalyticsService.track();
@@ -669,14 +686,12 @@ function($scope, $stateParams, $http, $route, $state, $window, EntryService, Set
$scope.font_size = 0;
$scope.settingsService = SettingsService;
$scope.$watch('settingsService.settings.readingMode', function(newValue,
oldValue) {
$scope.$watch('settingsService.settings.readingMode', function(newValue, oldValue) {
if (newValue && oldValue && newValue != oldValue) {
$scope.$emit('emitReload');
}
});
$scope.$watch('settingsService.settings.readingOrder', function(newValue,
oldValue) {
$scope.$watch('settingsService.settings.readingOrder', function(newValue, oldValue) {
if (newValue && oldValue && newValue != oldValue) {
$scope.$emit('emitReload');
}
@@ -718,8 +733,7 @@ function($scope, $stateParams, $http, $route, $state, $window, EntryService, Set
$scope.feedLink = data.feedLink;
};
if (!$scope.keywords) {
var service = $scope.selectedType == 'feed' ? FeedService
: CategoryService;
var service = $scope.selectedType == 'feed' ? FeedService : CategoryService;
service.entries({
id : $scope.selectedId,
readType : $scope.settingsService.settings.readingMode,
@@ -758,8 +772,7 @@ function($scope, $stateParams, $http, $route, $state, $window, EntryService, Set
};
$scope.markAll = function(olderThan) {
var service = $scope.selectedType == 'feed' ? FeedService
: CategoryService;
var service = $scope.selectedType == 'feed' ? FeedService : CategoryService;
service.mark({
id : $scope.selectedId,
olderThan : olderThan || $scope.timestamp,
@@ -1009,11 +1022,8 @@ function($scope, $stateParams, $http, $route, $state, $window, EntryService, Set
var url = $scope.current.url;
var a = document.createElement('a');
a.href = url;
var evt = document
.createEvent('MouseEvents');
evt.initMouseEvent('click', true, true,
window, 0, 0, 0, 0, 0, true, false,
false, true, 0, null);
var evt = document.createEvent('MouseEvents');
evt.initMouseEvent('click', true, true, window, 0, 0, 0, 0, 0, true, false, false, true, 0, null);
a.dispatchEvent(evt);
}
return false;
@@ -1233,9 +1243,7 @@ function($scope, $state, $stateParams, $dialog, AdminUsersService) {
};
}]);
module.controller('ManageDuplicateFeedsCtrl', [
'$scope', 'AdminCleanupService',
function($scope, AdminCleanupService) {
module.controller('ManageDuplicateFeedsCtrl', ['$scope', 'AdminCleanupService', function($scope, AdminCleanupService) {
$scope.limit = 10;
$scope.page = 0;
@@ -1376,8 +1384,7 @@ function($scope, $location, $state, AdminSettingsService) {
};
}]);
module.controller('HelpController', [ '$scope', 'CategoryService',
'AnalyticsService', 'ServerService',
module.controller('HelpController', ['$scope', 'CategoryService', 'AnalyticsService', 'ServerService',
function($scope, CategoryService, AnalyticsService, ServerService) {
AnalyticsService.track();

View File

@@ -93,9 +93,7 @@ module.directive('onScrollMiddle', function() {
var onScroll = function(e) {
var scroll = d.scrollTop();
w.data.scrollDirection = (scroll
- w.data.scrollPosition > 0) ? 'down'
: 'up';
w.data.scrollDirection = (scroll - w.data.scrollPosition > 0) ? 'down' : 'up';
w.data.scrollPosition = scroll;
scope.$apply();
};
@@ -115,8 +113,8 @@ module.directive('onScrollMiddle', function() {
});
/**
* Scrolls to the element if the value is true and the attribute is not fully visible,
* unless the attribute scroll-to-force is true
* Scrolls to the element if the value is true and the attribute is not fully
* visible, unless the attribute scroll-to-force is true
*/
module.directive('scrollTo', ['$timeout', function($timeout) {
return {
@@ -164,9 +162,7 @@ module.directive('mousewheelScrolling', function() {
if (d > 0 && t.scrollTop() === 0) {
e.preventDefault();
} else {
if (d < 0
&& (t.scrollTop() == t.get(0).scrollHeight
- t.innerHeight())) {
if (d < 0 && (t.scrollTop() == t.get(0).scrollHeight - t.innerHeight())) {
e.preventDefault();
}
}
@@ -215,16 +211,8 @@ module.directive('category', [ function() {
restrict : 'E',
replace : true,
templateUrl : 'templates/_category.html',
controller : [
'$scope',
'$state',
'$dialog',
'FeedService',
'CategoryService',
'SettingsService',
'MobileService',
function($scope, $state, $dialog, FeedService, CategoryService,
SettingsService, MobileService) {
controller : ['$scope', '$state', '$dialog', 'FeedService', 'CategoryService', 'SettingsService', 'MobileService',
function($scope, $state, $dialog, FeedService, CategoryService, SettingsService, MobileService) {
$scope.settingsService = SettingsService;
$scope.getClass = function(level) {
@@ -234,8 +222,7 @@ module.directive('category', [ function() {
};
$scope.categoryLabel = function(category) {
return $scope.showLabel !== true ? $scope.showLabel
: category.name;
return $scope.showLabel !== true ? $scope.showLabel : category.name;
};
$scope.categoryCountLabel = function(category) {
@@ -261,8 +248,7 @@ module.directive('category', [ function() {
// Could be called by a middle click
if (!event || (!event.ctrlKey && event.which == 1)) {
MobileService.toggleLeftMenu();
if ($scope.selectedType == 'feed'
&& id == $scope.selectedId) {
if ($scope.selectedType == 'feed' && id == $scope.selectedId) {
$scope.$emit('emitReload');
} else {
$state.transitionTo('feeds.view', {
@@ -280,8 +266,7 @@ module.directive('category', [ function() {
$scope.categoryClicked = function(id) {
MobileService.toggleLeftMenu();
if ($scope.selectedType == 'category'
&& id == $scope.selectedId) {
if ($scope.selectedType == 'category' && id == $scope.selectedId) {
$scope.$emit('emitReload');
} else {
$state.transitionTo('feeds.view', {
@@ -315,8 +300,7 @@ module.directive('category', [ function() {
collapse : !category.expanded
});
};
}
]
}]
};
}]);
@@ -374,8 +358,7 @@ module.directive('draggable', function() {
};
});
module.directive('droppable', [ 'CategoryService', 'FeedService',
function(CategoryService, FeedService) {
module.directive('droppable', ['CategoryService', 'FeedService', function(CategoryService, FeedService) {
return {
restrict : 'A',
link : function(scope, element, attrs) {
@@ -426,7 +409,6 @@ module.directive('droppable', [ 'CategoryService', 'FeedService',
};
}]);
module.filter('highlight', function() {
return function(html, keywords) {
if (keywords) {

View File

@@ -1,7 +1,5 @@
var app = angular.module('commafeed', [ 'ui', 'ui.bootstrap', 'ui.state',
'commafeed.directives', 'commafeed.controllers', 'commafeed.services',
'commafeed.filters', 'ngSanitize', 'infinite-scroll',
'ngGrid' ]);
var app = angular.module('commafeed', ['ui', 'ui.bootstrap', 'ui.state', 'commafeed.directives', 'commafeed.controllers',
'commafeed.services', 'commafeed.filters', 'ngSanitize', 'infinite-scroll', 'ngGrid']);
app.config(['$routeProvider', '$stateProvider', '$urlRouterProvider', '$httpProvider',
function($routeProvider, $stateProvider, $urlRouterProvider, $httpProvider) {

View File

@@ -27,7 +27,6 @@ module.service('MobileService', [ '$state', function($state) {
this.mobile = width < 979;
}]);
module.factory('ProfileService', ['$resource', function($resource) {
var res = $resource('rest/user/profile/');
res.deleteAccount = $resource('rest/user/profile/deleteAccount').save;
@@ -65,8 +64,7 @@ module.factory('SettingsService', ['$resource', function($resource) {
return s;
}]);
module.factory('FeedService', ['$resource', '$http',
function($resource, $http) {
module.factory('FeedService', ['$resource', '$http', function($resource, $http) {
var actions = {
entries : {
method : 'GET',
@@ -122,8 +120,7 @@ function($resource, $http) {
return res;
}]);
module.factory('CategoryService', ['$resource', '$http',
function($resource, $http) {
module.factory('CategoryService', ['$resource', '$http', function($resource, $http) {
var traverse = function(callback, category, parentName) {
callback(category, parentName);
@@ -249,8 +246,7 @@ function($resource, $http) {
return res;
}]);
module.factory('EntryService', ['$resource', '$http',
function($resource, $http) {
module.factory('EntryService', ['$resource', '$http', function($resource, $http) {
var actions = {
search : {
method : 'GET',

View File

@@ -14,8 +14,7 @@ app.factory('$templateCache', ['$cacheFactory', '$http', '$injector', function($
if (!allTplPromise) {
var lang = $('html').attr('lang');
allTplPromise = $http.get('templates/all-templates.' + lang + '.html?${timestamp}').then(
function(response) {
allTplPromise = $http.get('templates/all-templates.' + lang + '.html?${timestamp}').then(function(response) {
$injector.get('$compile')(response.data);
return response;
});