Commit d199f6a8 authored by David Planella's avatar David Planella

Re-add common countdown code after eslinter fixes

parent ce69075d
Pipeline #46526223 passed with stages
in 13 minutes and 28 seconds
......@@ -6,6 +6,7 @@ suppress_header: true
extra_css:
- contributing.css
extra_js:
- countdown.js
- hackathon.js
---
.wrapper
......@@ -246,4 +247,4 @@ extra_js:
%a{href: "https://about.gitlab.com/community/hackathon/past-events.html"} past GitLab Hackathon page
to learn more about previous Hackathon events.
\ No newline at end of file
......@@ -5,6 +5,7 @@ extra_css:
- concurrent-devops.css
- contribute.css
extra_js:
- countdown.js
- contribute.js
---
......
/* global setupCountdown */
function setupContributeCountdown() {
var nextSummitDate = new Date('May 8, 2019 08:00:00').getTime();
var x = setInterval(function() {
var now = new Date().getTime();
var distance = nextSummitDate - now;
var days = Math.floor(distance / (1000 * 60 * 60 * 24));
var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
var seconds = Math.floor((distance % (1000 * 60)) / 1000);
// Output the result in an element with id="demo"
document.getElementById('nextSummitCountdown').innerHTML = days + ' days ' + hours + ' hours '
+ minutes + ' minutes ' + seconds + ' seconds ';
// If the count down is over, write some text
if (distance < 0) {
clearInterval(x);
document.getElementById('nextSummitCountdown').innerHTML = 'Already happened!';
}
}, 1000);
setupCountdown(nextSummitDate, 'nextSummitCountdown');
}
function setupVideo() {
......@@ -52,4 +36,3 @@ function setupVideo() {
setupVideo();
setupContributeCountdown();
})();
/* eslint-disable no-unused-vars */
function setupCountdown(countDownDate, countdownElementId) {
var x = setInterval(function() {
var now = new Date().getTime();
var distance = countDownDate - now;
var days = Math.floor(distance / (1000 * 60 * 60 * 24));
var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
var seconds = Math.floor((distance % (1000 * 60)) / 1000);
// Output the result in an element with id="demo"
document.getElementById(countdownElementId).innerHTML = days + ' days ' + hours + ' hours '
+ minutes + ' minutes ' + seconds + ' seconds ';
// If the count down is over, write some text
if (distance < 0) {
clearInterval(x);
document.getElementById(countdownElementId).innerHTML = 'Already happened!';
}
}, 1000);
}
/* global setupCountdown */
function setupHackathonCountdown() {
var nextHackathonDate = new Date('February 12, 2019 08:00:00').getTime();
var x = setInterval(function() {
var now = new Date().getTime();
var distance = nextHackathonDate - now;
var days = Math.floor(distance / (1000 * 60 * 60 * 24));
var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
var seconds = Math.floor((distance % (1000 * 60)) / 1000);
// Output the result in an element with id="demo"
document.getElementById('nextHackathonCountdown').innerHTML = days + ' days ' + hours + ' hours '
+ minutes + ' minutes ' + seconds + ' seconds ';
// If the count down is over, write some text
if (distance < 0) {
clearInterval(x);
document.getElementById('nextHackathonCountdown').innerHTML = 'Already happened!';
}
}, 1000);
setupCountdown(nextHackathonDate, 'nextHackathonCountdown');
}
(function() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment