Révision 4eeb3b46
Ajouté par Assos Assos il y a presque 8 ans
drupal7/sites/all/themes/bootstrap/js/misc/autocomplete.js | ||
---|---|---|
94 | 94 |
}); |
95 | 95 |
for (var key in matches) { |
96 | 96 |
$('<li></li>') |
97 |
.html($('<a href="#"></a>').html(matches[key]).click(function (e) { e.preventDefault(); }))
|
|
98 |
.mousedown(function () { ac.select(this); })
|
|
99 |
.mouseover(function () { ac.highlight(this); })
|
|
100 |
.mouseout(function () { ac.unhighlight(this); })
|
|
97 |
.html($('<a href="#"></a>').html(matches[key]).on('click', function (e) { e.preventDefault(); }))
|
|
98 |
.on('mousedown', function () { ac.hidePopup(this); })
|
|
99 |
.on('mouseover', function () { ac.highlight(this); })
|
|
100 |
.on('mouseout', function () { ac.unhighlight(this); })
|
|
101 | 101 |
.data('autocompleteValue', key) |
102 | 102 |
.appendTo(ul); |
103 | 103 |
} |
... | ... | |
137 | 137 |
/** |
138 | 138 |
* Override the autocomplete constructor. |
139 | 139 |
*/ |
140 |
Drupal.jsAC = function ($input, db, $context) {
|
|
140 |
Drupal.jsAC = function ($input, db, context) { |
|
141 | 141 |
var ac = this; |
142 |
this.$context = $context; |
|
142 |
|
|
143 |
// Context is normally passed by Drupal.behaviors.autocomplete above. However, |
|
144 |
// if a module has manually invoked this method they will likely not know |
|
145 |
// about this feature and a global fallback context to document must be used. |
|
146 |
// @see https://www.drupal.org/node/2594243 |
|
147 |
// @see https://www.drupal.org/node/2315295 |
|
148 |
this.$context = context && $(context) || $(document); |
|
149 |
|
|
143 | 150 |
this.input = $input[0]; |
144 |
this.ariaLive = $context.find('#' + this.input.id + '-autocomplete-aria-live'); |
|
151 |
this.ariaLive = this.$context.find('#' + this.input.id + '-autocomplete-aria-live');
|
|
145 | 152 |
this.db = db; |
146 | 153 |
$input |
147 | 154 |
.keydown(function (event) { return ac.onkeydown(this, event); }) |
Formats disponibles : Unified diff
Weekly update of contrib modules