mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
apply new js formatter
This commit is contained in:
@@ -27,7 +27,7 @@ module.run(['$rootScope', function($rootScope) {
|
||||
}]);
|
||||
|
||||
module.controller('SubscribeCtrl', ['$scope', 'FeedService', 'CategoryService', 'MobileService',
|
||||
function($scope, FeedService, CategoryService, MobileService) {
|
||||
function($scope, FeedService, CategoryService, MobileService) {
|
||||
|
||||
$scope.opts = {
|
||||
backdropFade : true,
|
||||
@@ -47,7 +47,7 @@ function($scope, FeedService, CategoryService, MobileService) {
|
||||
|
||||
$scope.open = function() {
|
||||
$scope.sub = {
|
||||
categoryId: $scope.sub.categoryId || 'all'
|
||||
categoryId : $scope.sub.categoryId || 'all'
|
||||
};
|
||||
$scope.isOpen = true;
|
||||
};
|
||||
@@ -104,7 +104,7 @@ function($scope, FeedService, CategoryService, MobileService) {
|
||||
$scope.openCategory = function() {
|
||||
$scope.isOpenCategory = true;
|
||||
$scope.cat = {
|
||||
parentId: 'all'
|
||||
parentId : 'all'
|
||||
};
|
||||
};
|
||||
|
||||
@@ -118,18 +118,18 @@ function($scope, FeedService, CategoryService, MobileService) {
|
||||
});
|
||||
$scope.closeCategory();
|
||||
};
|
||||
}]);
|
||||
}]);
|
||||
|
||||
module.controller('CategoryTreeCtrl', ['$scope', '$timeout', '$stateParams', '$window',
|
||||
'$location', '$state', '$route', 'CategoryService', 'AnalyticsService',
|
||||
function($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;
|
||||
$scope.selectedId = $stateParams._id;
|
||||
|
||||
$scope.starred = {
|
||||
id: 'starred',
|
||||
name: 'Starred'
|
||||
id : 'starred',
|
||||
name : 'Starred'
|
||||
};
|
||||
|
||||
$scope.$on('$stateChangeSuccess', function() {
|
||||
@@ -195,7 +195,7 @@ function($scope, $timeout, $stateParams, $window, $location, $state, $route, Cat
|
||||
}
|
||||
};
|
||||
|
||||
var getCurrentIndex = function (id, type, flat) {
|
||||
var getCurrentIndex = function(id, type, flat) {
|
||||
var index = -1;
|
||||
for ( var i = 0; i < flat.length; i++) {
|
||||
var node = flat[i];
|
||||
@@ -211,7 +211,7 @@ function($scope, $timeout, $stateParams, $window, $location, $state, $route, Cat
|
||||
var f = CategoryService.flatAll;
|
||||
var current = getCurrentIndex($scope.selectedId, $scope.selectedType, f);
|
||||
current++;
|
||||
if(current < f.length) {
|
||||
if (current < f.length) {
|
||||
$state.transitionTo('feeds.view', {
|
||||
_type : f[current][1],
|
||||
_id : f[current][0]
|
||||
@@ -223,7 +223,7 @@ function($scope, $timeout, $stateParams, $window, $location, $state, $route, Cat
|
||||
var f = CategoryService.flatAll;
|
||||
var current = getCurrentIndex($scope.selectedId, $scope.selectedType, f);
|
||||
current--;
|
||||
if(current >= 0) {
|
||||
if (current >= 0) {
|
||||
$state.transitionTo('feeds.view', {
|
||||
_type : f[current][1],
|
||||
_id : f[current][0]
|
||||
@@ -260,7 +260,7 @@ function($scope, $timeout, $stateParams, $window, $location, $state, $route, Cat
|
||||
$scope.$on('mark', function(event, args) {
|
||||
mark($scope.CategoryService.subscriptions, args.entry);
|
||||
});
|
||||
}]);
|
||||
}]);
|
||||
|
||||
module.controller('FeedDetailsCtrl', ['$scope', '$state', '$stateParams', 'FeedService', 'CategoryService', 'ProfileService', '$dialog',
|
||||
function($scope, $state, $stateParams, FeedService, CategoryService, ProfileService, $dialog) {
|
||||
@@ -277,8 +277,8 @@ module.controller('FeedDetailsCtrl', ['$scope', '$state', '$stateParams', 'FeedS
|
||||
|
||||
$scope.back = function() {
|
||||
$state.transitionTo('feeds.view', {
|
||||
_id: $stateParams._id,
|
||||
_type: 'feed'
|
||||
_id : $stateParams._id,
|
||||
_type : 'feed'
|
||||
});
|
||||
};
|
||||
|
||||
@@ -286,28 +286,26 @@ module.controller('FeedDetailsCtrl', ['$scope', '$state', '$stateParams', 'FeedS
|
||||
var sub = $scope.sub;
|
||||
var title = 'Unsubscribe';
|
||||
var msg = 'Unsubscribe from ' + sub.name + '?';
|
||||
var btns = [ {
|
||||
var btns = [{
|
||||
result : 'cancel',
|
||||
label : 'Cancel'
|
||||
}, {
|
||||
result : 'ok',
|
||||
label : 'OK',
|
||||
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', {
|
||||
_id: 'all',
|
||||
_type: 'category'
|
||||
_id : 'all',
|
||||
_type : 'category'
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -318,20 +316,20 @@ module.controller('FeedDetailsCtrl', ['$scope', '$state', '$stateParams', 'FeedS
|
||||
FeedService.modify({
|
||||
id : sub.id,
|
||||
name : sub.name,
|
||||
position: sub.position,
|
||||
position : sub.position,
|
||||
categoryId : sub.categoryId
|
||||
}, function() {
|
||||
CategoryService.init();
|
||||
$state.transitionTo('feeds.view', {
|
||||
_id: 'all',
|
||||
_type: 'category'
|
||||
_id : 'all',
|
||||
_type : 'category'
|
||||
});
|
||||
});
|
||||
};
|
||||
}]);
|
||||
}]);
|
||||
|
||||
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();
|
||||
|
||||
@@ -353,14 +351,14 @@ module.controller('CategoryDetailsCtrl', ['$scope', '$state', '$stateParams', 'F
|
||||
};
|
||||
return;
|
||||
}
|
||||
for (var i = 0; i < CategoryService.flatCategories.length; i++) {
|
||||
for ( var i = 0; i < CategoryService.flatCategories.length; i++) {
|
||||
var cat = CategoryService.flatCategories[i];
|
||||
if (cat.id == $stateParams._id) {
|
||||
$scope.category = {
|
||||
id: cat.id,
|
||||
name: cat.orig.name,
|
||||
position: cat.orig.position,
|
||||
parentId: cat.orig.parentId
|
||||
id : cat.id,
|
||||
name : cat.orig.name,
|
||||
position : cat.orig.position,
|
||||
parentId : cat.orig.parentId
|
||||
};
|
||||
break;
|
||||
}
|
||||
@@ -371,8 +369,8 @@ module.controller('CategoryDetailsCtrl', ['$scope', '$state', '$stateParams', 'F
|
||||
|
||||
$scope.back = function() {
|
||||
$state.transitionTo('feeds.view', {
|
||||
_id: $stateParams._id,
|
||||
_type: 'category'
|
||||
_id : $stateParams._id,
|
||||
_type : 'category'
|
||||
});
|
||||
};
|
||||
|
||||
@@ -380,17 +378,16 @@ module.controller('CategoryDetailsCtrl', ['$scope', '$state', '$stateParams', 'F
|
||||
var category = $scope.category;
|
||||
var title = 'Delete category';
|
||||
var msg = 'Delete category ' + category.name + ' ?';
|
||||
var btns = [ {
|
||||
var btns = [{
|
||||
result : 'cancel',
|
||||
label : 'Cancel'
|
||||
}, {
|
||||
result : 'ok',
|
||||
label : 'OK',
|
||||
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
|
||||
@@ -398,8 +395,8 @@ module.controller('CategoryDetailsCtrl', ['$scope', '$state', '$stateParams', 'F
|
||||
CategoryService.init();
|
||||
});
|
||||
$state.transitionTo('feeds.view', {
|
||||
_id: 'all',
|
||||
_type: 'category'
|
||||
_id : 'all',
|
||||
_type : 'category'
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -410,22 +407,34 @@ module.controller('CategoryDetailsCtrl', ['$scope', '$state', '$stateParams', 'F
|
||||
CategoryService.modify({
|
||||
id : cat.id,
|
||||
name : cat.name,
|
||||
position: cat.position,
|
||||
position : cat.position,
|
||||
parentId : cat.parentId
|
||||
}, function() {
|
||||
CategoryService.init();
|
||||
$state.transitionTo('feeds.view', {
|
||||
_id: 'all',
|
||||
_type: 'category'
|
||||
_id : 'all',
|
||||
_type : 'category'
|
||||
});
|
||||
});
|
||||
};
|
||||
}]);
|
||||
}]);
|
||||
|
||||
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');
|
||||
@@ -482,7 +488,7 @@ function($scope, $http, $state, $stateParams, $route, $location,
|
||||
$scope.$emit('emitMarkAll', {
|
||||
type : $stateParams._type,
|
||||
id : $stateParams._id,
|
||||
olderThan: olderThan,
|
||||
olderThan : olderThan,
|
||||
read : true
|
||||
});
|
||||
};
|
||||
@@ -538,10 +544,10 @@ function($scope, $http, $state, $stateParams, $route, $location,
|
||||
AnalyticsService.track('/donate');
|
||||
$state.transitionTo('feeds.help');
|
||||
};
|
||||
}]);
|
||||
}]);
|
||||
|
||||
module.controller('FeedSearchCtrl', ['$scope', '$state', '$filter', '$timeout', 'CategoryService',
|
||||
function($scope, $state, $filter, $timeout, CategoryService) {
|
||||
function($scope, $state, $filter, $timeout, CategoryService) {
|
||||
$scope.feedSearchModal = false;
|
||||
$scope.filter = null;
|
||||
$scope.focus = null;
|
||||
@@ -549,7 +555,7 @@ function($scope, $state, $filter, $timeout, CategoryService) {
|
||||
|
||||
$scope.$watch('filter', function() {
|
||||
$timeout(function() {
|
||||
if ($scope.filtered){
|
||||
if ($scope.filtered) {
|
||||
$scope.focus = $scope.filtered[0];
|
||||
}
|
||||
}, 0);
|
||||
@@ -558,12 +564,12 @@ function($scope, $state, $filter, $timeout, CategoryService) {
|
||||
var getCurrentIndex = function() {
|
||||
var index = -1;
|
||||
|
||||
if(!$scope.focus) {
|
||||
if (!$scope.focus) {
|
||||
return index;
|
||||
}
|
||||
|
||||
var filtered = $scope.filtered;
|
||||
for (var i = 0; i < filtered.length; i++) {
|
||||
for ( var i = 0; i < filtered.length; i++) {
|
||||
if ($scope.focus.id == filtered[i].id) {
|
||||
index = i;
|
||||
break;
|
||||
@@ -649,11 +655,22 @@ function($scope, $state, $filter, $timeout, CategoryService) {
|
||||
$scope.open();
|
||||
});
|
||||
|
||||
}]);
|
||||
}]);
|
||||
|
||||
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,
|
||||
@@ -773,13 +786,13 @@ function($scope, $stateParams, $http, $route, $state, $window, EntryService, Set
|
||||
|
||||
$scope.markUpTo = function(entry) {
|
||||
var entries = [];
|
||||
for (var i = 0; i < $scope.entries.length; i++) {
|
||||
for ( var i = 0; i < $scope.entries.length; i++) {
|
||||
var e = $scope.entries[i];
|
||||
if (!e.read) {
|
||||
entries.push({
|
||||
id : e.id,
|
||||
feedId : e.feedId,
|
||||
read: true
|
||||
read : true
|
||||
});
|
||||
e.read = true;
|
||||
}
|
||||
@@ -812,7 +825,7 @@ function($scope, $stateParams, $http, $route, $state, $window, EntryService, Set
|
||||
var getCurrentIndex = function() {
|
||||
var index = -1;
|
||||
if ($scope.current) {
|
||||
for (var i = 0; i < $scope.entries.length; i++) {
|
||||
for ( var i = 0; i < $scope.entries.length; i++) {
|
||||
if ($scope.current == $scope.entries[i]) {
|
||||
index = i;
|
||||
break;
|
||||
@@ -938,7 +951,7 @@ function($scope, $stateParams, $http, $route, $state, $window, EntryService, Set
|
||||
$scope.navigationMode = 'scroll';
|
||||
if (SettingsService.settings.viewMode == 'expanded') {
|
||||
$scope.current = entry;
|
||||
if(SettingsService.settings.scrollMarks) {
|
||||
if (SettingsService.settings.scrollMarks) {
|
||||
$scope.mark(entry, true);
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
@@ -1154,18 +1164,18 @@ function($scope, $stateParams, $http, $route, $state, $window, EntryService, Set
|
||||
});
|
||||
}
|
||||
});
|
||||
}]);
|
||||
}]);
|
||||
|
||||
module.controller('ManageUsersCtrl', ['$scope', '$state', '$location', 'AdminUsersService',
|
||||
function($scope, $state, $location, AdminUsersService) {
|
||||
function($scope, $state, $location, AdminUsersService) {
|
||||
$scope.users = AdminUsersService.getAll();
|
||||
$scope.selection = [];
|
||||
$scope.gridOptions = {
|
||||
data : 'users',
|
||||
selectedItems : $scope.selection,
|
||||
multiSelect : false,
|
||||
showColumnMenu: true,
|
||||
showFilter: true,
|
||||
showColumnMenu : true,
|
||||
showFilter : true,
|
||||
|
||||
afterSelectionChange : function(item) {
|
||||
$state.transitionTo('admin.useredit', {
|
||||
@@ -1180,10 +1190,10 @@ function($scope, $state, $location, AdminUsersService) {
|
||||
$scope.back = function() {
|
||||
$location.path('/admin');
|
||||
};
|
||||
}]);
|
||||
}]);
|
||||
|
||||
module.controller('ManageUserCtrl', ['$scope', '$state', '$stateParams', '$dialog', 'AdminUsersService',
|
||||
function($scope, $state, $stateParams, $dialog, AdminUsersService) {
|
||||
function($scope, $state, $stateParams, $dialog, AdminUsersService) {
|
||||
$scope.user = $stateParams._id ? AdminUsersService.get({
|
||||
id : $stateParams._id
|
||||
}) : {
|
||||
@@ -1212,14 +1222,14 @@ function($scope, $state, $stateParams, $dialog, AdminUsersService) {
|
||||
$scope.remove = function() {
|
||||
var title = 'Delete user';
|
||||
var msg = 'Delete user ' + $scope.user.name + ' ?';
|
||||
var btns = [ {
|
||||
var btns = [{
|
||||
result : 'cancel',
|
||||
label : 'Cancel'
|
||||
}, {
|
||||
result : 'ok',
|
||||
label : 'OK',
|
||||
cssClass : 'btn-primary'
|
||||
} ];
|
||||
}];
|
||||
|
||||
$dialog.messageBox(title, msg, btns).open().then(function(result) {
|
||||
if (result == 'ok') {
|
||||
@@ -1231,11 +1241,9 @@ 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;
|
||||
@@ -1244,10 +1252,10 @@ module.controller('ManageDuplicateFeedsCtrl', [
|
||||
$scope.mergeData = {};
|
||||
$scope.refreshData = function() {
|
||||
AdminCleanupService.findDuplicateFeeds({
|
||||
mode: $scope.mode,
|
||||
mode : $scope.mode,
|
||||
limit : $scope.limit,
|
||||
page : $scope.page,
|
||||
minCount: $scope.minCount
|
||||
minCount : $scope.minCount
|
||||
}, function(data) {
|
||||
$scope.counts = data;
|
||||
});
|
||||
@@ -1257,12 +1265,12 @@ module.controller('ManageDuplicateFeedsCtrl', [
|
||||
var callback = function() {
|
||||
alert('done!');
|
||||
};
|
||||
for (var i = 0; i < $scope.counts.length; i++) {
|
||||
for ( var i = 0; i < $scope.counts.length; i++) {
|
||||
var count = $scope.counts[i];
|
||||
if (count.autoMerge) {
|
||||
AdminCleanupService.mergeFeeds({
|
||||
intoFeedId: count.feeds[0].id,
|
||||
feedIds: _.pluck(count.feeds, 'id')
|
||||
intoFeedId : count.feeds[0].id,
|
||||
feedIds : _.pluck(count.feeds, 'id')
|
||||
}, callback);
|
||||
}
|
||||
}
|
||||
@@ -1283,7 +1291,7 @@ module.controller('ManageDuplicateFeedsCtrl', [
|
||||
}]);
|
||||
|
||||
module.controller('SettingsCtrl', ['$scope', '$location', 'SettingsService', 'AnalyticsService', 'ServerService',
|
||||
function($scope, $location, SettingsService, AnalyticsService, ServerService) {
|
||||
function($scope, $location, SettingsService, AnalyticsService, ServerService) {
|
||||
|
||||
AnalyticsService.track();
|
||||
|
||||
@@ -1307,10 +1315,10 @@ function($scope, $location, SettingsService, AnalyticsService, ServerService) {
|
||||
window.location.href = window.location.href.substring(0, window.location.href.lastIndexOf('#'));
|
||||
});
|
||||
};
|
||||
}]);
|
||||
}]);
|
||||
|
||||
module.controller('ProfileCtrl', ['$scope', '$location', '$dialog', 'ProfileService', 'AnalyticsService',
|
||||
function($scope, $location, $dialog, ProfileService, AnalyticsService) {
|
||||
function($scope, $location, $dialog, ProfileService, AnalyticsService) {
|
||||
|
||||
AnalyticsService.track();
|
||||
|
||||
@@ -1336,14 +1344,14 @@ function($scope, $location, $dialog, ProfileService, AnalyticsService) {
|
||||
$scope.deleteAccount = function() {
|
||||
var title = 'Delete account';
|
||||
var msg = 'Delete your acount? There\'s no turning back!';
|
||||
var btns = [ {
|
||||
var btns = [{
|
||||
result : 'cancel',
|
||||
label : 'Cancel'
|
||||
}, {
|
||||
result : 'ok',
|
||||
label : 'OK',
|
||||
cssClass : 'btn-primary'
|
||||
} ];
|
||||
}];
|
||||
|
||||
$dialog.messageBox(title, msg, btns).open().then(function(result) {
|
||||
if (result == 'ok') {
|
||||
@@ -1352,10 +1360,10 @@ function($scope, $location, $dialog, ProfileService, AnalyticsService) {
|
||||
}
|
||||
});
|
||||
};
|
||||
}]);
|
||||
}]);
|
||||
|
||||
module.controller('ManageSettingsCtrl', ['$scope', '$location', '$state', 'AdminSettingsService',
|
||||
function($scope, $location, $state, AdminSettingsService) {
|
||||
function($scope, $location, $state, AdminSettingsService) {
|
||||
|
||||
$scope.settings = AdminSettingsService.get();
|
||||
|
||||
@@ -1374,11 +1382,10 @@ function($scope, $location, $state, AdminSettingsService) {
|
||||
$scope.toCleanup = function() {
|
||||
$state.transitionTo('admin.duplicate_feeds');
|
||||
};
|
||||
}]);
|
||||
}]);
|
||||
|
||||
module.controller('HelpController', [ '$scope', 'CategoryService',
|
||||
'AnalyticsService', 'ServerService',
|
||||
function($scope, CategoryService, AnalyticsService, ServerService) {
|
||||
module.controller('HelpController', ['$scope', 'CategoryService', 'AnalyticsService', 'ServerService',
|
||||
function($scope, CategoryService, AnalyticsService, ServerService) {
|
||||
|
||||
AnalyticsService.track();
|
||||
$scope.CategoryService = CategoryService;
|
||||
@@ -1386,9 +1393,9 @@ function($scope, CategoryService, AnalyticsService, ServerService) {
|
||||
$scope.categoryId = 'all';
|
||||
$scope.order = 'desc';
|
||||
|
||||
} ]);
|
||||
}]);
|
||||
|
||||
module.controller('FooterController', [ '$scope', function($scope) {
|
||||
module.controller('FooterController', ['$scope', function($scope) {
|
||||
|
||||
var baseUrl = window.location.href.substring(0, window.location.href.lastIndexOf('#'));
|
||||
var hostname = window.location.hostname;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
var module = angular.module('commafeed.directives', []);
|
||||
|
||||
module.directive('focus', [ '$timeout', function($timeout) {
|
||||
module.directive('focus', ['$timeout', function($timeout) {
|
||||
return {
|
||||
restrict : 'A',
|
||||
link : function(scope, element, attrs) {
|
||||
@@ -13,7 +13,7 @@ module.directive('focus', [ '$timeout', function($timeout) {
|
||||
});
|
||||
}
|
||||
};
|
||||
} ]);
|
||||
}]);
|
||||
|
||||
/**
|
||||
* Open a popup window pointing to the url in the href attribute
|
||||
@@ -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,10 +113,10 @@ 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) {
|
||||
module.directive('scrollTo', ['$timeout', function($timeout) {
|
||||
return {
|
||||
restrict : 'A',
|
||||
link : function(scope, element, attrs) {
|
||||
@@ -149,7 +147,7 @@ module.directive('scrollTo', [ '$timeout', function($timeout) {
|
||||
});
|
||||
}
|
||||
};
|
||||
} ]);
|
||||
}]);
|
||||
|
||||
/**
|
||||
* Prevent mousewheel scrolling from propagating to the parent when scrollbar
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -179,7 +175,7 @@ module.directive('mousewheelScrolling', function() {
|
||||
* Needed to use recursive directives. Wrap a recursive element with a
|
||||
* <recursive> tag
|
||||
*/
|
||||
module.directive('recursive', [ '$compile', function($compile) {
|
||||
module.directive('recursive', ['$compile', function($compile) {
|
||||
return {
|
||||
restrict : 'E',
|
||||
priority : 100000,
|
||||
@@ -196,12 +192,12 @@ module.directive('recursive', [ '$compile', function($compile) {
|
||||
};
|
||||
}
|
||||
};
|
||||
} ]);
|
||||
}]);
|
||||
|
||||
/**
|
||||
* Reusable category component
|
||||
*/
|
||||
module.directive('category', [ function() {
|
||||
module.directive('category', [function() {
|
||||
return {
|
||||
scope : {
|
||||
node : '=',
|
||||
@@ -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,10 +300,9 @@ module.directive('category', [ function() {
|
||||
collapse : !category.expanded
|
||||
});
|
||||
};
|
||||
}
|
||||
]
|
||||
}]
|
||||
};
|
||||
} ]);
|
||||
}]);
|
||||
|
||||
/**
|
||||
* Reusable spinner component
|
||||
@@ -365,17 +349,16 @@ module.directive('draggable', function() {
|
||||
restrict : 'A',
|
||||
link : function(scope, element, attrs) {
|
||||
element.draggable({
|
||||
revert: 'invalid',
|
||||
helper: 'clone',
|
||||
distance: 10,
|
||||
axis: 'y'
|
||||
revert : 'invalid',
|
||||
helper : 'clone',
|
||||
distance : 10,
|
||||
axis : 'y'
|
||||
}).data('source', scope.$eval(attrs.draggable));
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
module.directive('droppable', [ 'CategoryService', 'FeedService',
|
||||
function(CategoryService, FeedService) {
|
||||
module.directive('droppable', ['CategoryService', 'FeedService', function(CategoryService, FeedService) {
|
||||
return {
|
||||
restrict : 'A',
|
||||
link : function(scope, element, attrs) {
|
||||
@@ -424,14 +407,13 @@ module.directive('droppable', [ 'CategoryService', 'FeedService',
|
||||
});
|
||||
}
|
||||
};
|
||||
} ]);
|
||||
|
||||
}]);
|
||||
|
||||
module.filter('highlight', function() {
|
||||
return function(html, keywords) {
|
||||
if (keywords) {
|
||||
var tokens = keywords.split(' ');
|
||||
for (var i = 0; i < tokens.length; i++) {
|
||||
for ( var i = 0; i < tokens.length; i++) {
|
||||
var expr = new RegExp(tokens[i], 'gi');
|
||||
var container = $('<span>').html(html);
|
||||
var elements = container.find('*').addBack();
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
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',
|
||||
app.config(['$routeProvider', '$stateProvider', '$urlRouterProvider', '$httpProvider',
|
||||
function($routeProvider, $stateProvider, $urlRouterProvider, $httpProvider) {
|
||||
|
||||
var interceptor = [ '$rootScope', '$q', function(scope, $q) {
|
||||
var interceptor = ['$rootScope', '$q', function(scope, $q) {
|
||||
|
||||
var success = function (response) {
|
||||
var success = function(response) {
|
||||
return response;
|
||||
};
|
||||
var error = function (response) {
|
||||
var error = function(response) {
|
||||
var status = response.status;
|
||||
if (status == 401) {
|
||||
window.location = 'logout';
|
||||
@@ -26,7 +24,7 @@ app.config([ '$routeProvider', '$stateProvider', '$urlRouterProvider', '$httpPro
|
||||
};
|
||||
|
||||
return promise;
|
||||
} ];
|
||||
}];
|
||||
|
||||
$httpProvider.responseInterceptors.push(interceptor);
|
||||
|
||||
@@ -106,4 +104,4 @@ app.config([ '$routeProvider', '$stateProvider', '$urlRouterProvider', '$httpPro
|
||||
$urlRouterProvider.when('/admin', '/admin/settings');
|
||||
$urlRouterProvider.otherwise('/');
|
||||
|
||||
} ]);
|
||||
}]);
|
||||
@@ -1,6 +1,6 @@
|
||||
var module = angular.module('commafeed.services', [ 'ngResource' ]);
|
||||
var module = angular.module('commafeed.services', ['ngResource']);
|
||||
|
||||
module.service('AnalyticsService', [ '$state', function($state) {
|
||||
module.service('AnalyticsService', ['$state', function($state) {
|
||||
this.track = function(path) {
|
||||
if (typeof ga === 'undefined') {
|
||||
return;
|
||||
@@ -10,9 +10,9 @@ module.service('AnalyticsService', [ '$state', function($state) {
|
||||
page : path
|
||||
});
|
||||
};
|
||||
} ]);
|
||||
}]);
|
||||
|
||||
module.service('MobileService', [ '$state', function($state) {
|
||||
module.service('MobileService', ['$state', function($state) {
|
||||
this.leftMenu = false;
|
||||
this.rightMenu = false;
|
||||
this.toggleLeftMenu = function() {
|
||||
@@ -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);
|
||||
@@ -146,7 +143,7 @@ function($resource, $http) {
|
||||
array.push({
|
||||
id : category.id,
|
||||
name : name,
|
||||
orig: category
|
||||
orig : category
|
||||
});
|
||||
};
|
||||
traverse(callback, category);
|
||||
@@ -165,12 +162,12 @@ function($resource, $http) {
|
||||
|
||||
// flatten everything
|
||||
var flatAll = function(category, a) {
|
||||
a.push([ category.id, 'category' ]);
|
||||
a.push([category.id, 'category']);
|
||||
_.each(category.children, function(child) {
|
||||
flatAll(child, a);
|
||||
});
|
||||
_.each(category.feeds, function(feed) {
|
||||
a.push([ feed.id, 'feed' ]);
|
||||
a.push([feed.id, 'feed']);
|
||||
});
|
||||
};
|
||||
|
||||
@@ -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',
|
||||
@@ -299,7 +295,7 @@ module.factory('AdminCleanupService', ['$resource', function($resource) {
|
||||
var actions = {
|
||||
findDuplicateFeeds : {
|
||||
method : 'GET',
|
||||
isArray: true,
|
||||
isArray : true,
|
||||
params : {
|
||||
_method : 'findDuplicateFeeds'
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user