Skip to content

Commit 38cac7a

Browse files
committed
fixing SPP`s countdown in landing page
1 parent f57ce03 commit 38cac7a

File tree

2 files changed

+20
-21
lines changed

2 files changed

+20
-21
lines changed

pythonpro/core/static/js/spp/countdown.js

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,20 @@ function initCountDown(countDown) {
33
minute = second * 60,
44
hour = minute * 60,
55
day = hour * 24;
6-
x = setInterval(function () {
6+
x = setInterval(function () {
77

8-
let now = new Date().getTime(),
9-
distance = countDown - now;
8+
let now = new Date().getTime(),
9+
distance = countDown - now;
1010

11-
document.getElementsByClassName('days')[0].innerText = Math.floor(distance / (day)),
12-
document.getElementsByClassName('days')[1].innerText = Math.floor(distance / (day)),
13-
document.getElementsByClassName('hours')[0].innerText = Math.floor((distance % (day)) / (hour)),
14-
document.getElementsByClassName('hours')[1].innerText = Math.floor((distance % (day)) / (hour)),
15-
document.getElementsByClassName('minutes')[0].innerText = Math.floor((distance % (hour)) / (minute)),
16-
document.getElementsByClassName('minutes')[1].innerText = Math.floor((distance % (hour)) / (minute)),
17-
document.getElementsByClassName('seconds')[0].innerText = Math.floor((distance % (minute)) / second),
18-
document.getElementsByClassName('seconds')[1].innerText = Math.floor((distance % (minute)) / second);
11+
document.getElementsByClassName('days')[0].innerText = Math.floor(distance / (day));
12+
document.getElementsByClassName('hours')[0].innerText = Math.floor((distance % (day)) / (hour));
13+
document.getElementsByClassName('minutes')[0].innerText = Math.floor((distance % (hour)) / (minute));
14+
document.getElementsByClassName('seconds')[0].innerText = Math.floor((distance % (minute)) / second);
1915

20-
if (distance < 0) {
21-
clearInterval(x);
22-
'Tempo esgotado!';
23-
}
16+
if (distance < 0) {
17+
clearInterval(x);
18+
'Tempo esgotado!';
19+
}
2420

25-
}, second)
21+
}, second)
2622
}

pythonpro/launch/templates/launch/landing_page.html

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,22 +147,22 @@ <h3 class="countdown__group__subtitle fw-300 text-blue">Não perca tempo e garan
147147

148148
<div class="countdown__group__numbers">
149149
<div class="countdown__group__numbers__item">
150-
<span class="countdown__group__numbers__item__time text-blue fw-900 font-highlighted" id="days"></span>
150+
<span class="countdown__group__numbers__item__time text-blue fw-900 font-highlighted days" id="days"></span>
151151
<span class="countdown__group__numbers__item__description text-uppercase text-green fw-700">Dias</span>
152152
</div>
153153

154154
<div class="countdown__group__numbers__item">
155-
<span class="countdown__group__numbers__item__time text-blue fw-900 font-highlighted" id="hours"></span>
155+
<span class="countdown__group__numbers__item__time text-blue fw-900 font-highlighted hours" id="hours"></span>
156156
<span class="countdown__group__numbers__item__description text-uppercase text-green fw-700">Horas</span>
157157
</div>
158158

159159
<div class="countdown__group__numbers__item">
160-
<span class="countdown__group__numbers__item__time text-blue fw-900 font-highlighted" id="minutes"></span>
160+
<span class="countdown__group__numbers__item__time text-blue fw-900 font-highlighted minutes" id="minutes"></span>
161161
<span class="countdown__group__numbers__item__description text-uppercase text-green fw-700">Minutos</span>
162162
</div>
163163

164164
<div class="countdown__group__numbers__item">
165-
<span class="countdown__group__numbers__item__time text-blue fw-900 font-highlighted" id="seconds"></span>
165+
<span class="countdown__group__numbers__item__time text-blue fw-900 font-highlighted seconds" id="seconds"></span>
166166
<span class="countdown__group__numbers__item__description text-uppercase text-green fw-700">Segundos</span>
167167
</div>
168168
</div>
@@ -243,7 +243,10 @@ <h4 class="footer__group__content__item__title fw-700 text-blue text-uppercase">
243243
</footer>
244244
</main>
245245

246-
<script src="{% static 'js/spp/countdown.min.js' %}"></script>
246+
<script src="{% static 'js/spp/countdown.js' %}"></script>
247+
<script>
248+
initCountDown(new Date('Aug 10, 2020 23:59:59').getTime());
249+
</script>
247250
{% endblock %}
248251
{% block extrabody %}{% endblock extrabody %}
249252
</body>

0 commit comments

Comments
 (0)