
| Current Path : /var/www/html/wirtschaftsclub.web-klick.de/themes/bootstrap/js/misc/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html/wirtschaftsclub.web-klick.de/themes/bootstrap/js/misc/dialog.ajax.js |
/**
* @file
* dialog.ajax.js
*/
(function ($, Drupal, Bootstrap) {
Drupal.behaviors.dialog.ajaxCurrentButton = null;
Drupal.behaviors.dialog.ajaxOriginalButton = null;
/**
* Synchronizes a faux button with its original counterpart.
*
* @param {Boolean} [reset = false]
* Whether to reset the current and original buttons after synchronizing.
*/
Drupal.behaviors.dialog.ajaxUpdateButtons = function (reset) {
if (this.ajaxCurrentButton && this.ajaxOriginalButton) {
this.ajaxCurrentButton.html(this.ajaxOriginalButton.html());
this.ajaxCurrentButton.prop('disabled', this.ajaxOriginalButton.prop('disabled'));
}
if (reset) {
this.ajaxCurrentButton = null;
this.ajaxOriginalButton = null;
}
};
$(document)
.ajaxSend(function () {
Drupal.behaviors.dialog.ajaxUpdateButtons();
})
.ajaxComplete(function () {
Drupal.behaviors.dialog.ajaxUpdateButtons(true);
})
;
/**
* {@inheritdoc}
*/
Drupal.behaviors.dialog.prepareDialogButtons = function prepareDialogButtons($dialog) {
var _that = this;
var buttons = [];
var $buttons = $dialog.find('.form-actions').find('button, input[type=submit], .form-actions a.button');
$buttons.each(function () {
var $originalButton = $(this)
// Prevent original button from being tabbed to.
.attr('tabindex', -1)
// Visually make the original button invisible, but don't actually hide
// or remove it from the DOM because the click needs to be proxied from
// the faux button created in the footer to its original counterpart.
.css({
display: 'block',
width: 0,
height: 0,
padding: 0,
border: 0,
overflow: 'hidden'
});
buttons.push({
// Strip all HTML from the actual text value. This value is escaped.
// It actual HTML value will be synced with the original button's HTML
// below in the "create" method.
text: Bootstrap.stripHtml($originalButton),
class: $originalButton.attr('class').replace('use-ajax-submit', ''),
click: function click(e) {
e.preventDefault();
e.stopPropagation();
_that.ajaxCurrentButton = $(e.target);
_that.ajaxOriginalButton = $originalButton;
Bootstrap.simulate($originalButton, 'click');
},
create: function () {
_that.ajaxCurrentButton = $(this);
_that.ajaxOriginalButton = $originalButton;
_that.ajaxUpdateButtons(true);
}
});
});
return buttons;
};
})(window.jQuery, window.Drupal, window.Drupal.bootstrap);