Sha256: 5c4908cd408b6fe418cadc4fb1ec1dd1f10a099d0b5db8c515b6c6b76fc54474

Contents?: true

Size: 808 Bytes

Versions: 4

Compression:

Stored size: 808 Bytes

Contents

$(document).ready(function() {
  setInterval(updateCheckoutTimes, 1000);
});

function updateCheckoutTimes() {
  var checkoutRemainings = $(".checkout-in")
  if (checkoutRemainings.length > 0) {
    $.each(checkoutRemainings, updateCheckoutTime);
  }
}

function updateCheckoutTime(_, element) {
  var $element = $(element);
  var currentDatetime = new Date();
  var dateTime = $element.data("auction-checkout-deadline");
  if (currentDatetime > dateTime) {
    var pretext = $($element.siblings()[0]);
    pretext.addClass("green");
    pretext.html("Complete");
    $element.remove();
  } else {
    var countdownString = countdown(
      dateTime,
      null,
      countdown.DAYS|countdown.HOURS|countdown.MINUTES|countdown.SECONDS,
      2
    ).toString();
  }
  element.innerHTML = countdownString;
}

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
solidus_auction-0.0.6 app/assets/javascripts/spree/checkout_in.js
solidus_auction-0.0.5 app/assets/javascripts/spree/checkout_in.js
solidus_auction-0.0.4 app/assets/javascripts/spree/checkout_in.js
solidus_auction-0.0.3 app/assets/javascripts/spree/checkout_in.js