Hi,

Currently, the "active countdown" does not work in the D7 dev version. To fix it, some changes are necessary in the JavaScript code. I attach a working version.

Comments

finngruwier’s picture

StatusFileSize
new6.58 KB

It seems that the file was not attached...here it comes (hopefully).

neurosis’s picture

Worked for me thanks!

nohup’s picture

finngruwier, please submit a patch file.

IKE0088’s picture

Not working for me.

neurosis’s picture

IKE0088
did you save the file, remove the .txt suffix and place it in your uc_auction folder?

IKE0088’s picture

I did.

denes.szabo’s picture

Status: Active » Needs review
StatusFileSize
new6.81 KB
new13.31 KB

I had a same problem as you. At last I could fix the whole js, now it seems work to me.
I reworked the whole file, fixed the coding standard problems and amended the code according to the Drupal7 js requirements.

I attached the patch against the 7.x-1.x-dev and the added the whole amended js file too (you need remove the _.txt from the file name when try it).

stefanlemmen’s picture

I tested it. The counter is working in full page display, but not in teaser display.

denes.szabo’s picture

@stefanlemmen Did you try the patch and js I attached to the #7?

chefnelone’s picture

@Denes.Szabo. Your js file worked for me. But there is some problem with the "formatted time interval. * @param langcode".

I have a multilingual site and in Spanish language it still shows the time in english: hours, min, secs. It should be horas, mins, and seg

If I revert to the original js file I get the time in the correct language.

The path didn't work for me, I get this error:

git apply -v auction_timer-1421876-7.patch
Checking patch uc_auction.js...
error: while searching for:
 * @ingroup uc_auction
 */

/**
 * Start the auction countdown timer and dictate what should happen on each
 * "tick."
 */
Drupal.behaviors.ucAuction = function(context) {
  if (!$('body').hasClass('ucAuction-processed')) {
    // Declare an array of time units, for use by the formatInterval() function.
    // We're not going to declare it inside of formatInterval() because it only
    // needs to be declared once.
  
    // Convert the expiry time, which is using seconds, into milliseconds.
    Drupal.settings.ucAuction.expiry *= 1000;
  
    if (Drupal.settings.ucAuction.doCountdown) {
      // everyTime() and stopTime() are part of jQuery Timers, declared in
      // uc_auction.timers.js
      $('.uc-auction-expiry').everyTime(1000, 'countdown', function(i) {
        // Note that we're not going to assume 1000 milliseconds have passed
        // since the last tick; instead we'll get the current timestamp and work
        // with the difference between it and the expiry timestamp. This is
        // because the 1000 millisecond interval is *not* guaranteed; if the
        // browser hangs for a moment, it may be longer. WebKit seems to aim for
        // at least 1000 ms each tick, but sometimes goes over; Mozilla seems to
        // aim for an average of 1000 ms each tick, using less time on the next
        // tick if the previous tick took more time.
        // Note that this will be inaccurate for people whose computer's clock
        // is not set correctly. (And in cases when the *server's* clock is not
        // set correctly, it'll be inaccurate for everyone.) Given that all
        // operating systems worth counting can synchronize their time to a NTP
        // server, this will hopefully rarely be an issue.
        var that = $(this),
          now = new Date(),
          // Adjust for time zonage too.
          delta = Drupal.settings.ucAuction.expiry - now.getTime() + (now.getTimezoneOffset() * 60000);
        if (delta <= 0) {
          // The auction has expired.
          that.text(Drupal.t('expired')).stopTime('countdown');
        }
        else {
          // formatInterval() is declared below
          that.text(Drupal.formatInterval(Math.floor(delta / 1000), Drupal.settings.ucAuction.timeGran));
          if (delta < 60000 && !that.hasClass('uc-auction-expiry-min')) {
            // This minute
            that.removeClass('uc-auction-expiry-day').removeClass('uc-auction-expiry-hour').addClass('uc-auction-expiry-min');
          }
          else if (delta < 3600000 && !that.hasClass('uc-auction-expiry-hour')) {
            // This hour
            that.removeClass('uc-auction-expiry-day').addClass('uc-auction-expiry-hour');
          }
          else if (delta < 86400000 && !that.hasClass('uc-auction-expiry-day')) {
            // In 24 hours
            that.addClass('uc-auction-expiry-day');
          }
        }
      });
    }
    // When the bid form is submitted, let's do some client-side verification
    // (don't worry, we're checking things server-side too).
    $('#uc-auction-bid-table-form').submit(function() {
      // The below is analogous to _uc_auction_uncurrency().
      var bidVal = Number($('#edit-user-bid').val().replace(Drupal.settings.ucAuction.currencyThou, '').replace(Drupal.settings.ucAuction.currencyDec, '.').replace(/[^\d\.\-]/g, ''));
      // Is the bid value below the minimum bid value?
      if (bidVal < Drupal.settings.ucAuction.minBid) {
        alert(Drupal.t('The current minimum bid value is @val.', {'@val': Drupal.settings.ucAuction.minBidF}));
        $('#edit-user-bid').val(Drupal.settings.ucAuction.minBidFNoSign).addClass('error').focus();
        return false;
      }
      // Is the bid value above the maximum bid value? (Ignore this if the
      // minimum bid value is greater than the maximum bid value.)
      else if (Drupal.settings.ucAuction.maxBid > Drupal.settings.ucAuction.minBid && bidVal > Drupal.settings.ucAuction.maxBid) {
        alert(Drupal.t('The current maximum bid value is @val.', {'@val': Drupal.settings.ucAuction.
error: patch failed: uc_auction.js:7
error: uc_auction.js: patch does not apply
denes.szabo’s picture

I have a solution for the localization problem. I will collect my thoughts and upload the new version.

Do not mention, as I see this js you wanted to patch is not the same js file I worked on :)

chefnelone’s picture

Thanks, I'll be tuned.

denes.szabo’s picture

StatusFileSize
new7.25 KB

I attached the latest js version. It works to us in not English (Hungarian actually) site.
Just rename .js_.txt to .js, copy to the uc_auction directory, overwrite the old file, then clear the caches.
Pleas, try it then tell us about your test results.

chefnelone’s picture

I'll try it tomorrow.

chefnelone’s picture

@Denes.Szabo It works fine. Thanks for sharing!

chefnelone’s picture

I have the same problem again. The countdown clock is not working. You can take a look directly in the production site:
Any help please.

My mistake.... it's working fine.

denes.szabo’s picture

Me too. It seems fine.

doppel’s picture

How about for views?