From d85b56d5c967651e47e9723859b516c7d9c463ae Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Sat, 28 Feb 2015 14:17:07 +0100 Subject: prefill add feed if url parameter given --- js/build/app.js | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'js/build/app.js') diff --git a/js/build/app.js b/js/build/app.js index 43bfcbd17..ae9ed83d6 100644 --- a/js/build/app.js +++ b/js/build/app.js @@ -1,4 +1,4 @@ -(function(window, document, angular, $, OC, csrfToken, undefined){ +(function(window, document, angular, $, OC, csrfToken, url, undefined){ 'use strict'; @@ -1964,6 +1964,33 @@ app.service('SettingsResource', ["$http", "BASE_URL", function ($http, BASE_URL) }; }]); +/** + * This prefills the add feed section if an external link has ?subsribe_to + * filled out + */ +(function (document, url, $, undefined) { + 'use strict'; + + $(document).ready(function () { + var subscription = url('?subscribe_to'); + + if (subscription) { + $('#new-feed').show(); + + var input = $('input[ng-model="Navigation.feed.url"]'); + input.val(subscription); + + // hacky way to focus because initial loading of a feed + // steals the focus + setTimeout(function() { + input.focus(); + }, 1000); + } + }); + +})(document, url, $); + + /** * Code in here acts only as a click shortcut mechanism. That's why its not * being put into a directive since it has to be tested with protractor @@ -2854,4 +2881,4 @@ app.directive('newsTriggerClick', function () { }); -})(window, document, angular, jQuery, OC, oc_requesttoken); \ No newline at end of file +})(window, document, angular, jQuery, OC, oc_requesttoken, url); \ No newline at end of file -- cgit v1.2.3