diff options
Diffstat (limited to 'js/build/app')
32 files changed, 3261 insertions, 0 deletions
diff --git a/js/build/app/app.js b/js/build/app/app.js new file mode 100644 index 000000000..0e05ba545 --- /dev/null +++ b/js/build/app/app.js @@ -0,0 +1,55 @@ +// Generated by CoffeeScript 1.6.3 +/* + +ownCloud - News + +@author Bernhard Posselt +@copyright 2012 Bernhard Posselt dev@bernhard-posselt.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', ['OC', 'ui']).config(function($provide) { + var config; + return $provide.value('Config', config = { + markReadTimeout: 500, + scrollTimeout: 500, + feedUpdateInterval: 1000 * 60 * 3, + itemBatchSize: 40, + undoTimeout: 1000 * 10, + autoPageFactor: 30 + }); + }); + + angular.module('News').run([ + 'Persistence', 'Config', function(Persistence, Config) { + return setInterval(function() { + Persistence.getAllFeeds(null, false); + return Persistence.getAllFolders(null, false); + }, Config.feedUpdateInterval); + } + ]); + + $(document).ready(function() { + return $(this).keyup(function(e) { + if ((e.which === 116) || (e.which === 82 && e.ctrlKey)) { + document.location.reload(true); + return false; + } + }); + }); + +}).call(this); diff --git a/js/build/app/controllers/appcontroller.js b/js/build/app/controllers/appcontroller.js new file mode 100644 index 000000000..17fba2182 --- /dev/null +++ b/js/build/app/controllers/appcontroller.js @@ -0,0 +1,50 @@ +// Generated by CoffeeScript 1.6.3 +/* + +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); diff --git a/js/build/app/controllers/feedcontroller.js b/js/build/app/controllers/feedcontroller.js new file mode 100644 index 000000000..08fa1c4c2 --- /dev/null +++ b/js/build/app/controllers/feedcontroller.js @@ -0,0 +1,129 @@ +// Generated by CoffeeScript 1.6.3 +/* + +ownCloud - News + +@author Bernhard Posselt +@copyright 2012 Bernhard Posselt dev@bernhard-posselt.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('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; + this._feedBusinessLayer = _feedBusinessLayer; + this._subscriptionsBusinessLayer = _subscriptionsBusinessLayer; + this._starredBusinessLayer = _starredBusinessLayer; + this._unreadCountFormatter = _unreadCountFormatter; + this._activeFeed = _activeFeed; + this._feedType = _feedType; + this._$window = _$window; + this._isAddingFolder = false; + this._isAddingFeed = false; + this._$scope.folderBusinessLayer = this._folderBusinessLayer; + this._$scope.feedBusinessLayer = this._feedBusinessLayer; + this._$scope.subscriptionsBusinessLayer = this._subscriptionsBusinessLayer; + this._$scope.starredBusinessLayer = this._starredBusinessLayer; + 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); + title = 'News (' + titleCount + ') | ownCloud'; + } else { + title = 'News | ownCloud'; + } + if (_this._$window.document.title !== title) { + _this._$window.document.title = title; + } + return count; + }; + this._$scope.isAddingFolder = function() { + return _this._isAddingFolder; + }; + this._$scope.isAddingFeed = function() { + return _this._isAddingFeed; + }; + this._$scope.addFeed = function(feedUrl, parentFolderId) { + var error; + if (parentFolderId == null) { + parentFolderId = 0; + } + _this._$scope.feedExistsError = false; + try { + _this._isAddingFeed = true; + if (parentFolderId !== 0) { + _this._folderBusinessLayer.open(parentFolderId); + } + return _this._feedBusinessLayer.create(feedUrl, parentFolderId, function(data) { + _this._$scope.feedUrl = ''; + _this._isAddingFeed = false; + return _this._feedBusinessLayer.load(data['feeds'][0].id); + }, function() { + return _this._isAddingFeed = false; + }); + } catch (_error) { + error = _error; + if (error instanceof _ExistsError) { + _this._$scope.feedExistsError = true; + } + return _this._isAddingFeed = false; + } + }; + 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; + activeId = data['folders'][0].id; + return _this._$scope.folderId = _this._folderBusinessLayer.getById(activeId); + }, function() { + return _this._isAddingFolder = false; + }); + } catch (_error) { + error = _error; + if (error instanceof _ExistsError) { + _this._$scope.folderExistsError = true; + } + return _this._isAddingFolder = false; + } + }; + this._$scope.$on('moveFeedToFolder', function(scope, data) { + return _this._feedBusinessLayer.move(data.feedId, data.folderId); + }); + } + + return FeedController; + + })(); + return new FeedController($scope, Persistence, FolderBusinessLayer, FeedBusinessLayer, SubscriptionsBusinessLayer, StarredBusinessLayer, unreadCountFormatter, ActiveFeed, FeedType, $window); + } + ]); + +}).call(this); diff --git a/js/build/app/controllers/itemcontroller.js b/js/build/app/controllers/itemcontroller.js new file mode 100644 index 000000000..1412aeb78 --- /dev/null +++ b/js/build/app/controllers/itemcontroller.js @@ -0,0 +1,83 @@ +// Generated by CoffeeScript 1.6.3 +/* + +ownCloud - News + +@_author Bernhard Posselt +@copyright 2012 Bernhard Posselt dev@bernhard-posselt.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('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; + this._feedLoading = _feedLoading; + this._autoPageLoading = _autoPageLoading; + this._feedBusinessLayer = _feedBusinessLayer; + this._language = _language; + this._autoPaging = true; + this._$scope.itemBusinessLayer = this._itemBusinessLayer; + this._$scope.feedBusinessLayer = this._feedBusinessLayer; + this._$scope.isLoading = function() { + return _this._feedLoading.isLoading(); + }; + this._$scope.isAutoPaging = function() { + return _this._autoPageLoading.isLoading(); + }; + this._$scope.getFeedTitle = function(feedId) { + var feed; + feed = _this._feedModel.getById(feedId); + if (angular.isDefined(feed)) { + return feed.title; + } else { + return ''; + } + }; + this._$scope.getRelativeDate = function(date) { + if (date) { + return _this._language.getMomentFromTimestamp(date).fromNow(); + } else { + return ''; + } + }; + this._$scope.$on('readItem', function(scope, data) { + return _this._itemBusinessLayer.setRead(data); + }); + this._$scope.$on('autoPage', function() { + if (_this._autoPaging) { + _this._autoPaging = false; + return _this._itemBusinessLayer.loadNext(function(data) { + return _this._autoPaging = true; + }); + } + }); + } + + return ItemController; + + })(); + return new ItemController($scope, ItemBusinessLayer, FeedModel, FeedLoading, AutoPageLoading, FeedBusinessLayer, Language); + } + ]); + +}).call(this); diff --git a/js/build/app/controllers/settingscontroller.js b/js/build/app/controllers/settingscontroller.js new file mode 100644 index 000000000..9c2beaaf9 --- /dev/null +++ b/js/build/app/controllers/settingscontroller.js @@ -0,0 +1,55 @@ +// Generated by CoffeeScript 1.6.3 +/* + +ownCloud - News + +@author Bernhard Posselt +@copyright 2012 Bernhard Posselt dev@bernhard-posselt.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('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 { + return FolderBusinessLayer["import"](fileContent); + } catch (_error) { + error = _error; + return $scope.error = true; + } + }; + return $scope.importGoogleReader = function(fileContent) { + var error, parsedJSON; + $scope.jsonError = false; + ShowAll.setShowAll(true); + try { + parsedJSON = JSON.parse(fileContent); + return FeedBusinessLayer.importGoogleReader(parsedJSON); + } catch (_error) { + error = _error; + return $scope.jsonError = true; + } + }; + } + ]); + +}).call(this); diff --git a/js/build/app/directives/audio.js b/js/build/app/directives/audio.js new file mode 100644 index 000000000..2dfc0aa37 --- /dev/null +++ b/js/build/app/directives/audio.js @@ -0,0 +1,51 @@ +// Generated by CoffeeScript 1.6.3 +/* + +ownCloud - News + +@author Bernhard Posselt +@copyright 2012 Bernhard Posselt dev@bernhard-posselt.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('newsAudio', function() { + var directive; + return directive = { + restrict: 'E', + scope: { + src: '@', + type: '@' + }, + transclude: true, + 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() { + return scope.$apply(function() { + return cantPlay = true; + }); + }); + return scope.cantPlay = function() { + return cantPlay; + }; + } + }; + }); + +}).call(this); diff --git a/js/build/app/directives/droppable.js b/js/build/app/directives/droppable.js new file mode 100644 index 000000000..30335232b --- /dev/null +++ b/js/build/app/directives/droppable.js @@ -0,0 +1,50 @@ +// Generated by CoffeeScript 1.6.3 +/* + +ownCloud - News + +@author Bernhard Posselt +@copyright 2012 Bernhard Posselt dev@bernhard-posselt.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('droppable', [ + '$rootScope', function($rootScope) { + return function(scope, elm, attr) { + var $elem, details; + $elem = $(elm); + details = { + accept: '.feed', + hoverClass: 'drag-and-drop', + greedy: true, + drop: function(event, ui) { + var data; + $('.drag-and-drop').removeClass('drag-and-drop'); + data = { + folderId: parseInt($elem.data('id'), 10), + feedId: parseInt($(ui.draggable).data('id'), 10) + }; + $rootScope.$broadcast('moveFeedToFolder', data); + return scope.$apply(attr.droppable); + } + }; + return $elem.droppable(details); + }; + } + ]); + +}).call(this); diff --git a/js/build/app/directives/itemshortcuts.js b/js/build/app/directives/itemshortcuts.js new file mode 100644 index 000000000..b23599c61 --- /dev/null +++ b/js/build/app/directives/itemshortcuts.js @@ -0,0 +1,126 @@ +// Generated by CoffeeScript 1.6.3 +/* + +ownCloud - News + +@author Bernhard Posselt +@copyright 2012 Bernhard Posselt dev@bernhard-posselt.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('itemShortcuts', [ + '$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; + for (_i = 0, _len = $items.length; _i < _len; _i++) { + item = $items[_i]; + $item = $(item); + if ($item.position().top >= 0) { + $previous = $item.prev(); + if ($previous.length > 0) { + jumpTo($scrollArea, $previous); + } + notJumped = false; + break; + } + } + if ($items.length > 0 && notJumped) { + return jumpTo($scrollArea, $items.last()); + } + }; + jumpToNextItem = function(scrollArea) { + var $item, $items, $scrollArea, item, jumped, _i, _len; + $scrollArea = $(scrollArea); + $items = $scrollArea.find('.feed_item'); + jumped = false; + for (_i = 0, _len = $items.length; _i < _len; _i++) { + item = $items[_i]; + $item = $(item); + if ($item.position().top > 1) { + jumped = true; + jumpTo($scrollArea, $item); + break; + } + } + if (jumped === false) { + return $scrollArea.scrollTop($scrollArea.prop('scrollHeight')); + } + }; + 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++) { + item = $items[_i]; + $item = $(item); + if (($item.height() + $item.position().top) > 110) { + return $item; + } + } + }; + 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; + if (e.keyCode === 74 || e.keyCode === 39 || e.keyCode === 78) { + return jumpToNextItem(scrollArea); + } else if (e.keyCode === 75 || e.keyCode === 37 || e.keyCode === 80) { + return jumpToPreviousItem(scrollArea); + } else if (e.keyCode === 85) { + return keepUnreadCurrentItem(scrollArea); + } else if (e.keyCode === 73 || e.keyCode === 83 || e.keyCode === 76) { + return starCurrentItem(scrollArea); + } else if (e.keyCode === 72) { + starCurrentItem(scrollArea); + return jumpToNextItem(scrollArea); + } else if (e.keyCode === 79) { + return openCurrentItem(scrollArea); + } + } + }); + }; + } + ]); + +}).call(this); diff --git a/js/build/app/directives/newsclickscroll.js b/js/build/app/directives/newsclickscroll.js new file mode 100644 index 000000000..f6e9e666c --- /dev/null +++ b/js/build/app/directives/newsclickscroll.js @@ -0,0 +1,48 @@ +// Generated by CoffeeScript 1.6.3 +/* + +ownCloud - News + +@author Bernhard Posselt +@copyright 2012 Bernhard Posselt dev@bernhard-posselt.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 L |