accurator/commit
UI elements now depent on indicated domain.
author | Chris Dijkshoorn |
---|---|
Tue Feb 10 17:04:26 2015 +0000 | |
committer | Chris Dijkshoorn |
Tue Feb 10 17:04:26 2015 +0000 | |
commit | 46892da2eb2fbfadb9b46a7b03f50d4ae96b7e42 |
tree | 58f18e20fc502c83d7e93f5468dabc0a4d41fc66 |
parent | 118e7b1dc4b6cada6b560235e03bd46b9cfee4ca |
Diff style: patch stat
diff --git a/web/html/intro.html b/web/html/intro.html index 6646830..1c9dd0a 100644 --- a/web/html/intro.html +++ b/web/html/intro.html @@ -24,7 +24,7 @@ </nav> <!-- Background --> - <img class="backgroundImage" src="img/background/bird.jpg"></img> + <img class="backgroundImage" src=""></img> <!-- Text and Buttons--> <div class="introText container"> diff --git a/web/img/background/bible-dark.jpg b/web/img/background/bible-dark.jpg new file mode 100644 index 0000000..de6271e Binary files /dev/null and b/web/img/background/bible-dark.jpg differ diff --git a/web/img/background/bird.jpg b/web/img/background/bird.jpg new file mode 100644 index 0000000..76ba82d Binary files /dev/null and b/web/img/background/bird.jpg differ diff --git a/web/img/background/generic.jpg b/web/img/background/generic.jpg new file mode 100644 index 0000000..ae8ec5b Binary files /dev/null and b/web/img/background/generic.jpg differ diff --git a/web/js/accurator_intro.js b/web/js/accurator_intro.js index d167dd9..f71ef4f 100644 --- a/web/js/accurator_intro.js +++ b/web/js/accurator_intro.js @@ -1,27 +1,61 @@ /* Accurator Intro */ -var locale; -var ui = "http://accurator.nl/ui/bird#intro"; +var locale, ui, domain; function introInit() { + locale = getLocale(); + domain = getParameterByName("domain"); + ui = getUiUri(domain, "intro"); + setBackground(); + // If user is logged in go to profile page otherwise show intro. onSuccess = function() { document.location.href="profile.html"; }; onFail = function() { - locale = getLocale(); - populateUI(); + populateUI(ui); }; userLoggedIn(onSuccess, onFail); } -function populateUI() { - $.getJSON("ui_elements", {locale:locale, ui:ui, type:"labels"}) +function setBackground() { + // Set a background according to the specified domain + backgroundUrl = "img/background/" + domain + ".jpg"; + backgroundDarkUrl = "img/background/" + domain + "-dark.jpg"; + backgroundGeneric = "img/background/generic.jpg"; + + $.ajax({url:backgroundUrl, + type:'HEAD', + success: function() { + $(".backgroundImage").attr("src", backgroundUrl); + } + }); + $.ajax({url:backgroundDarkUrl, + type:'HEAD', + success: function() { + $(".backgroundImage").attr("src", backgroundDarkUrl); + lightFontColor(); + }, + fail: function() { + $(".backgroundImage").attr("src", backgroundDarkUrl); + } + }); +} + +function lightFontColor() { + $("#txtSlogan").css('color', '#FFFFFF'); + $("#btnLogin").css('color', '#BBBBBB'); +} + +function populateUI(uiLocal) { + $.getJSON("ui_elements", {locale:locale, ui:uiLocal, type:"labels"}) .done(function(data){ addButtonEvents(); initLabels(data);}) .fail(function(data, textStatus){ - $("#txtSubSlogan").replaceWith('Problem connecting to server, please contact the system administrator');}); + //Use generic ui elements + populateUI(getGenericUiUri("intro")); + }); } function addButtonEvents() { diff --git a/web/js/accurator_utilities.js b/web/js/accurator_utilities.js index af86334..86b40c6 100644 --- a/web/js/accurator_utilities.js +++ b/web/js/accurator_utilities.js @@ -2,7 +2,15 @@ */ var loginWarning, loginIncomplete; -//Logo referal +//UI +function getUiUri(domain, page) { + return "http://accurator.nl/ui/" + domain + "#" + page; +} + +function getGenericUiUri(page) { + return "http://accurator.nl/ui/generic#" + page; +} + function setLinkLogo(page) { if(page === "profile") $(".navbar-brand").attr('href', "profile.html");