diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-05-15 03:00:53 +0200 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-05-15 03:00:53 +0200 |
commit | 3ce894af1e72c9488b8cb3340fd61656122f7d50 (patch) | |
tree | a603121e8b1e860201370399f8095121cd9c6bf7 /js/app | |
parent | 10d76fff64363ea59d916b550854cf3540dadfbc (diff) |
use markdown, refactor js
Diffstat (limited to 'js/app')
60 files changed, 0 insertions, 4288 deletions
diff --git a/js/app/app.coffee b/js/app/app.coffee deleted file mode 100644 index 0c5763bd2..000000000 --- a/js/app/app.coffee +++ /dev/null @@ -1,57 +0,0 @@ -### - -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/>. - -### - - -# app main -angular.module('News', ['ui']).config ['$provide', '$httpProvider', -($provide, $httpProvider) -> - $provide.value 'Config', config = - markReadTimeout: 500 - scrollTimeout: 500 - feedUpdateInterval: 1000*60*3 # miliseconds - itemBatchSize: 40 - undoTimeout: 1000*10 # miliseconds - # the autoPageFactor defines how many articles must be left - # before it starts autopaging - autoPageFactor: 30 - - # Always send the CSRF token by default - $httpProvider.defaults.headers.common['requesttoken'] = oc_requesttoken -] - -angular.module('News').run ['Persistence', 'Config', -(Persistence, Config) -> - - setInterval -> - Persistence.getAllFeeds(null, false) - Persistence.getAllFolders(null, false) - , Config.feedUpdateInterval -] - - -$(document).ready -> - # this is used to forces browser to reload content after refreshing - # and thus clearing the scroll cache - $(this).keyup (e) -> - if (e.which == 116) || (e.which == 82 && e.ctrlKey) - document.location.reload(true) - return false diff --git a/js/app/controllers/appcontroller.coffee b/js/app/controllers/appcontroller.coffee deleted file mode 100644 index bcb256077..000000000 --- a/js/app/controllers/appcontroller.coffee +++ /dev/null @@ -1,42 +0,0 @@ -### - -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/>. - -### - - -angular.module('News').controller 'AppController', -['$scope', 'Persistence', 'FeedBusinessLayer', -($scope, Persistence, FeedBusinessLayer) -> - - class AppController - - constructor: (@_$scope, @_persistence, @_feedBusinessLayer) -> - - @_$scope.initialized = false - @_$scope.feedBusinessLayer = @_feedBusinessLayer - - successCallback = => - @_$scope.initialized = true - - @_persistence.init().then(successCallback) - - return new AppController($scope, Persistence, FeedBusinessLayer) - -]
\ No newline at end of file diff --git a/js/app/controllers/feedcontroller.coffee b/js/app/controllers/feedcontroller.coffee deleted file mode 100644 index 43186e689..000000000 --- a/js/app/controllers/feedcontroller.coffee +++ /dev/null @@ -1,147 +0,0 @@ -### - -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/>. - -### - - -angular.module('News').controller 'FeedController', -['$scope', '_ExistsError', 'Persistence', 'FolderBusinessLayer', -'FeedBusinessLayer', 'SubscriptionsBusinessLayer', 'StarredBusinessLayer', -'unreadCountFormatter', 'ActiveFeed', 'FeedType', '$window', -($scope, _ExistsError, Persistence, FolderBusinessLayer, FeedBusinessLayer, -SubscriptionsBusinessLayer, StarredBusinessLayer, unreadCountFormatter, -ActiveFeed, FeedType, $window) -> - - - class FeedController - - constructor: (@_$scope, @_persistence, @_folderBusinessLayer, - @_feedBusinessLayer, @_subscriptionsBusinessLayer, - @_starredBusinessLayer, @_unreadCountFormatter, - @_activeFeed, @_feedType, @_$window) -> - - @_isAddingFolder = false - @_isAddingFeed = false - - # bind internal stuff to scope - @_$scope.folderBusinessLayer = @_folderBusinessLayer - @_$scope.feedBusinessLayer = @_feedBusinessLayer - @_$scope.subscriptionsBusinessLayer = @_subscriptionsBusinessLayer - @_$scope.starredBusinessLayer = @_starredBusinessLayer - @_$scope.unreadCountFormatter = @_unreadCountFormatter - - @_$scope.edit = (feed) -> - feed.editing = true - feed.originalValue = feed.title - - @_$scope.cancel = (feed) -> - feed.editing = false - feed.title = feed.originalValue - - @_$scope.getTotalUnreadCount = => - # also update title based on unreadcount - count = @_subscriptionsBusinessLayer.getUnreadCount(0) - - # dont do this for other dom elements - # the title is some kind of exception since its always there - # and it has nothing to do with the body structure - if @_$scope.translations and @_$scope.translations.appName - appName = @_$scope.translations.appName - else - appName = '' - - if count > 0 - titleCount = @_unreadCountFormatter(count) - title = appName + ' (' + titleCount + ') | ownCloud' - else - title = appName + ' | ownCloud' - - # only update title when it changed to prevent highlighting the - # tab - if @_$window.document.title != title - @_$window.document.title = title - - return count - - @_$scope.isAddingFolder = => - return @_isAddingFolder - - @_$scope.isAddingFeed = => - return @_isAddingFeed - - @_$scope.addFeed = (feedUrl, parentFolderId=0) => - @_$scope.feedExistsError = false - - try - @_isAddingFeed = true - # set folder to open - if parentFolderId != 0 - @_folderBusinessLayer.open(parentFolderId) - @_$scope.feedUrl = '' - @_feedBusinessLayer.create feedUrl, parentFolderId - # on success - , (data) => - @_isAddingFeed = false - @_feedBusinessLayer.load(data['feeds'][0].id) - # on error - , => - @_isAddingFeed = false - - catch error - if error instanceof _ExistsError - @_$scope.feedExistsError = true - @_isAddingFeed = false - - - @_$scope.addFolder = (folderName) => - @_$scope.folderExistsError = false - - try - @_isAddingFolder = true - @_folderBusinessLayer.create folderName - - # on success - , (data) => - @_$scope.folderName = '' - @_$scope.addNewFolder = false - @_isAddingFolder = false - activeId = data['folders'][0].id - @_$scope.folderId = @_folderBusinessLayer.getById(activeId) - # on error - , => - @_isAddingFolder = false - - catch error - if error instanceof _ExistsError - @_$scope.folderExistsError = true - @_isAddingFolder = false - - - @_$scope.$on 'moveFeedToFolder', (scope, data) => - @_feedBusinessLayer.move(data.feedId, data.folderId) - - - - return new FeedController($scope, Persistence, FolderBusinessLayer, - FeedBusinessLayer, SubscriptionsBusinessLayer, - StarredBusinessLayer, unreadCountFormatter, - ActiveFeed, FeedType, $window) - -]
\ No newline at end of file diff --git a/js/app/controllers/itemcontroller.coffee b/js/app/controllers/itemcontroller.coffee deleted file mode 100644 index 94c3cd159..000000000 --- a/js/app/controllers/itemcontroller.coffee +++ /dev/null @@ -1,84 +0,0 @@ -### - -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/>. - -### - - -angular.module('News').controller 'ItemController', -['$scope', 'ItemBusinessLayer', 'FeedModel', 'FeedLoading', 'FeedBusinessLayer', -'Language', 'AutoPageLoading', 'Settings', -($scope, ItemBusinessLayer, FeedModel, FeedLoading, FeedBusinessLayer, -Language, AutoPageLoading, Settings) -> - - class ItemController - - constructor: (@_$scope, @_itemBusinessLayer, @_feedModel, - @_feedLoading, @_autoPageLoading, @_feedBusinessLayer, - @_language, @_settings) -> - @_autoPaging = true - - @_$scope.itemBusinessLayer = @_itemBusinessLayer - @_$scope.feedBusinessLayer = @_feedBusinessLayer - - @_$scope.isLoading = => - return @_feedLoading.isLoading() - - @_$scope.isAutoPaging = => - return @_autoPageLoading.isLoading() - - @_$scope.getFeedTitle = (feedId) => - feed = @_feedModel.getById(feedId) - if angular.isDefined(feed) - return feed.title - else - return '' - - - @_$scope.getRelativeDate = (date) => - if date - return @_language.getMomentFromTimestamp(date).fromNow() - else - return '' - - @_$scope.loadNew = => - @_$scope.refresh = true - @_itemBusinessLayer.loadNew => - @_$scope.refresh = false - - - @_$scope.$on 'readItem', (scope, data) => - @_itemBusinessLayer.setRead(data) - - @_$scope.$on 'autoPage', => - if @_autoPaging - # prevent multiple autopaging requests - @_autoPaging = false - @_itemBusinessLayer.loadNext (data) => - @_autoPaging = true - - - @_$scope.isCompactView = => - return @_settings.get('compact') - - - return new ItemController($scope, ItemBusinessLayer, FeedModel, FeedLoading, - AutoPageLoading, FeedBusinessLayer, Language, - Settings) -]
\ No newline at end of file diff --git a/js/app/controllers/settingscontroller.coffee b/js/app/controllers/settingscontroller.coffee deleted file mode 100644 index 9190ebad5..000000000 --- a/js/app/controllers/settingscontroller.coffee +++ /dev/null @@ -1,60 +0,0 @@ -### - -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/>. - -### - - -angular.module('News').controller 'SettingsController', -['$scope', 'FeedBusinessLayer', 'FolderBusinessLayer', 'Persistence', 'Settings', -($scope, FeedBusinessLayer, FolderBusinessLayer, Persistence, Settings) -> - - $scope.feedBusinessLayer = FeedBusinessLayer - - $scope.import = (fileContent) -> - $scope.error = false - Settings.set('showAll', true) - - try - FolderBusinessLayer.import(fileContent) - catch error - $scope.error = true - - - $scope.importArticles = (fileContent) -> - $scope.jsonError = false - $scope.loading = true - - try - parsedJSON = JSON.parse(fileContent) - FeedBusinessLayer.importArticles parsedJSON, -> - $scope.loading = false - catch error - $scope.jsonError = true - $scope.loading = false - - - $scope.toggleSetting = (key) -> - Settings.set(key, !Settings.get(key)) - Persistence.setSettings(Settings.getSettings()) - - $scope.getSetting = (key) -> - return Settings.get(key) - -]
\ No newline at end of file diff --git a/js/app/directives/audio.coffee b/js/app/directives/audio.coffee deleted file mode 100644 index 3d6d94062..000000000 --- a/js/app/directives/audio.coffee +++ /dev/null @@ -1,43 +0,0 @@ -### - -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/>. - -### - -angular.module('Ne |