Skip to content

Commit

Permalink
Show images in Biocaching taxa browser
Browse files Browse the repository at this point in the history
  • Loading branch information
pbb72 committed Aug 31, 2016
1 parent 7d14834 commit 552a143
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
13 changes: 10 additions & 3 deletions www/code/taxonomy.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,26 @@ var id = 0, rootId = 0;

function loadDataBiocaching() {
if (id == rootId)
// root taxon doesn't exist, so insert it here
buildInfoBiocaching({hits:[{_source:{scientific_name:"biota"}}]});
else
// get taxon data from server
getData("https://api.biocaching.com/taxa/" + id + "?fields=all", buildInfoBiocaching)

// get data on child taxa
var path = "?size=99&fields=all";
if (id != rootId) path += "&parent_id=" + id;
getData("https://api.biocaching.com/taxa/" + path, buildListBiocaching);
}

function buildInfoBiocaching(taxonData) {
var name = taxonData.hits[0]._source.scientific_name;
name = name.charAt(0).toUpperCase() + name.slice(1);
buildPage({name: name, register: true})
var info = {};
info.name = taxonData.hits[0]._source.scientific_name;
info.name = info.name.charAt(0).toUpperCase() + info.name.slice(1);
if (taxonData.hits[0]._source.primary_picture != null)
info.img = "https://api.biocaching.com" + taxonData.hits[0]._source.primary_picture.urls.medium;
info.register = true;
buildPage(info);

if (id != rootId) {
if (taxonData.hits[0]._source.parent_id == null)
Expand Down
3 changes: 0 additions & 3 deletions www/style/default.css
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,6 @@ figure {
max-height: 30em;
margin-bottom: -4rem;
}
.biocaching figure {
display: none;
}
figure img {
display: block;
height: 100%;
Expand Down

0 comments on commit 552a143

Please sign in to comment.