diff options
Diffstat (limited to 'js/public/app.js')
-rw-r--r-- | js/public/app.js | 412 |
1 files changed, 374 insertions, 38 deletions
diff --git a/js/public/app.js b/js/public/app.js index a4dda620b..b7c4b1aa8 100644 --- a/js/public/app.js +++ b/js/public/app.js @@ -1,3 +1,4 @@ +(function(angular, $, moment, undefined){ /** * ownCloud News App - v0.0.1 @@ -10,7 +11,7 @@ */ -// Generated by CoffeeScript 1.6.3 +// Generated by CoffeeScript 1.6.2 /* ownCloud - News @@ -36,6 +37,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. (function() { angular.module('News', ['OC', 'ui']).config(function($provide) { var config; + return $provide.value('Config', config = { markReadTimeout: 500, scrollTimeout: 500, @@ -48,7 +50,6 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. angular.module('News').run([ 'Persistence', 'Config', function(Persistence, Config) { - Persistence.init(); return setInterval(function() { Persistence.getAllFeeds(null, false); return Persistence.getAllFolders(null, false); @@ -67,7 +68,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. }).call(this); -// Generated by CoffeeScript 1.6.3 +// Generated by CoffeeScript 1.6.2 /* ownCloud - News @@ -93,6 +94,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. (function() { angular.module('News').directive('newsAudio', function() { var directive; + return directive = { restrict: 'E', scope: { @@ -103,6 +105,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. template: '' + '<audio controls="controls" preload="none" ng-hide="cantPlay()">' + '<source src="{{ src }}">' + '</audio>' + '<a href="{{ src }}" class="button" ng-show="cantPlay()" ' + 'ng-transclude></a>', link: function(scope, elm, attrs) { var cantPlay, source; + source = elm.children().children('source')[0]; cantPlay = false; source.addEventListener('error', function() { @@ -119,7 +122,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. }).call(this); -// Generated by CoffeeScript 1.6.3 +// Generated by CoffeeScript 1.6.2 /* ownCloud - News @@ -147,6 +150,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. '$rootScope', function($rootScope) { return function(scope, elm, attr) { var $elem, details; + $elem = $(elm); details = { accept: '.feed', @@ -154,6 +158,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. greedy: true, drop: function(event, ui) { var data; + $('.drag-and-drop').removeClass('drag-and-drop'); data = { folderId: parseInt($elem.data('id'), 10), @@ -170,7 +175,101 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. }).call(this); -// Generated by CoffeeScript 1.6.3 +// Generated by CoffeeScript 1.6.2 +/* + +ownCloud - News + +@author Alessandro Cosentino +@copyright 2013 Alessandro Cosentino cosenal@gmail.com + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +License as published by the Free Software Foundation; either +version 3 of the License, or any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU AFFERO GENERAL PUBLIC LICENSE for more details. + +You should have received a copy of the GNU Affero General Public +License along with this library. If not, see <http://www.gnu.org/licenses/>. +*/ + + +(function() { + angular.module('News').directive('globalShortcuts', [ + '$window', function($window) { + return function(scope, elm, attr) { + var jumpTo; + + jumpTo = function($scrollArea, $item) { + var position; + + position = $item.offset().top - $scrollArea.offset().top + $scrollArea.scrollTop(); + return $scrollArea.scrollTop(position); + }; + return $($window.document).keydown(function(e) { + var focused; + + focused = $(':focus'); + if (!(focused.is('input') || focused.is('select') || focused.is('textarea') || focused.is('checkbox') || focused.is('button'))) { + if (e.keyCode === 191) { + return jumpToNextItem(scrollArea); + } + } + }); + }; + } + ]); + +}).call(this); + +// Generated by CoffeeScript 1.6.2 +/* + +ownCloud - News + +@author Alessandro Cosentino +@copyright 2013 Alessandro Cosentino cosenal@gmail.com + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +License as published by the Free Software Foundation; either +version 3 of the License, or any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU AFFERO GENERAL PUBLIC LICENSE for more details. + +You should have received a copy of the GNU Affero General Public +License along with this library. If not, see <http://www.gnu.org/licenses/>. +*/ + + +(function() { + angular.module('News').directive('hideOnClick', function() { + return function(scope, elm, attr) { + var options; + + options = scope.$eval(attr.hideOnClick); + if (angular.isDefined(options) && angular.isDefined(options.selector)) { + return $(elm).click(function() { + return $(options.selector).fadeOut(); + }); + } else { + return $(elm).click(function() { + return $(elm).fadeOut(); + }); + } + }; + }); + +}).call(this); + +// Generated by CoffeeScript 1.6.2 /* ownCloud - News @@ -198,13 +297,16 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. '$window', function($window) { return function(scope, elm, attr) { var getCurrentItem, jumpTo, jumpToNextItem, jumpToPreviousItem, keepUnreadCurrentItem, openCurrentItem, starCurrentItem; + jumpTo = function($scrollArea, $item) { var position; + position = $item.offset().top - $scrollArea.offset().top + $scrollArea.scrollTop(); return $scrollArea.scrollTop(position); }; jumpToPreviousItem = function(scrollArea) { var $item, $items, $previous, $scrollArea, item, notJumped, _i, _len; + $scrollArea = $(scrollArea); $items = $scrollArea.find('.feed_item'); notJumped = true; @@ -226,6 +328,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. }; jumpToNextItem = function(scrollArea) { var $item, $items, $scrollArea, item, jumped, _i, _len; + $scrollArea = $(scrollArea); $items = $scrollArea.find('.feed_item'); jumped = false; @@ -244,6 +347,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. }; getCurrentItem = function(scrollArea) { var $item, $items, $scrollArea, item, _i, _len; + $scrollArea = $(scrollArea); $items = $scrollArea.find('.feed_item'); for (_i = 0, _len = $items.length; _i < _len; _i++) { @@ -256,22 +360,26 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. }; keepUnreadCurrentItem = function(scrollArea) { var $item; + $item = getCurrentItem(scrollArea); return $item.find('.keep_unread').trigger('click'); }; starCurrentItem = function(scrollArea) { var $item; + $item = getCurrentItem(scrollArea); return $item.find('.star').trigger('click'); }; openCurrentItem = function(scrollArea) { var $item; + $item = getCurrentItem(scrollArea).find('.item_title a'); $item.trigger('click'); return window.open($item.attr('href'), '_blank'); }; return $($window.document).keydown(function(e) { var focused, scrollArea; + focused = $(':focus'); if (!(focused.is('input') || focused.is('select') || focused.is('textarea') || focused.is('checkbox') || focused.is('button'))) { scrollArea = elm; @@ -297,7 +405,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. }).call(this); -// Generated by CoffeeScript 1.6.3 +// Generated by CoffeeScript 1.6.2 /* ownCloud - News @@ -325,13 +433,16 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. '$timeout', function($timeout) { return function(scope, elm, attr) { var options; + options = scope.$eval(attr.newsClickScroll); return elm.click(function() { var direction, scrollArea; + scrollArea = $(options.scrollArea); direction = options.direction; return $timeout(function() { var scrollPosition; + if (direction === 'top') { scrollPosition = 0; } else { @@ -346,7 +457,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. }).call(this); -// Generated by CoffeeScript 1.6.3 +// Generated by CoffeeScript 1.6.2 /* ownCloud - News @@ -381,6 +492,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. return function(scope, elm, attr) { return elm.bind('scroll', function() { var counter, item, _i, _ref, _results; + if (scrolling) { scrolling = false; setTimeout(function() { @@ -390,6 +502,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. markingRead = false; setTimeout(function() { var $elems, feedItem, id, offset, _i, _len, _results; + markingRead = true; $elems = elm.find('.feed_item:not(.read)'); _results = []; @@ -429,7 +542,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. }).call(this); -// Generated by CoffeeScript 1.6.3 +// Generated by CoffeeScript 1.6.2 /* ownCloud - News @@ -457,16 +570,19 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. '$rootScope', '$timeout', 'Config', function($rootScope, $timeout, Config) { return function(scope, elm, attr) { var caption, timeout, undo; + undo = function() {}; caption = ''; timeout = null; $(elm).click(function() { var timout; + timout = null; return $(this).fadeOut(); }); $(elm).find('a').click(function() { var timout; + undo(); timout = null; $rootScope.$apply(); @@ -477,6 +593,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. }; return scope.$on('undoMessage', function(scope, data) { var _this = this; + if (timeout) { $timeout.cancel(timeout.promise); } @@ -493,7 +610,60 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. }).call(this); -// Generated by CoffeeScript 1.6.3 +// Generated by CoffeeScript 1.6.2 +/* + +ownCloud - News + +@author Alessandro Cosentino +@copyright 2013 Alessandro Cosentino cosenal@gmail.com + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +License as published by the Free Software Foundation; either +version 3 of the License, or any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU AFFERO GENERAL PUBLIC LICENSE for more details. + +You should have received a copy of the GNU Affero General Public +License along with this library. If not, see <http://www.gnu.org/licenses/>. +*/ + + +(function() { + angular.module('News').controller('AppController', [ + '$scope', 'Persistence', 'FeedBusinessLayer', function($scope, Persistence, FeedBusinessLayer) { + var AppController; + + AppController = (function() { + function AppController(_$scope, _persistence, _feedBusinessLayer) { + var successCallback, + _this = this; + + this._$scope = _$scope; + this._persistence = _persistence; + this._feedBusinessLayer = _feedBusinessLayer; + this._$scope.initialized = false; + this._$scope.feedBusinessLayer = this._feedBusinessLayer; + successCallback = function() { + return _this._$scope.initialized = true; + }; + this._persistence.init().then(successCallback); + } + + return AppController; + + })(); + return new AppController($scope, Persistence, FeedBusinessLayer); + } + ]); + +}).call(this); + +// Generated by CoffeeScript 1.6.2 /* ownCloud - News @@ -520,9 +690,11 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. angular.module('News').controller('FeedController', [ '$scope', '_ExistsError', 'Persistence', 'FolderBusinessLayer', 'FeedBusinessLayer', 'SubscriptionsBusinessLayer', 'StarredBusinessLayer', 'unreadCountFormatter', 'ActiveFeed', 'FeedType', '$window', function($scope, _ExistsError, Persistence, FolderBusinessLayer, FeedBusinessLayer, SubscriptionsBusinessLayer, StarredBusinessLayer, unreadCountFormatter, ActiveFeed, FeedType, $window) { var FeedController; + FeedController = (function() { function FeedController(_$scope, _persistence, _folderBusinessLayer, _feedBusinessLayer, _subscriptionsBusinessLayer, _starredBusinessLayer, _unreadCountFormatter, _activeFeed, _feedType, _$window) { var _this = this; + this._$scope = _$scope; this._persistence = _persistence; this._folderBusinessLayer = _folderBusinessLayer; @@ -542,6 +714,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. this._$scope.unreadCountFormatter = this._unreadCountFormatter; this._$scope.getTotalUnreadCount = function() { var count, title, titleCount; + count = _this._subscriptionsBusinessLayer.getUnreadCount(0); if (count > 0) { titleCount = _this._unreadCountFormatter(count); @@ -562,6 +735,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. }; this._$scope.addFeed = function(feedUrl, parentFolderId) { var error; + if (parentFolderId == null) { parentFolderId = 0; } @@ -588,11 +762,13 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. }; this._$scope.addFolder = function(folderName) { var error; + _this._$scope.folderExistsError = false; try { _this._isAddingFolder = true; return _this._folderBusinessLayer.create(folderName, function(data) { var activeId; + _this._$scope.folderName = ''; _this._$scope.addNewFolder = false; _this._isAddingFolder = false; @@ -623,7 +799,60 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. }).call(this); -// Generated by CoffeeScript 1.6.3 +// Generated by CoffeeScript 1.6.2 +/* + +ownCloud - News + +@_author Alessandro Cosentino +@copyright 2013 Alessandro Cosentino cosenal@gmail.com + +This library is free software; you can redistribute it and/or +modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +License as published by the Free Software Foundation; either +version 3 of the License, or any later version. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU AFFERO GENERAL PUBLIC LICENSE for more details. + +You should have received a copy of the GNU Affero General Public +License along with this library. If not, see <http://www.gnu.org/licenses/>. +*/ + + +(function() { + angular.module('News').controller('InitController', [ + '$scope', 'Persistence', 'FeedBusinessLayer', function($scope, Persistence, FeedBusinessLayer) { + var InitController; + + InitController = (function() { + function InitController(_$scope, _persistence, _feedBusinessLayer) { + var successCallback, + _this = this; + + this._$scope = _$scope; + this._persistence = _persistence; + this._feedBusinessLayer = _feedBusinessLayer; + this._$scope.initialized = false; + this._$scope.feedBusinessLayer = this._feedBusinessLayer; + successCallback = function() { + return _this._$scope.initialized = true; + }; + this._persistence.init().then(successCallback); + } + + return InitController; + + })(); + return new InitController($scope, Persistence, FeedBusinessLayer); + } + ]); + +}).call(this); + +// Generated by CoffeeScript 1.6.2 /* ownCloud - News @@ -650,9 +879,11 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. angular.module('News').controller('ItemController', [ '$scope', 'ItemBusinessLayer', 'FeedModel', 'FeedLoading', 'FeedBusinessLayer', 'Language', 'AutoPageLoading', function($scope, ItemBusinessLayer, FeedModel, FeedLoading, FeedBusinessLayer, Language, AutoPageLoading) { var ItemController; + ItemController = (function() { function ItemController(_$scope, _itemBusinessLayer, _feedModel, _feedLoading, _autoPageLoading, _feedBusinessLayer, _language) { var _this = this; + this._$scope = _$scope; this._itemBusinessLayer = _itemBusinessLayer; this._feedModel = _feedModel; @@ -671,6 +902,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. }; this._$scope.getFeedTitle = function(feedId) { var feed; + feed = _this._feedModel.getById(feedId); if (angular.isDefined(feed)) { return feed.title; @@ -707,7 +939,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. }).call(this); -// Generated by CoffeeScript 1.6.3 +// Generated by CoffeeScript 1.6.2 /* ownCloud - News @@ -734,9 +966,11 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. angular.module('News').controller('SettingsController', [ '$scope', 'FeedBusinessLayer', 'FolderBusinessLayer', 'ShowAll', function($scope, FeedBusinessLayer, FolderBusinessLayer, ShowAll) { var _this = this; + $scope.feedBusinessLayer = FeedBusinessLayer; $scope["import"] = function(fileContent) { var error; + $scope.error = false; ShowAll.setShowAll(true); try { @@ -749,6 +983,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. }; return $scope.importGoogleReader = function(fileContent) { var error, parsedJSON; + $scope.jsonError = false; ShowAll.setShowAll(true); try { @@ -765,7 +1000,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. }).call(this); -// Generated by CoffeeScript 1.6.3 +// Generated by CoffeeScript 1.6.2 /* ownCloud - News @@ -791,12 +1026,12 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. (function() { angular.module('News').factory('ActiveFeed', function() { var ActiveFeed; + ActiveFeed = (function() { function ActiveFeed() { /* Default value is all feeds */ - this._id = 0; this._type = 3; } @@ -822,7 +1057,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. }).call(this); -// Generated by CoffeeScript 1.6.3 +// Generated by CoffeeScript 1.6.2 /* ownCloud - News @@ -848,6 +1083,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. (function() { angular.module('News').factory('_BusinessLayer', function() { var BusinessLayer; + BusinessLayer = (function() { function BusinessLayer(_activeFeed, _persistence, _itemModel, _type) { this._activeFeed = _activeFeed; @@ -877,7 +1113,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. }).call(this); -// Generated by CoffeeScript 1.6.3 +// Generated by CoffeeScript 1.6.2 /* ownCloud - News @@ -907,6 +1143,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. angular.module('News').factory('FeedBusinessLayer', [ '_BusinessLayer', 'ShowAll', 'Persistence', 'ActiveFeed', 'FeedType', 'ItemModel', 'FeedModel', 'NewLoading', '_ExistsError', 'Utils', '$rootScope', 'NewestItem', function(_BusinessLayer, ShowAll, Persistence, ActiveFeed, FeedType, ItemModel, FeedModel, NewLoading, _ExistsError, Utils, $rootScope, NewestItem) { var FeedBusinessLayer; + FeedBusinessLayer = (function(_super) { __extends(FeedBusinessLayer, _super); @@ -940,6 +1177,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. FeedBusinessLayer.prototype["delete"] = function(feedId) { var data, feed, _this = this; + feed = this._feedModel.removeById(feedId); data = { undoCallback: function() { @@ -954,6 +1192,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. FeedBusinessLayer.prototype.markRead = function(feedId) { var feed, item, newestItemId, _i, _len, _ref; + feed = this._feedModel.getById(feedId); newestItemId = this._newestItem.getId(); if (angular.isDefined(feed) && newestItemId !== 0) { @@ -973,6 +1212,10 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. return this._feedModel.size(); }; + FeedBusinessLayer.prototype.noFeeds = function() { + return this.getNumberOfFeeds() === 0; + }; + FeedBusinessLayer.prototype.isVisible = function(feedId) { if (this.isActive(feedId) || this._showAll.getShowAll()) { return true; @@ -983,6 +1226,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. FeedBusinessLayer.prototype.move = function(feedId, folderId) { var feed; + feed = this._feedModel.getById(feedId); if (angular.isDefined(feed) && feed.folderId !== folderId) { this._feedModel.update({ @@ -997,6 +1241,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. FeedBusinessLayer.prototype.setShowAll = function(showAll) { var callback, _this = this; + this._showAll.setShowAll(showAll); callback = function() { _this._itemModel.clear(); @@ -1022,6 +1267,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. FeedBusinessLayer.prototype.getFeedLink = function(feedId) { var feed; + feed = this._feedModel.getById(feedId); if (angular.isDefined(feed)) { return feed.link; @@ -1031,6 +1277,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. FeedBusinessLayer.prototype.create = function(url, parentId, onSuccess, onFailure) { var feed, success, _this = this; + if (parentId == null) { parentId = 0; } @@ -1079,6 +1326,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. FeedBusinessLayer.prototype.importGoogleReader = function(json) { var feed, onSuccess, url, _this = this; + url = 'http://owncloud/googlereader'; if (angular.isUndefined(this._feedModel.getByUrl(url))) { feed = { @@ -1092,6 +1340,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. } onSuccess = function(response) { var id; + id = response.data.feeds[0].id; return _this.load(id); }; @@ -1107,7 +1356,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. }).call(this); -// Generated by CoffeeScript 1.6.3 +// Generated by CoffeeScript 1.6.2 /* ownCloud - News @@ -1137,6 +1386,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. angular.module('News').factory('FolderBusinessLayer', [ '_BusinessLayer', 'FolderModel', 'FeedBusinessLayer', 'Persistence', 'FeedType', 'ActiveFeed', 'ItemModel', 'ShowAll', '_ExistsError', 'OPMLParser', 'NewestItem', 'FeedModel', '$rootScope', function(_BusinessLayer, FolderModel, FeedBusinessLayer, Persistence, FeedType, ActiveFeed, ItemModel, ShowAll, _ExistsError, OPMLParser, NewestItem, FeedModel, $rootScope) { var FolderBusinessLayer; + FolderBusinessLayer = (function(_super) { __extends(FolderBusinessLayer, _super); @@ -1159,6 +1409,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. FolderBusinessLayer.prototype["delete"] = function(folderId) { var data, feed, feeds, folder, _i, _len, _ref, _this = this; + feeds = []; _ref = this._feedBusinessLayer.getFeedsOfFolder(folderId); for (_i = 0, _len = _ref.length; _i < _len; _i++) { @@ -1185,6 +1436,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. FolderBusinessLayer.prototype.open = function(folderId) { var folder; + folder = this._folderModel.getById(folderId); if (angular.isDefined(folder)) { if (!folder.opened) { @@ -1196,6 +1448,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. FolderBusinessLayer.prototype.toggleFolder = function(folderId) { var folder; + folder = this._folderModel.getById(folderId); if (angular.isDefined(folder)) { folder.opened = !folder.opened; @@ -1209,6 +1462,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. FolderBusinessLayer.prototype.markRead = function(folderId) { var feed, folder, item, newestItemId, _i, _j, _len, _len1, _ref, _ref1; + newestItemId = this._newestItem.getId(); folder = this._folderModel.getById(folderId); if (newestItemId !== 0 && angular.isDefined(folder)) { @@ -1234,6 +1488,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. FolderBusinessLayer.prototype.isVisible = function(folderId) { var feed, _i, _len, _ref; + if (this._showAll.getShowAll()) { return true; } else { @@ -1260,6 +1515,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. FolderBusinessLayer.prototype.create = function(folderName, onSuccess, onFailure) { var folder, success, _this = this; + if (onSuccess == null) { onSuccess = null; } @@ -1297,6 +1553,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. FolderBusinessLayer.prototype["import"] = function(xml) { var opml; + opml = this._opmlParser.parseXML(xml); return this._importElement(opml, 0); }; @@ -1304,12 +1561,14 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. FolderBusinessLayer.prototype._importElement = function(opml, parentFolderId) { var item, _i, _len, _ref, _results, _this = this; + _ref = opml.getItems(); _results = []; for (_i = 0, _len = _ref.length; _i < _len; _i++) { item = _ref[_i]; _results.push((function(item) { var error, folder; + if (item.isFolder()) { try { return _this.create(item.getName(), function(data) { @@ -1349,7 +1608,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. }).call(this); -// Generated by CoffeeScript 1.6.3 +// Generated by CoffeeScript 1.6.2 /* ownCloud - News @@ -1376,6 +1635,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. angular.module('News').factory('ItemBusinessLayer', [ 'ItemModel', 'FeedModel', 'Persistence', 'ActiveFeed', 'FeedType', 'StarredBusinessLayer', 'NewestItem', function(ItemModel, FeedModel, Persistence, ActiveFeed, FeedType, StarredBusinessLayer, NewestItem) { var ItemBusinessLayer; + ItemBusinessLayer = (function() { function ItemBusinessLayer(_itemModel, _feedModel, _persistence, _activeFeed, _feedType, _starredBusinessLayer, _newestItem) { this._itemModel = _itemModel; @@ -1397,6 +1657,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. ItemBusinessLayer.prototype.isKeptUnread = function(itemId) { var item; + item = this._itemModel.getById(itemId); if (angular.isDefined(item) && angular.isDefined(item.keptUnread)) { return item.keptUnread; @@ -1406,6 +1667,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. ItemBusinessLayer.prototype.toggleKeepUnread = function(itemId) { var item; + item = this._itemModel.getById(itemId); if (angular.isDefined(item) && !item.keptUnread) { item.keptUnread = true; @@ -1419,6 +1681,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. ItemBusinessLayer.prototype.toggleStarred = function(itemId) { var item; + item = this._itemModel.getById(itemId); if (item.isStarred()) { item.setUnstarred(); @@ -1433,6 +1696,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. ItemBusinessLayer.prototype.setRead = function(itemId) { var feed, item, keptUnread; + item = this._itemModel.getById(itemId); if (angular.isDefined(item)) { keptUnread = angular.isDefined(item.keptUnread) && item.keptUnread; @@ -1449,6 +1713,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. ItemBusinessLayer.prototype.setUnread = function(itemId) { var feed, item; + item = this._itemModel.getById(itemId); if (angular.isDefined(item)) { if (item.isRead()) { @@ -1464,6 +1729,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. ItemBusinessLayer.prototype.getFeedTitle = function(itemId) { var feed, item; + item = this._itemModel.getById(itemId); if (angular.isDefined(item)) { feed = this._feedModel.getById(item.feedId); @@ -1475,6 +1741,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. ItemBusinessLayer.prototype.loadNext = function(callback) { var lowestItemId; + lowestItemId = this._itemModel.getLowestId(); if (lowestItemId !== 0) { return this._persistence.getItems(this._activeFeed.getType(), this._activeFeed.getId(), lowestItemId, callback); @@ -1494,7 +1761,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. }).call(this); -// Generated by CoffeeScript 1.6.3 +// Generated by CoffeeScript 1.6.2 /* ownCloud - News @@ -1524,6 +1791,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. angular.module('News').factory('StarredBusinessLayer', [ '_BusinessLayer', 'StarredCount', 'Persistence', 'ActiveFeed', 'FeedType', 'ItemModel', function(_BusinessLayer, StarredCount, Persistence, ActiveFeed, FeedType, ItemModel) { var StarredBusinessLayer; + StarredBusinessLayer = (function(_super) { __extends(StarredBusinessLayer, _super); @@ -1561,7 +1829,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. }).call(this); -// Generated by CoffeeScript 1.6.3 +// Generated by CoffeeScript 1.6.2 /* ownCloud - News @@ -1591,6 +1859,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. angular.module('News').factory('SubscriptionsBusinessLayer', [ '_BusinessLayer', 'FeedBusinessLayer', 'Persistence', 'ShowAll', 'ActiveFeed', 'FeedType', 'ItemModel', 'FeedModel', 'NewestItem', function(_BusinessLayer, FeedBusinessLayer, Persistence, ShowAll, ActiveFeed, FeedType, ItemModel, FeedModel, NewestItem) { var SubscriptionsBusinessLayer; + SubscriptionsBusinessLayer = (function(_super) { __extends(SubscriptionsBusinessLayer, _super); @@ -1604,6 +1873,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. SubscriptionsBusinessLayer.prototype.isVisible = function() { var visible; + if (this.isActive(0) && this._feedBusinessLayer.getNumberOfFeeds() > 0) { return true; } @@ -1617,6 +1887,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. SubscriptionsBusinessLayer.prototype.markRead = function() { var feed, item, newestItemId, _i, _j, _len, _len1, _ref, _ref1; + newestItemId = this._newestItem.getId(); if (newestItemId !== 0) { _ref = this._feedModel.getAll(); @@ -1646,7 +1917,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. }).call(this); -// Generated by CoffeeScript 1.6.3 +// Generated by CoffeeScript 1.6.2 /* ownCloud - News @@ -1672,6 +1943,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. (function() { angular.module('News').factory('_ExistsError', function() { var ExistsError; + ExistsError = (function() { function ExistsError(message) { this.message = message; @@ -1685,7 +1957,7 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>. }).call(this); -// Generated by CoffeeScript 1.6.3 +// Generated by CoffeeScript 1.6.2 |