dialog.jquery-ui.js 884 B

123456789101112131415161718192021222324252627282930313233343536
  1. /**
  2. * @file
  3. * Adds default classes to buttons for styling purposes.
  4. */
  5. (function ($) {
  6. 'use strict';
  7. $.widget('ui.dialog', $.ui.dialog, {
  8. options: {
  9. buttonClass: 'button',
  10. buttonPrimaryClass: 'button--primary'
  11. },
  12. _createButtons: function () {
  13. var opts = this.options;
  14. var primaryIndex;
  15. var $buttons;
  16. var index;
  17. var il = opts.buttons.length;
  18. for (index = 0; index < il; index++) {
  19. if (opts.buttons[index].primary && opts.buttons[index].primary === true) {
  20. primaryIndex = index;
  21. delete opts.buttons[index].primary;
  22. break;
  23. }
  24. }
  25. this._super();
  26. $buttons = this.uiButtonSet.children().addClass(opts.buttonClass);
  27. if (typeof primaryIndex !== 'undefined') {
  28. $buttons.eq(index).addClass(opts.buttonPrimaryClass);
  29. }
  30. }
  31. });
  32. })(jQuery);