diff --git a/modules/discojuice/www/discojuice/discojuice.hosted.js b/modules/discojuice/www/discojuice/discojuice.hosted.js index f426cd26568fdc414d7ee06172f279a9d58f4263..28184bd56bf4c5686eb95e2ec384b59a57bd39f5 100644 --- a/modules/discojuice/www/discojuice/discojuice.hosted.js +++ b/modules/discojuice/www/discojuice/discojuice.hosted.js @@ -5,35 +5,45 @@ */ if (typeof DiscoJuice == "undefined") var DiscoJuice = {}; +function getConfig (target, title, spentityid, responseurl, feeds, redirectURL) { + var options, i; + + options = { + "title": "Sign in to <strong>" + title + "</strong>", + "subtitle": "Select your Provider", + "disco": { + "spentityid": spentityid, + "url": responseurl, + "stores": ["https://store.discojuice.org/"], + "writableStore": "https://store.discojuice.org/" + }, + "cookie": true, + "country": true, + "location": true, + "countryAPI": "https://store.discojuice.org/country", + "discoPath": "https://static.discojuice.org/", + "callback": function (e, djc) { + var returnto = window.location.href; + window.location = redirectURL + escape(e.entityID); + }, + "metadata": [] + }; + + for(i = 0; i < feeds.length; i++) { + options.metadata.push("https://static.discojuice.org/feeds/" + feeds[i]); + } + return options; +} + + DiscoJuice.Hosted = { - "setup": function (target, title, spentityid, responseurl, feeds, redirectURL) { - var options, i; - - options = { - "title": "Sign in to <strong>" + title + "</strong>", - "subtitle": "Select your Provider", - "disco": { - "spentityid": spentityid, - "url": responseurl, - "stores": ["https://store.discojuice.org/"], - "writableStore": "https://store.discojuice.org/" - }, - "cookie": true, - "country": true, - "location": true, - "countryAPI": "https://store.discojuice.org/country", - "discoPath": "https://static.discojuice.org/", - "callback": function (e, djc) { - var returnto = window.location.href; - window.location = redirectURL + escape(e.entityID); - }, - "metadata": [] - }; + "getConfig": getConfig, - for(i = 0; i < feeds.length; i++) { - options.metadata.push("https://static.discojuice.org/feeds/" + feeds[i]); - } + "setup": function (target, title, spentityid, responseurl, feeds, redirectURL) { + var options; + + options = getConfig(target, title, spentityid, responseurl, feeds, redirectURL); $(document).ready(function() { $(target).DiscoJuice(options);