Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 346e64b

Browse files
up: bateu 2kk
1 parent c5fc724 commit 346e64b

File tree

4 files changed

+51
-8
lines changed

4 files changed

+51
-8
lines changed

‎assets/metas.png‎

-218 Bytes
Loading[フレーム]

‎index.css‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ body {
8080
#marks {
8181
background-image: url(assets/metas.png);
8282
background-repeat: no-repeat;
83-
height: 21px;
84-
width: 193px;
83+
height: 23px;
84+
width: 205px;
8585
}
8686

8787
/* Values */
@@ -153,11 +153,16 @@ body {
153153

154154
/* Feito Por */
155155

156-
#info, #by {
156+
.info, #by {
157157
font-family: 'Candara';
158158
font-size: 12px;
159159
}
160160

161+
#apoio {
162+
margin-top: 8px;
163+
font-size: 20px;
164+
}
165+
161166
#by {
162167
text-align: center;
163168
}

‎index.html‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<div class="w-100" id="marks-container">
2222
<div id="marks"></div>
2323
</div>
24-
<div class="progress bg-white" id="progressbar-container" style="margin-right: 12px;">
24+
<div class="progress bg-white" id="progressbar-container" style="margin-right: 6px;">
2525
<div class="progress-bar" id="progressbar-conf" role="progressbar"></div>
2626
<div class="progress-bar" id="progressbar-wait" role="progressbar" style="width: 10%;"></div>
2727
</div>
@@ -44,8 +44,9 @@
4444
<div class="total-texts" id="total-value"></div>
4545
</div>
4646

47-
<div id="info">Obs: Valores com base no valor de apoio mínimo</div>
48-
<div id="info">Se ainda não apoiou, <a href="https://www.catarse.me/ordem" target="_blank">clica aqui</a></div>
47+
<div class="info">Obs: Valores com base no valor de apoio mínimo</div>
48+
<div class="info" id="apoio">Se ainda não apoiou, <a href="https://www.catarse.me/ordem" target="_blank">clica
49+
aqui</a></div>
4950
</div>
5051
<div id="by">Programação: <a href="https://twitter.com/gabrielf_dev" target="_blank">@gabrielf_dev</a> | Design: <a
5152
href="https://twitter.com/taisa_semh" target="_blank">@taisa_semh</a></div>

‎index.js‎

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
window.addEventListener('load', () => {
2-
const META = 1200000;
2+
const META = 3000000;
33

44
axios.get('https://api.catarse.me/project_details?project_id=eq.122021')
55
.then((projectRes) => {
@@ -35,6 +35,43 @@ window.addEventListener('load', () => {
3535
.catch((error) => {
3636
console.log(error);
3737
});
38+
39+
setInterval(() => {
40+
axios.get('https://api.catarse.me/project_details?project_id=eq.122021')
41+
.then((projectRes) => {
42+
let data = projectRes.data[0];
43+
let pledged = data.pledged;
44+
45+
document.getElementById('progressbar-conf').style.width = `${calcPercent(pledged)}%`;
46+
document.getElementById('pledged').innerHTML = `${formatMoney(pledged)}`;
47+
48+
axios.get('https://api.catarse.me/reward_details?project_id=eq.122021')
49+
.then((detailsRes) => {
50+
let data = detailsRes.data;
51+
let waiting = 0;
52+
53+
data.forEach((d) => {
54+
let minimum = d.minimum_value;
55+
let wait = d.waiting_payment_count;
56+
57+
waiting += minimum * wait;
58+
});
59+
60+
let total = pledged + waiting;
61+
62+
document.getElementById('progressbar-wait').style.width = pledged >= META ? '0%' : `${(waiting + pledged) >= META ? calcPercent(META - pledged) : calcPercent(waiting)}%`;
63+
document.getElementById('waiting').innerHTML = `${formatMoney(waiting)}`;
64+
document.getElementById('total-value').innerHTML = `${formatMoney(total)}`;
65+
})
66+
.catch((error) => {
67+
console.log(error);
68+
});
69+
70+
})
71+
.catch((error) => {
72+
console.log(error);
73+
});
74+
}, 10000);
3875
});
3976

4077
function formatMoney(number = 0, prefix = true) {
@@ -54,7 +91,7 @@ function formatMoney(number = 0, prefix = true) {
5491
}
5592
}
5693

57-
function calcPercent(number = 0, total = 1200000) {
94+
function calcPercent(number = 0, total = 3000000) {
5895
return (number * 100) / total;
5996
}
6097

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /