accurator/commit
Optimized domain page.
author | Chris Dijkshoorn |
---|---|
Fri Mar 18 20:57:12 2016 +0100 | |
committer | Chris Dijkshoorn |
Fri Mar 18 20:57:12 2016 +0100 | |
commit | 0486822a3c3a30b4e0f1c512a59f59e032e37154 |
tree | 3720a31553d99081137bfbfad8dcddafbb212ec1 |
parent | f9b122746adac09cbb398dec63a00370994f1727 |
Diff style: patch stat
diff --git a/web/html/domain.html b/web/html/domain.html index 89ccaff..714bdef 100644 --- a/web/html/domain.html +++ b/web/html/domain.html @@ -40,46 +40,6 @@ </div> </div> - <!-- Logos --> - <div class="footerDiv container"> - <div class="logo col-md-2 col-xs-4"> - <a href="http://commit-nl.nl/"> - <img src="img/logos/commit.png" class="footerImgLogo" id="footerImgCommitLogo" alt="Logo of "> - </img> - </a> - </div> - <div class="logo col-md-2 col-xs-4"> - <a href="http://www.cwi.nl"> - <img src="img/logos/cwi.png" class="footerImgLogo" alt="Logo of CWI"> - </img> - </a> - </div> - <div class="logo col-md-2 col-xs-4"> - <a href="http://www.tudelft.nl"> - <img src="img/logos/tud.png" class="footerImgLogo" alt="Logo of TU Delft"> - </img> - </a> - </div> - <div class="logo col-md-2 col-xs-4"> - <a href="http://vu.nl/"> - <img src="img/logos/vu.png" class="footerImgLogo" alt="Logo of VU University Amsterdam"> - </img> - </a> - </div> - <div class="logo col-md-2 col-xs-4"> - <a href="http://rijksmuseum.nl"> - <img src="img/logos/rma.png" class="footerImgLogo" id="footerImgRijksmuseumLogo" alt="Logo of Rijksmuseum"> - </img> - </a> - </div> - <div class="logo col-md-2 col-xs-4"> - <a href="http://www.naturalis.nl/"> - <img src="img/logos/naturalis.png" class="footerImgLogo" alt="Logo of Naturalis"> - </img> - </a> - </div> - </div> - <!-- Login modal --> <div class="modal fade" id="loginDivLogin"> <div class="modal-dialog"> diff --git a/web/js/accurator_domain.js b/web/js/accurator_domain.js index 64edca4..b3d18b8 100644 --- a/web/js/accurator_domain.js +++ b/web/js/accurator_domain.js @@ -42,18 +42,10 @@ function domainInit() { } } -function nextPage() { - // we do not need expertise to do random stuff - if(experiment === "random") - return function(){document.location.href="results.html"}; - - return function(){document.location.href="expertise.html"}; -} - function populateDomains(locale, domainLabels) { var row; - // Get domain settings for all the domains + // get domain settings for all the domains for(var i=0; i<domainLabels.length; i++) { if(!(i%2===0)) { row = parseInt((i/2) + 0.5); @@ -63,42 +55,45 @@ function populateDomains(locale, domainLabels) { 'id':'domain' + row})); } - // Add domain specific html to rows + // add domain specific html to rows $.getJSON("domains", {domain:domainLabels[i]}) - .done(function(data){ - if(!(data.domain === "generic")) { - domainHtml(data, row, locale); - } - }); + .then(function(domainData) { + if(!(domainData.domain === "generic")) { + domainHtml(domainData, row, locale); + } + }); } } function domainHtml(domainData, row, locale) { var domain = domainData.domain; - $.getJSON("ui_elements", - {locale:locale, - ui:domainData.ui + "domain", - type:"labels"}) - .done(function(data){ - $("#domain" + row).append( - $.el.div({'class':'noPadding col-md-6'}, - $.el.h3({'class':'domainHdr', - 'id':'domainTxt' + domain}, - data.domainLabel), - $.el.img({'class':'domainImg', - 'id':'domainImg' + domain, - 'src':domainData.image}))); - if(domainData.image_brightness === "dark") - $("#domainTxt" + domainData.domain).css('color', '#fff'); - addDomainEvent(domain); - }); + getLabels(locale, domainData.ui + "domain") + .then(function(labels) { + $("#domain" + row).append( + $.el.div({'class':'noPadding col-md-6'}, + $.el.h3({'class':'domainHdr', + 'id':'domainTxt' + domain}, + labels.domainLabel), + $.el.img({'class':'domainImg', + 'id':'domainImg' + domain, + 'src':domainData.image}))); + if(domainData.image_brightness === "dark") + $("#domainTxt" + domainData.domain).css('color', '#fff'); + addDomainEvent(domain); + }); } function addDomainEvent(domain) { - $("#domainImg"+domain).click(function() { - setDomain(domain, nextPage()); + $("#domainImg" + domain).click(function() { + setDomain(domain) + .then(function() { + document.location.href="expertise.html" + }); }); - $("#domainTxt"+domain).click(function() { - setDomain(domain, nextPage()); + $("#domainTxt" + domain).click(function() { + setDomain(domain) + .then(function() { + document.location.href="expertise.html" + }); }); } diff --git a/web/js/accurator_utilities.js b/web/js/accurator_utilities.js index 0286f38..767c2c5 100644 --- a/web/js/accurator_utilities.js +++ b/web/js/accurator_utilities.js @@ -84,7 +84,7 @@ function setDomainToGenericOrParameter() { } } -function setDomain(domain, onSuccess) { +function setDomain(domain) { localStorage.setItem("domain", domain); return save_user_info({"domain":domain}); }