From 3e597f7d1da6d165fd44ccc89521e0ab6887df45 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Mon, 3 Feb 2014 00:12:09 +0100 Subject: [PATCH] Auto-complete location input rather than discarding input Additionally replaced some magic numbers with $.ui.keyCode constants --- wcfsetup/install/files/js/WCF.Location.js | 12 ++++++------ wcfsetup/install/files/js/WCF.js | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/wcfsetup/install/files/js/WCF.Location.js b/wcfsetup/install/files/js/WCF.Location.js index 68cc059393..c8ca727bfd 100644 --- a/wcfsetup/install/files/js/WCF.Location.js +++ b/wcfsetup/install/files/js/WCF.Location.js @@ -375,22 +375,22 @@ WCF.Location.GoogleMaps.LocationSearch = WCF.Search.Base.extend({ _keyUp: function(event) { // handle arrow keys and return key switch (event.which) { - case 37: // arrow-left - case 39: // arrow-right + case $.ui.keyCode.LEFT: + case $.ui.keyCode.RIGHT: return; break; - case 38: // arrow up + case $.ui.keyCode.UP: this._selectPreviousItem(); return; break; - case 40: // arrow down + case $.ui.keyCode.DOWN: this._selectNextItem(); return; break; - case 13: // return key + case $.ui.keyCode.ENTER: return this._selectElement(event); break; } @@ -529,7 +529,7 @@ WCF.Location.GoogleMaps.LocationInput = Class.extend({ this._marker.setPosition(data.location); WCF.Location.GoogleMaps.Util.focusMarker(this._marker); - $(this._searchInput).val(''); + $(this._searchInput).val(data.label); } }); diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index bd7107723c..0d989cfa8d 100755 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -5619,8 +5619,8 @@ WCF.Search.Base = Class.extend({ var $searchString = $.trim(this._searchInput.val()); if (this._commaSeperated) { var $keyCode = event.keyCode || event.which; - if ($keyCode == 188) { - // ignore event if char is 188 = , + if ($keyCode == $.ui.keyCode.COMMA) { + // ignore event if char is ',' return ''; } -- 2.20.1