Sha256: b52dc9ac3e6044a2fbbf8af07d5f60ab1f3ea8ad066a8bf80e90515d9909fcac
Contents?: true
Size: 868 Bytes
Versions: 5
Compression:
Stored size: 868 Bytes
Contents
$(document).ready(function() { setInterval(updateStartTimes, 1000); }); function updateStartTimes() { var timeRemainings = $(".starts-in") if (timeRemainings.length > 0) { $.each(timeRemainings, updateStartTime); } } function updateStartTime(_, element) { var $element = $(element); var currentDatetime = new Date(); var dateTime = $element.data("auction-starting-datetime"); if (currentDatetime > dateTime) { $element.removeClass("starts-in"); $element.removeClass("green"); $element.addClass("ends-in"); $element.addClass("red"); var pretext = $element.siblings()[0]; pretext.innerHTML = "Ends in"; } else { var countdownString = countdown( dateTime, null, countdown.DAYS|countdown.HOURS|countdown.MINUTES|countdown.SECONDS, 2 ).toString(); } element.innerHTML = countdownString; }
Version data entries
5 entries across 5 versions & 1 rubygems