diff options
-rw-r--r-- | js/Gruntfile.js | 2 | ||||
-rw-r--r-- | js/bower.json | 2 | ||||
-rw-r--r-- | js/build/app.js | 2702 | ||||
-rw-r--r-- | js/build/app.min.js | 2 | ||||
-rw-r--r-- | js/directive/NewsAutoFocus.js | 2 | ||||
-rw-r--r-- | js/gui/KeyboardShortcuts.js | 10 | ||||
-rw-r--r-- | js/package.json | 2 | ||||
-rw-r--r-- | js/vendor/traceur-runtime/traceur-runtime.min.js | 2415 |
8 files changed, 3769 insertions, 1368 deletions
diff --git a/js/Gruntfile.js b/js/Gruntfile.js index 6ad6d7a1c..f2df36050 100644 --- a/js/Gruntfile.js +++ b/js/Gruntfile.js @@ -69,7 +69,7 @@ module.exports = function (grunt) { // is supported shell: { traceur: { - command: 'node_modules/traceur/traceur --modules inline --out build/app.js --experimental build/app.js ' + command: 'node_modules/traceur/traceur --block-binding true --out build/app.js --experimental --script build/app.js' } }, /*traceur: { diff --git a/js/bower.json b/js/bower.json index 3b0555c82..a069fe820 100644 --- a/js/bower.json +++ b/js/bower.json @@ -31,6 +31,6 @@ "angular-animate": "~1.3.*", "jquery": "~2.*", "momentjs": "~2.8.*", - "traceur-runtime": "~0.0.60" + "traceur-runtime": "~0.0.61" } } diff --git a/js/build/app.js b/js/build/app.js index f7c28b0b5..aea02b060 100644 --- a/js/build/app.js +++ b/js/build/app.js @@ -1,1424 +1,1420 @@ -var $__app__ = (function() { - "use strict"; - var __moduleName = "app"; - (function(window, document, angular, $, OC, csrfToken, undefined) { +(function(window, document, angular, $, OC, csrfToken, undefined) { + 'use strict'; + var app = angular.module('News', ['ngRoute', 'ngSanitize', 'ngAnimate']); + app.config(["$routeProvider", "$provide", "$httpProvider", function($routeProvider, $provide, $httpProvider) { 'use strict'; - var app = angular.module('News', ['ngRoute', 'ngSanitize', 'ngAnimate']); - app.config(["$routeProvider", "$provide", "$httpProvider", function($routeProvider, $provide, $httpProvider) { - 'use strict'; - var feedType = { - FEED: 0, - FOLDER: 1, - STARRED: 2, - SUBSCRIPTIONS: 3, - SHARED: 4 - }; - $provide.constant('REFRESH_RATE', 60); - $provide.constant('ITEM_BATCH_SIZE', 50); - $provide.constant('BASE_URL', OC.generateUrl('/apps/news')); - $provide.constant('FEED_TYPE', feedType); - $provide.factory('CSRFInterceptor', (["$q", "BASE_URL", function($q, BASE_URL) { - return {request: (function(config) { - if (config.url.indexOf(BASE_URL) === 0) { - config.headers.requesttoken = csrfToken; - } - return config || $q.when(config); - })}; - }])); - $httpProvider.interceptors.push('CSRFInterceptor'); - var getResolve = (function(type) { - return {data: ['$http', '$route', '$q', 'BASE_URL', 'ITEM_BATCH_SIZE', (function($http, $route, $q, BASE_URL, ITEM_BATCH_SIZE) { - var parameters = { - type: type, - limit: ITEM_BATCH_SIZE - }; - if ($route.current.params.id !== undefined) { - parameters.id = $route.current.params.id; - } - var deferred = $q.defer(); - $http({ - url: (BASE_URL + "/items"), - method: 'GET', - params: parameters - }).success((function(data) { - deferred.resolve(data); - })); - return deferred.promise; - })]}; - }); - $routeProvider.when('/items', { - controller: 'ContentController as Content', - templateUrl: 'content.html', - resolve: getResolve(feedType.SUBSCRIPTIONS), - type: feedType.SUBSCRIPTIONS - }).when('/items/starred', { - controller: 'ContentController as Content', - templateUrl: 'content.html', - resolve: getResolve(feedType.STARRED), - type: feedType.STARRED - }).when('/items/feeds/:id', { - controller: 'ContentController as Content', - templateUrl: 'content.html', - resolve: getResolve(feedType.FEED), - type: feedType.FEED - }).when('/items/folders/:id', { - controller: 'ContentController as Content', - templateUrl: 'content.html', - resolve: getResolve(feedType.FOLDER), - type: feedType.FOLDER - }); - }]); - app.run((["$rootScope", "$location", "$http", "$q", "$interval", "Loading", "ItemResource", "FeedResource", "FolderResource", "SettingsResource", "Publisher", "BASE_URL", "FEED_TYPE", "REFRESH_RATE", function($rootScope, $location, $http, $q, $interval, Loading, ItemResource, FeedResource, FolderResource, SettingsResource, Publisher, BASE_URL, FEED_TYPE, REFRESH_RATE) { - 'use strict'; - Loading.setLoading('global', true); - Publisher.subscribe(ItemResource).toChannels('items', 'newestItemId', 'starred'); - Publisher.subscribe(FolderResource).toChannels('folders'); - Publisher.subscribe(FeedResource).toChannels('feeds'); - Publisher.subscribe(SettingsResource).toChannels('settings'); - var settingsDeferred = $q.defer(); - $http.get((BASE_URL + "/settings")).success((function(data) { - Publisher.publishAll(data); - settingsDeferred.resolve(); - })); - var activeFeedDeferred = $q.defer(); - var path = $location.path(); - $http.get((BASE_URL + "/feeds/active")).success((function(data) { - var url; - switch (data.activeFeed.type) { - case FEED_TYPE.FEED: - url = ("/items/feeds/" + data.activeFeed.id); - break; - case FEED_TYPE.FOLDER: - url = ("/items/folders/" + data.activeFeed.id); - break; - case FEED_TYPE.STARRED: - url = '/items/starred'; - break; - default: - url = '/items'; - } - if (!/^\/items(\/(starred|feeds\/\d+|folders\/\d+))?\/?$/.test(path)) { - $location.path(url); - } - activeFeedDeferred.resolve(); - })); - var folderDeferred = $q.defer(); - $http.get((BASE_URL + "/folders")).success((function(data) { - Publisher.publishAll(data); - folderDeferred.resolve(); - })); - var feedDeferred = $q.defer(); - $http.get((BASE_URL + "/feeds")).success((function(data) { - Publisher.publishAll(data); - feedDeferred.resolve(); - })); - $q.all([settingsDeferred.promise, activeFeedDeferred.promise, feedDeferred.promise, folderDeferred.promise]).then((function() { - Loading.setLoading('global', false); - })); - $interval((function() { - $http.get((BASE_URL + "/feeds")); - $http.get((BASE_URL + "/folders")); - }), REFRESH_RATE * 1000); - $rootScope.$on('$routeChangeStart', (function() { - Loading.setLoading('content', true); - })); - $rootScope.$on('$routeChangeSuccess', (function() { - Loading.setLoading('content', false); - })); - $rootScope.$on('$routeChangeError', (function() { - $location.path('/items'); - })); + var feedType = { + FEED: 0, + FOLDER: 1, + STARRED: 2, + SUBSCRIPTIONS: 3, + SHARED: 4 + }; + $provide.constant('REFRESH_RATE', 60); + $provide.constant('ITEM_BATCH_SIZE', 50); + $provide.constant('BASE_URL', OC.generateUrl('/apps/news')); + $provide.constant('FEED_TYPE', feedType); + $provide.factory('CSRFInterceptor', (["$q", "BASE_URL", function($q, BASE_URL) { + return {request: (function(config) { + if (config.url.indexOf(BASE_URL) === 0) { + config.headers.requesttoken = csrfToken; + } + return config || $q.when(config); + })}; }])); - app.controller('AppController', ["Loading", "FeedResource", "FolderResource", function(Loading, FeedResource, FolderResource) { - 'use strict'; - this.loading = Loading; - this.isFirstRun = (function() { - return FeedResource.size() === 0 && FolderResource.size() === 0; - }); - }]); - app.controller('ContentController', ["Publisher", "FeedResource", "ItemResource", "SettingsResource", "data", "$route", "$routeParams", function(Publisher, FeedResource, ItemResource, SettingsResource, data, $route, $routeParams) { - 'use strict'; - var $__0 = this; - ItemResource.clear(); + $httpProvider.interceptors.push('CSRFInterceptor'); + var getResolve = (function(type) { + return {data: ['$http', '$route', '$q', 'BASE_URL', 'ITEM_BATCH_SIZE', (function($http, $route, $q, BASE_URL, ITEM_BATCH_SIZE) { + var parameters = { + type: type, + limit: ITEM_BATCH_SIZE + }; + if ($route.current.params.id !== undefined) { + parameters.id = $route.current.params.id; + } + var deferred = $q.defer(); + $http({ + url: (BASE_URL + "/items"), + method: 'GET', + params: parameters + }).success((function(data) { + deferred.resolve(data); + })); + return deferred.promise; + })]}; + }); + $routeProvider.when('/items', { + controller: 'ContentController as Content', + templateUrl: 'content.html', + resolve: getResolve(feedType.SUBSCRIPTIONS), + type: feedType.SUBSCRIPTIONS + }).when('/items/starred', { + controller: 'ContentController as Content', + templateUrl: 'content.html', + resolve: getResolve(feedType.STARRED), + type: feedType.STARRED + }).when('/items/feeds/:id', { + controller: 'ContentController as Content', + templateUrl: 'content.html', + resolve: getResolve(feedType.FEED), + type: feedType.FEED + }).when('/items/folders/:id', { + controller: 'ContentController as Content', + templateUrl: 'content.html', + resolve: getResolve(feedType.FOLDER), + type: feedType.FOLDER + }); + }]); + app.run((["$rootScope", "$location", "$http", "$q", "$interval", "Loading", "ItemResource", "FeedResource", "FolderResource", "SettingsResource", "Publisher", "BASE_URL", "FEED_TYPE", "REFRESH_RATE", function($rootScope, $location, $http, $q, $interval, Loading, ItemResource, FeedResource, FolderResource, SettingsResource, Publisher, BASE_URL, FEED_TYPE, REFRESH_RATE) { + 'use strict'; + Loading.setLoading('global', true); + Publisher.subscribe(ItemResource).toChannels('items', 'newestItemId', 'starred'); + Publisher.subscribe(FolderResource).toChannels('folders'); + Publisher.subscribe(FeedResource).toChannels('feeds'); + Publisher.subscribe(SettingsResource).toChannels('settings'); + var settingsDeferred = $q.defer(); + $http.get((BASE_URL + "/settings")).success((function(data) { Publisher.publishAll(data); - this.isAutoPagingEnabled = true; - this.getItems = (function() { - return ItemResource.getAll(); - }); - this.toggleStar = (function(itemId) { - ItemResource.toggleStar(itemId); - }); - this.toggleItem = (function(item) { - if ($__0.isCompactView()) { - item.show = !item.show; + settingsDeferred.resolve(); + })); + var activeFeedDeferred = $q.defer(); + var path = $location.path(); + $http.get((BASE_URL + "/feeds/active")).success((function(data) { + var url; + switch (data.activeFeed.type) { + case FEED_TYPE.FEED: + url = ("/items/feeds/" + data.activeFeed.id); + break; + case FEED_TYPE.FOLDER: + url = ("/items/folders/" + data.activeFeed.id); + break; + case FEED_TYPE.STARRED: + url = '/items/starred'; + break; + default: + url = '/items'; + } + if (!/^\/items(\/(starred|feeds\/\d+|folders\/\d+))?\/?$/.test(path)) { + $location.path(url); + } + activeFeedDeferred.resolve(); + })); + var folderDeferred = $q.defer(); + $http.get((BASE_URL + "/folders")).success((function(data) { + Publisher.publishAll(data); + folderDeferred.resolve(); + })); + var feedDeferred = $q.defer(); + $http.get((BASE_URL + "/feeds")).success((function(data) { + Publisher.publishAll(data); + feedDeferred.resolve(); + })); + $q.all([settingsDeferred.promise, activeFeedDeferred.promise, feedDeferred.promise, folderDeferred.promise]).then((function() { + Loading.setLoading('global', false); + })); + $interval((function() { + $http.get((BASE_URL + "/feeds")); + $http.get((BASE_URL + "/folders")); + }), REFRESH_RATE * 1000); + $rootScope.$on('$routeChangeStart', (function() { + Loading.setLoading('content', true); + })); + $rootScope.$on('$routeChangeSuccess', (function() { + Loading.setLoading('content', false); + })); + $rootScope.$on('$routeChangeError', (function() { + $location.path('/items'); + })); + }])); + app.controller('AppController', ["Loading", "FeedResource", "FolderResource", function(Loading, FeedResource, FolderResource) { + 'use strict'; + this.loading = Loading; + this.isFirstRun = (function() { + return FeedResource.size() === 0 && FolderResource.size() === 0; + }); + }]); + app.controller('ContentController', ["Publisher", "FeedResource", "ItemResource", "SettingsResource", "data", "$route", "$routeParams", function(Publisher, FeedResource, ItemResource, SettingsResource, data, $route, $routeParams) { + 'use strict'; + var $__0 = this; + ItemResource.clear(); + Publisher.publishAll(data); + this.isAutoPagingEnabled = true; + this.getItems = (function() { + return ItemResource.getAll(); + }); + this.toggleStar = (function(itemId) { + ItemResource.toggleStar(itemId); + }); + this.toggleItem = (function(item) { + if ($__0.isCompactView()) { + item.show = !item.show; + } + }); + this.markRead = (function(itemId) { + var item = ItemResource.get(itemId); + if (!item.keepUnread) { + ItemResource.markItemRead(itemId); + FeedResource.markItemOfFeedRead(item.feedId); + } + }); + this.getFeed = (function(feedId) { + return FeedResource.getById(feedId); + }); + this.toggleKeepUnread = (function(itemId) { + var item = ItemResource.get(itemId); + if (!item.unread) { + FeedResource.markItemOfFeedUnread(item.feedId); + ItemResource.markItemRead(itemId, false); + } + item.keepUnread = !item.keepUnread; + }); + this.orderBy = (function() { + if (SettingsResource.get('oldestFirst')) { + return '-id'; + } else { + return 'id'; + } + }); + this.isCompactView = (function() { + return SettingsResource.get('compact'); + }); + this.autoPagingEnabled = (function() { + return $__0.isAutoPagingEnabled; + }); + this.markReadEnabled = (function() { + return !SettingsResource.get('preventReadOnScroll'); + }); + this.scrollRead = (function(itemIds) { + var itemId$__9; + var item$__10; + var ids = []; + var feedIds = []; + for (var $__3 = itemIds[$traceurRuntime.toProperty(Symbol.iterator)](), + $__4; !($__4 = $__3.next()).done; ) { + itemId$__9 = $__4.value; + { + item$__10 = ItemResource.get(itemId$__9); + if (!item$__10.keepUnread) { + ids.push(itemId$__9); + feedIds.push(item$__10.feedId); + } } - }); - this.markRead = (function(itemId) { - var item = ItemResource.get(itemId); - if (!item.keepUnread) { - ItemResource.markItemRead(itemId); - FeedResource.markItemOfFeedRead(item.feedId); + } + FeedResource.markItemsOfFeedsRead(feedIds); + ItemResource.markItemsRead(ids); + }); + this.autoPage = (function() { + $__0.isAutoPagingEnabled = false; + var type = $route.current.$$route.type; + var id = $routeParams.id; + ItemResource.autoPage(type, id).success((function(data) { + Publisher.publishAll(data); + if (data.items.length > 0) { + $__0.isAutoPagingEnabled = true; } - }); - this.getFeed = (function(feedId) { - return FeedResource.getById(feedId); - }); - this.toggleKeepUnread = (function(itemId) { - var item = ItemResource.get(itemId); - if (!item.unread) { - FeedResource.markItemOfFeedUnread(item.feedId); - ItemResource.markItemRead(itemId, false); + })).error((function() { + $__0.isAutoPagingEnabled = true; + })); + }); + this.getRelativeDate = (function(timestamp) { + var languageCode$__11; + var date$__12; + if (timestamp !== undefined && timestamp !== '') { + languageCode$__11 = SettingsResource.get('language'); + date$__12 = moment.unix(timestamp).locale(languageCode$__11).fromNow() + ''; + return date$__12; + } else { + return ''; + } + }); + }]); + app.controller('NavigationController', ["$route", "FEED_TYPE", "FeedResource", "FolderResource", "ItemResource", "SettingsResource", function($route, FEED_TYPE, FeedResource, FolderResource, ItemResource, SettingsResource) { + 'use strict'; + var $__0 = this; + this.feedError = ''; + this.folderError = ''; + this.getFeeds = (function() { + return FeedResource.getAll(); + }); + this.getFolders = (function() { + return FolderResource.getAll(); + }); + this.markFolderRead = (function(folderId) { + var feed$__13; + FeedResource.markFolderRead(folderId); + for (var $__3 = FeedResource.getByFolderId(folderId)[$traceurRuntime.toProperty(Symbol.iterator)](), + $__4; !($__4 = $__3.next()).done; ) { + feed$__13 = $__4.value; + { + ItemResource.markFeedRead(feed$__13.id); } - item.keepUnread = !item.keepUnread; - }); - this.orderBy = (function() { - if (SettingsResource.get('oldestFirst')) { - return '-id'; - } else { - return 'id'; + } + }); + this.markFeedRead = (function(feedId) { + ItemResource.markFeedRead(feedId); + FeedResource.markFeedRead(feedId); + }); + this.markRead = (function() { + ItemResource.markRead(); + FeedResource.markRead(); + }); + this.isShowAll = (function() { + return SettingsResource.get('showAll'); + }); + this.getFeedsOfFolder = (function(folderId) { + return FeedResource.getByFolderId(folderId); + }); + this.getUnreadCount = (function() { + return FeedResource.getUnreadCount(); + }); + this.getFeedUnreadCount = (function(feedId) { + return FeedResource.getById(feedId).unreadCount; + }); + this.getFolderUnreadCount = (function(folderId) { + return FeedResource.getFolderUnreadCount(folderId); + }); + this.getStarredCount = (function() { + return ItemResource.getStarredCount(); + }); + this.toggleFolder = (function(folderName) { + FolderResource.toggleOpen(folderName); + }); + this.hasFeeds = (function(folderId) { + return FeedResource.getFolderUnreadCount(folderId) !== undefined; + }); + this.subFeedActive = (function(folderId) { + var feed$__14; + var type = $route.current.$$route.type; + if (type === FEED_TYPE.FEED) { + feed$__14 = FeedResource.getById($route.current.params.id); + if (feed$__14.folderId === folderId) { + return true; } - }); - this.isCompactView = (function() { - return SettingsResource.get('compact'); - }); - this.autoPagingEnabled = (function() { - return $__0.isAutoPagingEnabled; - }); - this.markReadEnabled = (function() { - return !SettingsResource.get('preventReadOnScroll'); - }); - this.scrollRead = (function(itemIds) { - var itemId$__9; - var item$__10; - var ids = []; - var feedIds = []; - for (var $__3 = itemIds[$traceurRuntime.toProperty(Symbol.iterator)](), + } + return false; + }); + this.isSubscriptionsActive = (function() { + return $route.current && $route.current.$$route.type === FEED_TYPE.SUBSCRIPTIONS; + }); + this.isStarredActive = (function() { + return $route.current && $route.current.$$route.type === FEED_TYPE.STARRED; + }); + this.isFolderActive = (function(folderId) { + var currentId = parseInt($route.current.params.id, 10); + return $route.current && $route.current.$$route.type === FEED_TYPE.FOLDER && currentId === folderId; + }); + this.isFeedActive = (function(feedId) { + var currentId = parseInt($route.current.params.id, 10); + return $route.current && $route.current.$$route.type === FEED_TYPE.FEED && currentId === feedId; + }); + this.folderNameExists = (function(folderName) { + return FolderResource.get(folderName) !== undefined; + }); + this.isAddingFolder = (function() { + return true; + }); + this.createFolder = (function(folder) { + console.log(folder.name); + folder.name = ''; + }); + this.createFeed = (function(feed) { + $__0.newFolder = false; + console.log(feed.url + feed.folder); + feed.url = ''; + }); + this.renameFeed = (function(feed) { + feed.editing = false; + }); + this.renameFolder = (function() { + console.log('TBD'); + }); + this.deleteFeed = (function(feed) { + feed.deleted = true; + }); + this.undeleteFeed = (function(feed) { + feed.deleted = false; + }); + this.removeFeed = (function(feed) { + console.log('remove ' + feed); + }); + this.deleteFolder = (function(folderName) { + console.log(folderName); + }); + this.moveFeed = (function(feedId, folderId) { + console.log(feedId + folderId); + }); + }]); + app.controller('SettingsController', ["$route", "SettingsResource", "FeedResource", function($route, SettingsResource, FeedResource) { + 'use strict'; + var $__0 = this; + this.importing = false; + this.opmlImportError = false; + this.articleImportError = false; + var set = (function(key, value) { + SettingsResource.set(key, value); + if (['showAll', 'oldestFirst'].indexOf(key) >= 0) { + $route.reload(); + } + }); + this.toggleSetting = (function(key) { + set(key, !$__0.getSetting(key)); + }); + this.getSetting = (function(key) { + return SettingsResource.get(key); + }); + this.feedSize = (function() { + return FeedResource.size(); + }); + this.importOpml = (function(content) { + console.log(content); + }); + this.importArticles = (function(content) { + console.log(content); + }); + }]); + app.filter('trustUrl', (["$sce", function($sce) { + 'use strict'; + return (function(url) { + return $sce.trustAsResourceUrl(url); + }); + }])); + app.filter('unreadCountFormatter', (function() { + 'use strict'; + return (function(unreadCount) { + if (unreadCount > 999) { + return '999+'; + } + return unreadCount; + }); + })); + app.factory('FeedResource', (["Resource", "$http", "BASE_URL", function(Resource, $http, BASE_URL) { + 'use strict'; + var FeedResource = function FeedResource($http, BASE_URL) { + $traceurRuntime.superCall(this, $FeedResource.prototype, "constructor", [$http, BASE_URL, 'url']); + this.ids = {}; + this.unreadCount = 0; + this.folderUnreadCount = {}; + this.folderIds = {}; + this.deleted = null; + }; + var $FeedResource = FeedResource; + ($traceurRuntime.createClass)(FeedResource, { + receive: function(data) { + $traceurRuntime.superCall(this, $FeedResource.prototype, "receive", [data]); + this.updateUnreadCache(); + this.updateFolderCache(); + }, + updateUnreadCache: function() { + var $__57, + $__58, + $__59, + $__60, + $__61; + var value$__15; + this.unreadCount = 0; + this.folderUnreadCount = {}; + for (var $__3 = this.values[$traceurRuntime.toProperty(Symbol.iterator)](), $__4; !($__4 = $__3.next()).done; ) { - itemId$__9 = $__4.value; + value$__15 = $__4.value; { - item$__10 = ItemResource.get(itemId$__9); - if (!item$__10.keepUnread) { - ids.push(itemId$__9); - feedIds.push(item$__10.feedId); + if (value$__15.unreadCount) { + this.unreadCount += value$__15.unreadCount; + } + if (value$__15.folderId !== undefined) { + $traceurRuntime.setProperty(this.folderUnreadCount, value$__15.folderId, this.folderUnreadCount[$traceurRuntime.toProperty(value$__15.folderId)] || 0); + ($__57 = this.folderUnreadCount, $__58 = value$__15.folderId, $__59 = value$__15.unreadCount, $__60 = $__57[$traceurRuntime.toProperty($__58)], $__61 = $__60 + $__59, $traceurRuntime.setProperty($__57, $__58, $__61), $__61); } } } - FeedResource.markItemsOfFeedsRead(feedIds); - ItemResource.markItemsRead(ids); - }); - this.autoPage = (function() { - $__0.isAutoPagingEnabled = false; - var type = $route.current.$$route.type; - var id = $routeParams.id; - ItemResource.autoPage(type, id).success((function(data) { - Publisher.publishAll(data); - if (data.items.length > 0) { - $__0.isAutoPagingEnabled = true; - } - })).error((function() { - $__0.isAutoPagingEnabled = true; - })); - }); - this.getRelativeDate = (function(timestamp) { - var languageCode$__11; - var date$__12; - if (timestamp !== undefined && timestamp !== '') { - languageCode$__11 = SettingsResource.get('language'); - date$__12 = moment.unix(timestamp).locale(languageCode$__11).fromNow() + ''; - return date$__12; - } else { - return ''; - } - }); - }]); - app.controller('NavigationController', ["$route", "FEED_TYPE", "FeedResource", "FolderResource", "ItemResource", "SettingsResource", function($route, FEED_TYPE, FeedResource, FolderResource, ItemResource, SettingsResource) { - 'use strict'; - var $__0 = this; - this.feedError = ''; - this.folderError = ''; - this.getFeeds = (function() { - return FeedResource.getAll(); - }); - this.getFolders = (function() { - return FolderResource.getAll(); - }); - this.markFolderRead = (function(folderId) { - var feed$__13; - FeedResource.markFolderRead(folderId); - for (var $__3 = FeedResource.getByFolderId(folderId)[$traceurRuntime.toProperty(Symbol.iterator)](), + }, + updateFolderCache: function() { + var feed$__16; + this.folderIds = {}; + for (var $__3 = this.values[$traceurRuntime.toProperty(Symbol.iterator)](), $__4; !($__4 = $__3.next()).done; ) { - feed$__13 = $__4.value; + feed$__16 = $__4.value; { - ItemResource.markFeedRead(feed$__13.id); + $traceurRuntime.setProperty(this.folderIds, feed$__16.folderId, this.folderIds[$traceurRuntime.toProperty(feed$__16.folderId)] || []); + this.folderIds[$traceurRuntime.toProperty(feed$__16.folderId)].push(feed$__16); } } - }); - this.markFeedRead = (function(feedId) { - ItemResource.markFeedRead(feedId); - FeedResource.markFeedRead(feedId); - }); - this.markRead = (function() { - ItemResource.markRead(); - FeedResource.markRead(); - }); - this.isShowAll = (function() { - return SettingsResource.get('showAll'); - }); - this.getFeedsOfFolder = (function(folderId) { - return FeedResource.getByFolderId(folderId); - }); - this.getUnreadCount = (function() { - return FeedResource.getUnreadCount(); - }); - this.getFeedUnreadCount = (function(feedId) { - return FeedResource.getById(feedId).unreadCount; - }); - this.getFolderUnreadCount = (function(folderId) { - return FeedResource.getFolderUnreadCount(folderId); - }); - this.getStarredCount = (function() { - return ItemResource.getStarredCount(); - }); - this.toggleFolder = (function(folderName) { - FolderResource.toggleOpen(folderName); - }); - this.hasFeeds = (function(folderId) { - return FeedResource.getFolderUnreadCount(folderId) !== undefined; - }); - this.subFeedActive = (function(folderId) { - var feed$__14; - var type = $route.current.$$route.type; - if (type === FEED_TYPE.FEED) { - feed$__14 = FeedResource.getById($route.current.params.id); - if (feed$__14.folderId === folderId) { - return true; - } + }, + add: function(value) { + $traceurRuntime.superCall(this, $FeedResource.prototype, "add", [value]); + if (value.id !== undefined) { + $traceurRuntime.setProperty(this.ids, value.id, this.hashMap[$traceurRuntime.toProperty(value.url)]); } - return false; - }); - this.isSubscriptionsActive = (function() { - return $route.current && $route.current.$$route.type === FEED_TYPE.SUBSCRIPTIONS; - }); - this.isStarredActive = (function() { - return $route.current && $route.current.$$route.type === FEED_TYPE.STARRED; - }); - this.isFolderActive = (function(folderId) { - var currentId = parseInt($route.current.params.id, 10); - return $route.current && $route.current.$$route.type === FEED_TYPE.FOLDER && currentId === folderId; - }); - this.isFeedActive = (function(feedId) { - var currentId = parseInt($route.current.params.id, 10); - return $route.current && $route.current.$$route.type === FEED_TYPE.FEED && currentId === feedId; - }); - this.folderNameExists = (function(folderName) { - return FolderResource.get(folderName) !== undefined; - }); - this.isAddingFolder = (function() { - return true; - }); - this.createFolder = (function(folder) { - console.log(folder.name); - folder.name = ''; - }); - this.createFeed = (function(feed) { - $__0.newFolder = false; - console.log(feed.url + feed.folder); - feed.url = ''; - }); - this.renameFeed = (function(feed) { - feed.editing = false; - }); - this.renameFolder = (function() { - console.log('TBD'); - }); - this.deleteFeed = (function(feed) { - feed.deleted = true; - }); - this.undeleteFeed = (function(feed) { - feed.deleted = false; - }); - this.removeFeed = (function(feed) { - console.log('remove ' + feed); - }); - this.deleteFolder = (function(folderName) { - console.log(folderName); - }); - this.moveFeed = (function(feedId, folderId) { - console.log(feedId + folderId); - }); - }]); - app.controller('SettingsController', ["$route", "SettingsResource", "FeedResource", function($route, SettingsResource, FeedResource) { - 'use strict'; - var $__0 = this; - this.importing = false; - this.opmlImportError = false; - this.articleImportError = false; - var set = (function(key, value) { - SettingsResource.set(key, value); - if (['showAll', 'oldestFirst'].indexOf(key) >= 0) { - $route.reload(); - } - }); - this.toggleSetting = (function(key) { - set(key, !$__0.getSetting(key)); - }); - this.getSetting = (function(key) { - return SettingsResource.get(key); - }); - this.feedSize = (function() { - return FeedResource.size(); - }); - this.importOpml = (function(content) { - console.log(content); - }); - this.importArticles = (function(content) { - console.log(content); - }); - }]); - app.filter('trustUrl', (["$sce", function($sce) { - 'use strict'; - return (function(url) { - return $sce.trustAsResourceUrl(url); |