summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorDavid Rothstein <drothstein@gmail.com>2015-03-30 01:57:28 -0400
committerDavid Rothstein <drothstein@gmail.com>2015-03-30 01:57:28 -0400
commitf56b706c3d3c9e774740f16ab8572d4fa538fa73 (patch)
tree03bd409b65e52ea4b31f3ec4146713d4d2fcbe6b /misc
parent44b538695d561d34238c68b487604df1b6474de0 (diff)
downloadbrdo-f56b706c3d3c9e774740f16ab8572d4fa538fa73.tar.gz
brdo-f56b706c3d3c9e774740f16ab8572d4fa538fa73.tar.bz2
Issue #365241 by bcn, paulmarbach, xjm, chuckdeal97, skruf: Add select event to autocomplete feature
Diffstat (limited to 'misc')
-rw-r--r--misc/autocomplete.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/misc/autocomplete.js b/misc/autocomplete.js
index 8f7ac6011..567908170 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)