Compare commits
1 commit
d78c470829
...
e78988cd0b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e78988cd0b |
2 changed files with 7 additions and 10 deletions
|
|
@ -87,7 +87,7 @@
|
||||||
<section id="progress">
|
<section id="progress">
|
||||||
<p>Il y a</p>
|
<p>Il y a</p>
|
||||||
<div class="places"><span class="bar"><span id="gauge-bar" style="width:0" class="progression lessthanhalf"><span id="gauge-text">?/200</span></span></span></div>
|
<div class="places"><span class="bar"><span id="gauge-bar" style="width:0" class="progression lessthanhalf"><span id="gauge-text">?/200</span></span></span></div>
|
||||||
<p>places déjà réservées. Ouverture prochaine des inscriptions !</p>
|
<p>places déjà réservées</p>
|
||||||
<br>
|
<br>
|
||||||
<p>Et nous avons reçu</p>
|
<p>Et nous avons reçu</p>
|
||||||
<div class="places"><span class="bar"><span id="fundraising-bar" style="width:0" class="progression lessthanhalf"><span id="fundraising-text">? %</span></span></span></div>
|
<div class="places"><span class="bar"><span id="fundraising-bar" style="width:0" class="progression lessthanhalf"><span id="fundraising-text">? %</span></span></span></div>
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,7 @@ const fundraising_url = "https://api.camp.interhacker.space/api/fundraising"
|
||||||
const gaugeMax = 250;
|
const gaugeMax = 250;
|
||||||
const fundraisingTotalMax = 20000;
|
const fundraisingTotalMax = 20000;
|
||||||
|
|
||||||
async function getGauge() {
|
async function getGauge() {
|
||||||
// REMOVE WHEN SIGNUP FORM IS OPEN
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch(gauge_url);
|
const response = await fetch(gauge_url);
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
|
|
@ -23,7 +20,7 @@ async function getGauge() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getFundraisingTotal() {
|
async function getFundraisingTotal() {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(fundraising_url);
|
const response = await fetch(fundraising_url);
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
|
|
@ -44,17 +41,17 @@ function percentRatio(ratio) {
|
||||||
return Math.floor(ratio * 100);
|
return Math.floor(ratio * 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setAboveHalf(ratio, element) {
|
function setAboveHalf(ratio, element) {
|
||||||
if (ratio > 0.5) {
|
if (ratio > 0.5) {
|
||||||
element.classList.remove("lessthanhalf");
|
element.classList.remove("lessthanhalf");
|
||||||
element.classList.add("morethanhalf");
|
element.classList.add("morethanhalf");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function setGauge() {
|
async function setGauge() {
|
||||||
const gauge = await getGauge();
|
const gauge = await getGauge();
|
||||||
|
|
||||||
if (gauge !== null) {
|
if (gauge) {
|
||||||
const gaugeBar = document.getElementById("gauge-bar");
|
const gaugeBar = document.getElementById("gauge-bar");
|
||||||
const gaugeText = document.getElementById("gauge-text");
|
const gaugeText = document.getElementById("gauge-text");
|
||||||
|
|
||||||
|
|
@ -70,7 +67,7 @@ async function setGauge() {
|
||||||
async function setFundraisingTotal() {
|
async function setFundraisingTotal() {
|
||||||
const fundraising_total = await getFundraisingTotal();
|
const fundraising_total = await getFundraisingTotal();
|
||||||
|
|
||||||
if (fundraising_total !== null) {
|
if (fundraising_total) {
|
||||||
const fundraisingBar = document.getElementById("fundraising-bar");
|
const fundraisingBar = document.getElementById("fundraising-bar");
|
||||||
const fundraisingText = document.getElementById("fundraising-text");
|
const fundraisingText = document.getElementById("fundraising-text");
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue