autocomplete select event patch
Signed-off-by: bachy <git@g-u-i.net>
This commit is contained in:
parent
4f6a8d389b
commit
3a3a620cac
30
ac_select_event-365241-54.patch
Normal file
30
ac_select_event-365241-54.patch
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
diff --git a/misc/autocomplete.js b/misc/autocomplete.js
|
||||||
|
index 8f7ac60..5679081 100644
|
||||||
|
--- a/misc/autocomplete.js
|
||||||
|
+++ b/misc/autocomplete.js
|
||||||
|
@@ -114,6 +114,7 @@ Drupal.jsAC.prototype.onkeyup = function (input, e) {
|
||||||
|
*/
|
||||||
|
Drupal.jsAC.prototype.select = function (node) {
|
||||||
|
this.input.value = $(node).data('autocompleteValue');
|
||||||
|
+ $(this.input).trigger('autocompleteSelect', [node]);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
@@ -167,7 +168,7 @@ Drupal.jsAC.prototype.unhighlight = function (node) {
|
||||||
|
Drupal.jsAC.prototype.hidePopup = function (keycode) {
|
||||||
|
// Select item if the right key or mousebutton was pressed.
|
||||||
|
if (this.selected && ((keycode && keycode != 46 && keycode != 8 && keycode != 27) || !keycode)) {
|
||||||
|
- this.input.value = $(this.selected).data('autocompleteValue');
|
||||||
|
+ this.select(this.selected);
|
||||||
|
}
|
||||||
|
// Hide popup.
|
||||||
|
var popup = this.popup;
|
||||||
|
@@ -220,7 +221,7 @@ Drupal.jsAC.prototype.found = function (matches) {
|
||||||
|
for (key in matches) {
|
||||||
|
$('<li></li>')
|
||||||
|
.html($('<div></div>').html(matches[key]))
|
||||||
|
- .mousedown(function () { ac.select(this); })
|
||||||
|
+ .mousedown(function () { ac.hidePopup(this); })
|
||||||
|
.mouseover(function () { ac.highlight(this); })
|
||||||
|
.mouseout(function () { ac.unhighlight(this); })
|
||||||
|
.data('autocompleteValue', key)
|
@ -114,6 +114,7 @@ Drupal.jsAC.prototype.onkeyup = function (input, e) {
|
|||||||
*/
|
*/
|
||||||
Drupal.jsAC.prototype.select = function (node) {
|
Drupal.jsAC.prototype.select = function (node) {
|
||||||
this.input.value = $(node).data('autocompleteValue');
|
this.input.value = $(node).data('autocompleteValue');
|
||||||
|
$(this.input).trigger('autocompleteSelect', [node]);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -167,7 +168,7 @@ Drupal.jsAC.prototype.unhighlight = function (node) {
|
|||||||
Drupal.jsAC.prototype.hidePopup = function (keycode) {
|
Drupal.jsAC.prototype.hidePopup = function (keycode) {
|
||||||
// Select item if the right key or mousebutton was pressed.
|
// Select item if the right key or mousebutton was pressed.
|
||||||
if (this.selected && ((keycode && keycode != 46 && keycode != 8 && keycode != 27) || !keycode)) {
|
if (this.selected && ((keycode && keycode != 46 && keycode != 8 && keycode != 27) || !keycode)) {
|
||||||
this.input.value = $(this.selected).data('autocompleteValue');
|
this.select(this.selected);
|
||||||
}
|
}
|
||||||
// Hide popup.
|
// Hide popup.
|
||||||
var popup = this.popup;
|
var popup = this.popup;
|
||||||
@ -220,7 +221,7 @@ Drupal.jsAC.prototype.found = function (matches) {
|
|||||||
for (key in matches) {
|
for (key in matches) {
|
||||||
$('<li></li>')
|
$('<li></li>')
|
||||||
.html($('<div></div>').html(matches[key]))
|
.html($('<div></div>').html(matches[key]))
|
||||||
.mousedown(function () { ac.select(this); })
|
.mousedown(function () { ac.hidePopup(this); })
|
||||||
.mouseover(function () { ac.highlight(this); })
|
.mouseover(function () { ac.highlight(this); })
|
||||||
.mouseout(function () { ac.unhighlight(this); })
|
.mouseout(function () { ac.unhighlight(this); })
|
||||||
.data('autocompleteValue', key)
|
.data('autocompleteValue', key)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user