Révision caf16a48
Ajouté par Assos Assos il y a presque 9 ans
drupal7/sites/all/themes/bootstrap/js/misc/ajax.js | ||
---|---|---|
33 | 33 |
} |
34 | 34 |
} |
35 | 35 |
|
36 |
var $element = $(this.element); |
|
37 |
|
|
36 | 38 |
// Disable the element that received the change to prevent user interface |
37 | 39 |
// interaction while the Ajax request is in progress. ajax.ajaxing prevents |
38 | 40 |
// the element from triggering a new request, but does not prevent the user |
39 | 41 |
// from changing its value. |
40 |
$(this.element).addClass('progress-disabled').attr('disabled', true);
|
|
42 |
$element.addClass('progress-disabled').attr('disabled', true);
|
|
41 | 43 |
|
42 | 44 |
// Insert progressbar or throbber. |
43 | 45 |
if (this.progress.type == 'bar') { |
... | ... | |
46 | 48 |
progressBar.setProgress(-1, this.progress.message); |
47 | 49 |
} |
48 | 50 |
if (this.progress.url) { |
49 |
progressBar.startMonitoring(this.progress.url, this.progress.interval || 1500);
|
|
51 |
progressBar.startMonitoring(this.progress.url, this.progress.interval || 500); |
|
50 | 52 |
} |
51 | 53 |
this.progress.element = $(progressBar.element).addClass('ajax-progress ajax-progress-bar'); |
52 | 54 |
this.progress.object = progressBar; |
53 |
$(this.element).after(this.progress.element);
|
|
55 |
$element.closest('.file-widget,.form-item').after(this.progress.element);
|
|
54 | 56 |
} |
55 | 57 |
else if (this.progress.type == 'throbber') { |
56 | 58 |
this.progress.element = $('<div class="ajax-progress ajax-progress-throbber"><i class="glyphicon glyphicon-refresh glyphicon-spin"></i></div>'); |
59 |
if (this.progress.message) { |
|
60 |
$('.throbber', this.progress.element).after('<div class="message">' + this.progress.message + '</div>'); |
|
61 |
} |
|
62 |
|
|
57 | 63 |
// If element is an input type, append after. |
58 |
if ($(this.element).is('input')) { |
|
59 |
if (this.progress.message) { |
|
60 |
$('.throbber', this.progress.element).after('<div class="message">' + this.progress.message + '</div>'); |
|
64 |
if ($element.is('input')) { |
|
65 |
$element.after(this.progress.element); |
|
66 |
} |
|
67 |
else if ($element.is('select')) { |
|
68 |
var $inputGroup = $element.closest('.form-item').find('.input-group-addon, .input-group-btn'); |
|
69 |
if (!$inputGroup.length) { |
|
70 |
$element.wrap('<div class="input-group">'); |
|
71 |
$inputGroup = $('<span class="input-group-addon">'); |
|
72 |
$element.after($inputGroup); |
|
61 | 73 |
} |
62 |
$(this.element).after(this.progress.element);
|
|
74 |
$inputGroup.append(this.progress.element);
|
|
63 | 75 |
} |
64 |
// Otherwise inject it inside the element.
|
|
76 |
// Otherwise append the throbber inside the element.
|
|
65 | 77 |
else { |
66 |
if (this.progress.message) { |
|
67 |
$('.throbber', this.progress.element).append('<div class="message">' + this.progress.message + '</div>'); |
|
68 |
} |
|
69 |
$(this.element).append(this.progress.element); |
|
78 |
$element.append(this.progress.element); |
|
70 | 79 |
} |
71 | 80 |
} |
72 | 81 |
}; |
Formats disponibles : Unified diff
Weekly update of contrib modules