imagecache_actions.jquery.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * UI enhancements for the imagecache edit form
  3. */
  4. (function($){
  5. /**
  6. * Check if independent corners are enabled and disable other fields in the UI
  7. */
  8. Drupal.canvasactions_roundedcorners_form_disable_fields = function () {
  9. // To get the right effect, we have to set the 'disabled' attribute on the
  10. // field, but set the class on the container item. Tedious.
  11. if (!$(":checkbox#edit-data-independent-corners-set-independent-corners").attr("checked")){
  12. $(".form-item-data-radius").removeClass("form-disabled");
  13. $(".form-item-data-radius input").attr("disabled", false);
  14. $("#independent-corners-set .form-item").addClass("form-disabled");
  15. $("#independent-corners-set input").attr("disabled", true);
  16. }
  17. else {
  18. $(".form-item-data-radius").addClass("form-disabled");
  19. $(".form-item-data-radius input").attr("disabled", true);
  20. $("#independent-corners-set .form-item").removeClass("form-disabled");
  21. $("#independent-corners-set input").attr("disabled", false);
  22. }
  23. }
  24. /**
  25. * Trigger the update when the form is ready, and add listener to the checkbox
  26. */
  27. Drupal.behaviors.canvasactions_roundedcorners = {
  28. attach: function (context, settings) {
  29. Drupal.canvasactions_roundedcorners_form_disable_fields();
  30. $(":checkbox#edit-data-independent-corners-set-independent-corners").change(
  31. function() {
  32. Drupal.canvasactions_roundedcorners_form_disable_fields();
  33. }
  34. );
  35. }
  36. }
  37. })(jQuery);