uc_cart.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. /**
  2. * @file
  3. * Adds effects and behaviors to elements on the checkout page.
  4. */
  5. Drupal.behaviors.ucCart = {
  6. attach: function(context, settings) {
  7. // Add a throbber to the submit order button on the review order form.
  8. jQuery('form#uc-cart-checkout-review-form input#edit-submit:not(.ucSubmitOrderThrobber-processed)', context).addClass('ucSubmitOrderThrobber-processed').click(function() {
  9. jQuery(this).clone().insertAfter(this).after('<span class="ubercart-throbber">&nbsp;&nbsp;&nbsp;&nbsp;</span>')[0].disabled = true;
  10. jQuery(this).hide();
  11. jQuery('#uc-cart-checkout-review-form #edit-back')[0].disabled = true;
  12. });
  13. }
  14. }
  15. /**
  16. * Behaviors for the Next buttons.
  17. *
  18. * When a customer clicks a Next button, expand the next pane, remove the
  19. * button, and don't let it collapse again.
  20. */
  21. function uc_cart_next_button_click(button, pane_id, current) {
  22. if (current !== 'false') {
  23. jQuery('#' + current + '-pane legend a').click();
  24. }
  25. else {
  26. button.disabled = true;
  27. }
  28. if (jQuery('#' + pane_id + '-pane').attr('class').indexOf('collapsed') > -1 && jQuery('#' + pane_id + '-pane').html() !== null) {
  29. jQuery('#' + pane_id + '-pane legend a').click();
  30. }
  31. return false;
  32. }