From 71269582fa0d07ff91ad80a04e39428ff735748f Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Wed, 19 Nov 2014 16:43:14 +0100 Subject: allow to add feeds from recommended sites --- js/directive/NewsAddFeed.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 js/directive/NewsAddFeed.js (limited to 'js/directive') diff --git a/js/directive/NewsAddFeed.js b/js/directive/NewsAddFeed.js new file mode 100644 index 000000000..b4b615b71 --- /dev/null +++ b/js/directive/NewsAddFeed.js @@ -0,0 +1,32 @@ +/** + * ownCloud - News + * + * This file is licensed under the Affero General Public License version 3 or + * later. See the COPYING file. + * + * @author Bernhard Posselt + * @copyright Bernhard Posselt 2014 + */ +app.directive('newsAddFeed', function ($rootScope, $timeout) { + 'use strict'; + + return { + restrict: 'A', + link: function (scope, elem) { + $rootScope.$on('addFeed', function (_, url) { + + $timeout(function () { + if (elem.is(':animated')) { + elem.stop(true, true); + elem.show(); + } else if (!elem.is(':visible')) { + elem.slideDown(); + } + elem.find('[ng-model="Navigation.feed.url"]').focus(); + }); + + scope.Navigation.feed.url = url; + }); + } + }; +}); \ No newline at end of file -- cgit v1.2.3