diff --git a/index.html b/index.html index 1817de7df4501fe03cdaed329366880df67b1117..44430edaa72fc61aab6bf9701c0c36f170f5a1c5 100644 --- a/index.html +++ b/index.html @@ -1,68 +1,72 @@ - - - - -Morpheus - - - - - - - + + + + + Morpheus + + + + + + + - -
+ +
- + var search = window.location.search; + if (search.length === 0) { + search = window.location.hash; + } + var landingPage = new morpheus.LandingPage(); + landingPage.$el.prependTo($(document.body)); + if (search.length === 0) { + landingPage.show(); + } else { + var search = search.substring(1); + var keyValuePairs = search.split('&'); + var params = {}; + for (var i = 0; i < keyValuePairs.length; i++) { + var pair = keyValuePairs[i].split('='); + params[pair[0]] = decodeURIComponent(pair[1]); + } + if (params.json) { + var options = JSON.parse(params.json); + landingPage.open(options); + } else if (params.url) { // url to config + $.ajax({ + url: params.url + }).done(function (json) { + landingPage.open(json); + }).fail(function () { + console.log('Unable to get config file'); + landingPage.show(); + }); + } else { + landingPage.show(); + } + } +