diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-23 13:28:30 +0100 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-23 13:28:30 +0100 |
commit | 53248304dd317e7af3fbc6de09c47f4fb2427530 (patch) | |
tree | 366dc2deaa207b619f8910d73278ceff0269fce6 /js/app.js | |
parent | 3455fe9cb792e584671f465ff6d51732fc1802ff (diff) |
removed old appjs
Diffstat (limited to 'js/app.js')
-rw-r--r-- | js/app.js | 2628 |
1 files changed, 0 insertions, 2628 deletions
diff --git a/js/app.js b/js/app.js deleted file mode 100644 index 4ddb6aec4..000000000 --- a/js/app.js +++ /dev/null @@ -1,2628 +0,0 @@ -/** - * ownCloud RSS reader app - v0.0.1 - * - * Copyright (c) 2013 - Alessandro Cosentino <cosenal@gmail.com> - * Copyright (c) 2013 - Bernhard Posselt <nukeawhale@gmail.com> - * - * This file is licensed under the Affero General Public License version 3 or later. - * See the COPYING-README file - * - */ - -/* -# ownCloud -# -# @author Bernhard Posselt -# Copyright (c) 2012 - Bernhard Posselt <nukeawhale@gmail.com> -# -# This file is licensed under the Affero General Public License version 3 or -# later. -# -# See the COPYING-README file -# -*/ - - -/* -# Various config stuff for owncloud -*/ - - -(function() { - - angular.module('OC', []).config([ - '$httpProvider', function($httpProvider) { - $httpProvider.defaults.get['requesttoken'] = oc_requesttoken; - $httpProvider.defaults.post['requesttoken'] = oc_requesttoken; - $httpProvider.defaults.post['Content-Type'] = 'application/x-www-form-urlencoded'; - $httpProvider.defaults.get['Content-Type'] = 'application/x-www-form-urlencoded'; - return $httpProvider.defaults.transformRequest = function(data) { - if (angular.isDefined(data)) { - return data; - } else { - return $.param(data); - } - }; - } - ]); - - angular.module('OC').run([ - '$rootScope', 'Router', function($rootScope, Router) { - var init; - init = function() { - return $rootScope.$broadcast('routesLoaded'); - }; - return Router.registerLoadedCallback(init); - } - ]); - - /* - # ownCloud - # - # @author Bernhard Posselt - # Copyright (c) 2012 - Bernhard Posselt <nukeawhale@gmail.com> - # - # This file is licensed under the Affero General Public License version 3 or - # later. - # - # See the COPYING-README file - # - */ - - - /* - # Inject notification into angular to make testing easier - */ - - - angular.module('OC').factory('Notification', function() { - return OC.Notification; - }); - - /* - # ownCloud - # - # @author Bernhard Posselt - # Copyright (c) 2012 - Bernhard Posselt <nukeawhale@gmail.com> - # - # This file is licensed under the Affero General Public License version 3 or - # later. - # - # See the COPYING-README file - # - */ - - - /* - # Used for properly distributing received model data from the server - */ - - - angular.module('OC').factory('_Publisher', function() { - var Publisher; - Publisher = (function() { - - function Publisher() { - this.subscriptions = {}; - } - - Publisher.prototype.subscribeModelTo = function(model, name) { - var _base; - (_base = this.subscriptions)[name] || (_base[name] = []); - return this.subscriptions[name].push(model); - }; - - Publisher.prototype.publishDataTo = function(data, name) { - var subscriber, _i, _len, _ref, _results; - _ref = this.subscriptions[name] || []; - _results = []; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - subscriber = _ref[_i]; - _results.push(subscriber.handle(data)); - } - return _results; - }; - - return Publisher; - - })(); - return Publisher; - }); - - /* - # ownCloud - # - # @author Bernhard Posselt - # Copyright (c) 2012 - Bernhard Posselt <nukeawhale@gmail.com> - # - # This file is licensed under the Affero General Public License version 3 or - # later. - # - # See the COPYING-README file - # - */ - - - angular.module('OC').factory('_Request', function() { - var Request; - Request = (function() { - - function Request(_$http, _$rootScope, _publisher, _token, _router) { - var _this = this; - this._$http = _$http; - this._$rootScope = _$rootScope; - this._publisher = _publisher; - this._token = _token; - this._router = _router; - this._initialized = false; - this._shelvedRequests = []; - this._$rootScope.$on('routesLoaded', function() { - _this._executeShelvedRequests(); - _this._initialized = true; - return _this._shelvedRequests = []; - }); - } - - Request.prototype.request = function(route, routeParams, data, onSuccess, onFailure, config) { - var defaultConfig, key, url, value, - _this = this; - if (routeParams == null) { - routeParams = {}; - } - if (data == null) { - data = {}; - } - if (onSuccess == null) { - onSuccess = null; - } - if (onFailure == null) { - onFailure = null; - } - if (config == null) { - config = {}; - } - if (!this._initialized) { - this._shelveRequest(route, routeParams, data, method, config); - return; - } - url = this._router.generate(route, routeParams); - defaultConfig = { - method: 'GET', - url: url, - data: data - }; - for (key in config) { - value = config[key]; - defaultConfig[key] = value; - } - return this._$http(config).success(function(data, status, headers, config) { - var name, _ref, _results; - if (onSuccess) { - onSuccess(data, status, headers, config); - } - _ref = data.data; - _results = []; - for (name in _ref) { - value = _ref[name]; - _results.push(_this.publisher.publishDataTo(name, value)); - } - return _results; - }).error(function(data, status, headers, config) { - if (onFailure) { - return onFailure(data, status, headers, config); - } - }); - }; - - Request.prototype._shelveRequest = function(route, routeParams, data, method, config) { - var request; - request = { - route: route, - routeParams: routeParams, - data: data, - config: config, - method: method - }; - return this._shelvedRequests.push(request); - }; - - Request.prototype._executeShelvedRequests = function() { - var req, _i, _len, _ref, _results; - _ref = this._shelvedRequests; - _results = []; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - req = _ref[_i]; - _results.push(this.post(req.route, req.routeParams, req.data, req.method, req.config)); - } - return _results; - }; - - return Request; - - })(); - return Request; - }); - - /* - # ownCloud - # - # @author Bernhard Posselt - # Copyright (c) 2012 - Bernhard Posselt <nukeawhale@gmail.com> - # - # This file is licensed under the Affero General Public License version 3 or - # later. - # - # See the COPYING-README file - # - */ - - - /* - # Inject router into angular to make testing easier - */ - - - angular.module('OC').factory('Router', function() { - return OC.Router; - }); - -}).call(this); - - -/* -# ownCloud news app -# -# @author Alessandro Cosentino -# @author Bernhard Posselt -# Copyright (c) 2012 - Alessandro Cosentino <cosenal@gmail.com> -# Copyright (c) 2012 - Bernhard Posselt <nukeawhale@gmail.com> -# -# This file is licensed under the Affero General Public License version 3 or -# later. -# -# See the COPYING-README file -# -*/ - - -(function() { - var app, markingRead, scrolling, - __hasProp = {}.hasOwnProperty, - __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; - - app = angular.module('News', ['ui']).config(function($provide) { - var config; - config = { - MarkReadTimeout: 500, - ScrollTimeout: 500, - initialLoadedItemsNr: 20, - FeedUpdateInterval: 6000000 - }; - return $provide.value('Config', config); - }); - - app.run([ - 'PersistenceNews', function(PersistenceNews) { - return PersistenceNews.loadInitial(); - } - ]); - - $(document).ready(function() { - $(this).keyup(function(e) { - if ((e.which === 116) || (e.which === 82 && e.ctrlKey)) { - document.location.reload(true); - return false; - } - }); - return $('#browselink').click(function() { - return $('#file_upload_start').trigger('click'); - }); - }); - - /* - # ownCloud news app - # - # @author Alessandro Cosentino - # @author Bernhard Posselt - # Copyright (c) 2012 - Alessandro Cosentino <cosenal@gmail.com> - # Copyright (c) 2012 - Bernhard Posselt <nukeawhale@gmail.com> - # - # This file is licensed under the Affero General Public License version 3 or - # later. - # - # See the COPYING-README file - # - */ - - - angular.module('News').factory('_ActiveFeed', function() { - var ActiveFeed; - ActiveFeed = (function() { - - function ActiveFeed() { - this.id = 0; - this.type = 3; - } - - ActiveFeed.prototype.handle = function(data) { - this.id = data.id; - return this.type = data.type; - }; - - return ActiveFeed; - - })(); - return ActiveFeed; - }); - - /* - # ownCloud news app - # - # @author Alessandro Cosentino - # @author Bernhard Posselt - # Copyright (c) 2012 - Alessandro Cosentino <cosenal@gmail.com> - # Copyright (c) 2012 - Bernhard Posselt <nukeawhale@gmail.com> - # - # This file is licensed under the Affero General Public License version 3 or - # later. - # - # See the COPYING-README file - # - */ - - - angular.module('News').factory('_Cache', function() { - var Cache; - Cache = (function() { - - function Cache(feedType, feedModel, folderModel) { - this.feedType = feedType; - this.feedModel = feedModel; - this.folderModel = folderModel; - this.clear(); - } - - Cache.prototype.clear = function() { - this.feedCache = []; - this.folderCache = {}; - this.folderCacheLastModified = 0; - this.importantCache = []; - this.highestId = 0; - this.lowestId = 0; - this.highestTimestamp = 0; - this.lowestTimestamp = 0; - this.highestIds = {}; - this.lowestIds = {}; - this.highestTimestamps = {}; - return this.lowestTimestamps = {}; - }; - - Cache.prototype.add = function(item) { - if (!this.feedCache[item.feedId]) { - this.feedCache[item.feedId] = []; - } - this.feedCache[item.feedId].push(item); - if (this.highestTimestamp < item.date) { - this.highestTimestamp = item.date; - } - if (this.lowestTimestamp > item.date) { - this.lowestTimestamp = item.date; - } - if (this.highestId < item.id) { - this.highestId = item.id; - } - if (this.lowestId > item.id) { - this.lowestId = item.id; - } - if (item.isImportant) { - this.importantCache.push(item); - } - if (this.highestTimestamps[item.feedId] === void 0 || item.id > this.highestTimestamps[item.feedId]) { - this.highestTimestamps[item.feedId] = item.date; - } - if (this.lowestTimestamps[item.feedId] === void 0 || item.id > this.lowestTimestamps[item.feedId]) { - this.lowestTimestamps[item.feedId] = item.date; - } - if (this.highestIds[item.feedId] === void 0 || item.id > this.highestIds[item.feedId]) { - this.highestIds[item.feedId] = item.id; - } - if (this.lowestIds[item.feedId] === void 0 || item.id > this.lowestIds[item.feedId]) { - return this.lowestIds[item.feedId] = item.id; - } - }; - - Cache.prototype.getItemsOfFeed = function(feedId) { - return this.feedCache[feedId]; - }; - - Cache.prototype.getFeedIdsOfFolder = function(folderId) { - this.buildFolderCache(folderId); - return this.folderCache[folderId]; - }; - - Cache.prototype.getImportantItems = function() { - return this.importantCache; - }; - - Cache.prototype.buildFolderCache = function(id) { - var feed, _i, _len, _ref, _results; - if (this.folderCacheLastModified !== this.feedModel.getLastModified()) { - this.folderCache = {}; - this.folderCacheLastModified = this.feedModel.getLastModified(); - } - if (this.folderCache[id] === void 0) { - this.folderCache[id] = []; - _ref = this.feedModel.getItems(); - _results = []; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - feed = _ref[_i]; - if (feed.folderId === id) { - _results.push(this.folderCache[id].push(feed.id)); - } else { - _results.push(void 0); - } - } - return _results; - } - }; - - Cache.prototype.getFeedsOfFolderId = function(id) { - this.buildFolderCache(id); - return this.folderCache[id]; - }; - - Cache.prototype.removeItemInArray = function(id, array) { - var counter, element, removeItemIndex, _i, _len; - removeItemIndex = null; - counter = 0; - for (_i = 0, _len = array.length; _i < _len; _i++) { - element = array[_i]; - if (element.id === id) { - removeItemIndex = counter; - break; - } - counter += 1; - } - if (removeItemIndex !== null) { - return array.splice(removeItemIndex, 1); - } - }; - - Cache.prototype.remove = function(item) { - this.removeItemInArray(item.id, this.feedCache[item.feedId]); - return this.removeItemInArray(item.id, this.importantCache); - }; - - Cache.prototype.setImportant = function(item, isImportant) { - if (isImportant) { - return this.importantCache.push(item); - } else { - return this.removeItemInArray(item.id, this.importantCache); - } - }; - - Cache.prototype.getHighestId = function(type, id) { - if (this.isFeed(type)) { - return this.highestIds[id] || 0; - } else { - return this.highestId; - } - }; - - Cache.prototype.getHighestTimestamp = function(type, id) { - if (this.isFeed(type)) { - return this.highestTimestamps[id] || 0; - } else { - return this.highestTimestamp; - } - }; - - Cache.prototype.getLowestId = function(type, id) { - if (this.isFeed(type)) { - return this.lowestIds[id] || 0; - } else { - return this.lowestId; - } - }; - - Cache.prototype.getLowestTimestamp = function(type, id) { - if (this.isFeed(type)) { - return this.lowestTimestamps[id] || 0; - } else { - return this.lowestTimestamp; - } - }; - - Cache.prototype.isFeed = function(type) { - return type === this.feedType.Feed; - }; - - return Cache; - - })(); - return Cache; - }); - - /* - # ownCloud news app - # - # @author Alessandro Cosentino - # @author Bernhard Posselt - # Copyright (c) 2012 - Alessandro Cosentino <cosenal@gmail.com> - # Copyright (c) 2012 - Bernhard Posselt <nukeawhale@gmail.com> - # - # This file is licensed under the Affero General Public License version 3 or - # later. - # - # See the COPYING-README file - # - */ - - - angular.module('News').factory('_FeedModel', [ - 'Model', function(Model) { - var FeedModel; - FeedModel = (function(_super) { - - __extends(FeedModel, _super); - - function FeedModel() { - FeedModel.__super__.constructor.call(this); - } - - FeedModel.prototype.add = function(item) { - return FeedModel.__super__.add.call(this, this.bindAdditional(item)); - }; - - FeedModel.prototype.bindAdditional = function(item) { - if (item.icon === "url()") { - item.icon = 'url(' + OC.imagePath('news', 'rss.svg') + ')'; - } - return item; - }; - - return FeedModel; - - })(Model); - return FeedModel; - } - ]); - - /* - # ownCloud news app - # - # @author Alessandro Cosentino - # @author Bernhard Posselt - # Copyright (c) 2012 - Alessandro Cosentino <cosenal@gmail.com> - # Copyright (c) 2012 - Bernhard Posselt <nukeawhale@gmail.com> - # - # This file is licensed under the Affero General Public License version 3 or - # later. - # - # See the COPYING-README file - # - */ - - - angular.module('News').factory('FeedType', function() { - var feedType; - return feedType = { - Feed: 0, - Folder: 1, - Starred: 2, - Subscriptions: 3, - Shared: 4 - }; - }); - - /* - # ownCloud news app - # - # @author Alessandro Cosentino - # @author Bernhard Posselt - # Copyright (c) 2012 - Alessandro Cosentino <cosenal@gmail.com> - # Copyright (c) 2012 - Bernhard Posselt <nukeawhale@gmail.com> - # - # This file is licensed under the Affero General Public License version 3 or - # later. - # - # See the COPYING-README file - # - */ - - - angular.module('News').factory('_FolderModel', [ - 'Model', function(Model, $rootScope) { - var FolderModel; - FolderModel = (function(_super) { - - __extends(FolderModel, _super); - - function FolderModel() { - FolderModel.__super__.constructor.call(this); - } - - return FolderModel; - - })(Model); - return FolderModel; - } - ]); - - /* - # ownCloud news app - # - # @author Alessandro Cosentino - # @author Bernhard Posselt - # Copyright (c) 2012 - Alessandro Cosentino <cosenal@gmail.com> - # Copyright (c) 2012 - Bernhard Posselt <nukeawhale@gmail.com> - # - # This file is licensed under the Affero General Public License version 3 or - # later. - # - # See the COPYING-README file - # - */ - - - angular.module('News').factory('_GarbageRegistry', function() { - var GarbageRegistry; - GarbageRegistry = (function() { - - function GarbageRegistry(itemModel) { - this.itemModel = itemModel; - this.registeredItemIds = {}; - } - - GarbageRegistry.prototype.register = function(item) { - var itemId; - itemId = item.id; - return this.registeredItemIds[itemId] = item; - }; - - GarbageRegistry.prototype.unregister = function(item) { - var itemId; - itemId = item.id; - return delete this.registeredItemIds[itemId]; - }; - - GarbageRegistry.prototype.clear = function() { - var id, item, _ref; - _ref = this.registeredItemIds; - for (id in _ref) { - item = _ref[id]; - if (!item.keptUnread) { - this.itemModel.removeById(parseInt(id, 10)); - } - item.keptUnread = false; - } - return this.registeredItemIds = {}; - }; - - return GarbageRegistry; - - })(); - return GarbageRegistry; - }); - - /* - # ownCloud news app - # - # @author Alessandro Cosentino - # @author Bernhard Posselt - # Copyright (c) 2012 - Alessandro Cosentino <cosenal@gmail.com> - # Copyright (c) 2012 - Bernhard Posselt <nukeawhale@gmail.com> - # - # This file is licensed under the Affero General Public License version 3 or - # later. - # - # See the COPYING-README file - # - */ - - - angular.module('News').factory('_ItemModel', [ - 'Model', function(Model) { - var ItemModel; - ItemModel = (function(_super) { - - __extends(ItemModel, _super); - - function ItemModel(cache, feedType) { - this.cache = cache; - this.feedType = feedType; - ItemModel.__super__.constructor.call(this); - } - - ItemModel.prototype.clearCache = function() { - this.cache.clear(); - return ItemModel.__super__.clearCache.call(this); - }; - - ItemModel.prototype.add = function(item) { - item = this.bindAdditional(item); - if (ItemModel.__super__.add.call(this, item)) { - return this.cache.add(this.getItemById(item.id)); - } - }; - - ItemModel.prototype.bindAdditional = function(item) { - item.getRelativeDate = function() { - return moment.unix(this.date).fromNow(); - }; - item.getAuthorLine = function() { - if (this.author !== null && this.author.trim() !== "") { - return "by " + this.author; - } else { - return ""; - } - }; - return item; - }; - - ItemModel.prototype.removeById = function(itemId) { - var item; - item = this.getItemById(itemId); - if (item !== void 0) { - this.cache.remove(item); - return ItemModel.__super__.removeById.call(this, itemId); - } - }; - - ItemModel.prototype.getHighestId = function(type, id) { - return this.cache.getHighestId(type, id); - }; - - ItemModel.prototype.getHighestTimestamp = function(type, id) { - return this.cache.getHighestTimestamp(type, id); - }; - - ItemModel.prototype.getLowestId = function(type, id) { - return this.cache.getLowestId(type, id); - }; - - ItemModel.prototype.getLowestTimestamp = function(type, id) { - return this.cache.getLowestTimestamp(type, id); - }; - - ItemModel.prototype.getFeedsOfFolderId = function(id) { - return this.cache.getFeedsOfFolderId(id); - }; - - ItemModel.prototype.getItemsByTypeAndId = function(type, id) { - var feedId, items, _i, _len, _ref; - switch (type) { - case this.feedType.Feed: - items = this.cache.getItemsOfFeed(id) || []; - return items; - case this.feedType.Subscriptions: - return this.getItems(); - case this.feedType.Folder: - items = []; - _ref = this.cache.getFeedIdsOfFolder(id); - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - feedId = _ref[_i]; - items = items.concat(this.cache.getItemsOfFeed(feedId) || []); - } - return items; - case this.feedType.Starred: - return this.cache.getImportantItems(); - } - }; - - ItemModel.prototype.setImportant = function(itemId, isImportant) { - var item; - item = this.getItemById(itemId); - this.cache.setImportant(item, isImportant); - return item.isImportant = isImportant; - }; - - return ItemModel; - - })(Model); - return ItemModel; - } - ]); - - /* - # ownCloud news app - # - # @author Alessandro Cosentino - # @author Bernhard Posselt - # Copyright (c) 2012 - Alessandro Cosentino <cosenal@gmail.com> - # Copyright (c) 2012 - Bernhard Posselt <nukeawhale@gmail.com> - # - # This file is licensed under the Affero General Public License version 3 or - # later. - # - # See the COPYING-README file - # - */ - - - angular.module('News').factory('_Loading', function() { - var Loading; - return Loading = (function() { - - function Loading() { - this.loading = 0; - } - - return Loading; - - })(); - }); - - /* - # ownCloud news app - # - # @author Alessandro Cosentino - # @author Bernhard Posselt - # Copyright (c) 2012 - Alessandro Cosentino <cosenal@gmail.com> - # Copyright (c) 2012 - Bernhard Posselt <nukeawhale@gmail.com> - # - # This file is licensed under the Affero General Public License version 3 or - # later. - # - # See the COPYING-README file - # - */ - - - angular.module('News').factory('Model', function() { - var Model; - Model = (function() { - - function Model() { - this.clearCache(); - } - - Model.prototype.handle = function(data) { - var item, _i, _len, _results; - _results = []; - for (_i = 0, _len = data.length; _i < _len; _i++) { - item = data[_i]; - _results.push(this.add(item)); - } - return _results; - }; - - Model.prototype.clearCache = function() { - this.items = []; - this.itemIds = {}; - return this.markAccessed(); - }; - - Model.prototype.markAccessed = function() { - return this.lastAccessed = new Date().getTime(); - }; - - Model.prototype.getLastModified = function() { - return this.lastAccessed; - }; - - Model.prototype.add = function(item) { - if (this.itemIds[item.id] === void 0) { - this.items.push(item); - this.itemIds[item.id] = item; - this.markAccessed(); - return true; - } else { - this.update(item); - return false; - } - }; - - Model.prototype.update = function(item) { - var key, updatedItem, value; - updatedItem = this.itemIds[item.id]; - for (key in item) { - value = item[key]; - if (key !== 'id') { - updatedItem[key] = value; - } - } - return this.markAccessed(); - }; - - Model.prototype.removeById = function(id) { - var counter, item, removeItemIndex, _i, _len, _ref; - removeItemIndex = null; - counter = 0; - _ref = this.items; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - item = _ref[_i]; - if (item.id === id) { - removeItemIndex = counter; - break; - } - counter += 1; - } - if (removeItemIndex !== null) { - this.items.splice(removeItemIndex, 1); - delete this.itemIds[id]; - } - return this.markAccessed(); - }; - - Model.prototype.getItemById = function(id) { - return this.itemIds[id]; - }; - - Model.prototype.getItems = function() { - return this.items; - }; - - return Model; - - })(); - return Model; - }); - - /* - # ownCloud news app - # - # @author Alessandro Cosentino - # @author Bernhard Posselt - # Copyright (c) 2012 - Alessandro Cosentino <cosenal@gmail.com> - # Copyright (c) 2012 - Bernhard Posselt <nukeawhale@gmail.com> - # - # This file is licensed under the Affero General Public License version 3 or - # later. - # - # See the COPYING-README file - # - */ - - - angular.module('News').factory('_OPMLParser', function() { - var Feed, Folder, OPMLParser; - Feed = (function() { - - function Feed(name, url) { - this.name = name; - this.url = url; - } - - Feed.prototype.getName = function() { - return this.name; - }; - - Feed.prototype.getUrl = function() { - return this.url; - }; - - Feed.prototype.isFolder = function() { - return false; - }; - - return Feed; - - })(); - Folder = (function() { - - function Folder(name) { - this.name = name; - this.items = []; - } - - Folder.prototype.add = function(feed) { - return this.items.push(feed); - }; - - Folder.prototype.getItems = function() { - return this.items; - }; - - Folder.prototype.getName = function() { - return this.name; - }; - - Folder.prototype.isFolder = function() { - return true; - }; - - return Folder; - - })(); - OPMLParser = (function() { - - function OPMLParser() {} - - OPMLParser.prototype.parseXML = function(xml) { - var $root, $xml, structure; - $xml = $($.parseXML(xml)); - $root = $xml.find('body'); - structure = new Folder('root'); - this._recursivelyParse($root, structure); - return structure; - }; - - OPMLParser.prototype._recursivelyParse = function($xml, structure) { - var $outline, feed, folder, outline, _i, _len, _ref, _results; - _ref = $xml.children('outline'); - _results = []; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - outline = _ref[_i]; - $outline = $(outline); - if ($outline.attr('type') !== void 0) { - feed = new Feed($outline.attr('text'), $outline.attr('xmlUrl')); - _results.push(structure.add(feed)); - } else { - folder = new Folder($outline.attr('text')); - structure.add(folder); - _results.push(this._recursivelyParse($outline, folder)); - } - } - return _results; - }; - - return OPMLParser; - - })(); - return OPMLParser; - }); - - /* - # ownCloud news app - # |