-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhome.region
90 lines (74 loc) · 2.68 KB
/
home.region
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<body id="home">
<div id="main-wrapper">
{.section website}
<squarespace:navigation navigationId="pages" template="navigation" />
{.end}
<squarespace:block-field id="homeBanner" label="Home Banner" />
<div class="hero-summary">
<squarespace:block-field id="homeHeader" label="Home Header" />
</div>
<section class="intro">
<div class="container">
<div class="row">
<div class="col-md-8">
<squarespace:block-field id="homeText1" label="Text 1" />
</div>
<div class="col-md-4">
<squarespace:block-field id="homeImage1" label="Image 1" />
</div>
</div>
</div>
</section>
<section class="open-data section-grey">
<div class="container">
<div class="row">
<div class="col col-md-5">
<squarespace:block-field id="siteStats" label="Site Stat" />
</div>
<div class="col col-md-7">
<squarespace:block-field id="homeText2" label="Text 2" />
</div>
</div>
</div>
</section>
<section class="activities">
<div class="container">
<div class="row">
<squarespace:block-field id="site-pages" label="Site Pages" />
</div>
</div>
</section>
<section class="news section-grey">
<div class="container">
<squarespace:block-field id="updates" label="Updates" />
</div>
</section>
<section class="cta">
<div class="container">
<squarespace:block-field id="join" label="Join" />
</div>
</section>
<script>
document.addEventListener("DOMContentLoaded", function(){
fetch('https://data.ucedna.com/api/v1/stats/home_page')
.then(response => response.json())
.then(data => {
const numberWithCommas = (x) => {
// https://stackoverflow.com/a/2901298
return x.toString().replace(/\B(?=(\d\d\d)+(?!\d))/g, ",");
};
const samplesEl = document.querySelector("#js-samples-count");
const organismsEl = document.querySelector("#js-organisms-count");
const usersEl = document.querySelector("#js-users-count");
if (samplesEl) {
samplesEl.textContent = numberWithCommas(data.samples_approved);
}
if (organismsEl) {
organismsEl.textContent = numberWithCommas(data.organisms);
}
if (usersEl) {
usersEl.textContent = numberWithCommas(data.users);
}
})
});
</script>