From 4d10750a86e0ae974b0bc9446b51eb1d377e2f12 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sun, 1 Jan 2012 19:37:32 +0100 Subject: [PATCH] WCF.Search now supports a minimum input length --- wcfsetup/install/files/js/WCF.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index faa07f813b..f10e9e1938 100644 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -3065,6 +3065,10 @@ WCF.Search.Base = Class.extend({ */ _callback: null, + /** + * class name + * @var string + */ _className: '', /** @@ -3084,6 +3088,12 @@ WCF.Search.Base = Class.extend({ * @var jQuery */ _searchInput: null, + + /** + * minimum search input length, MUST be 1 or higher + * @var integer + */ + _triggerLength: 1, /** * Initializes a new search. @@ -3115,7 +3125,7 @@ WCF.Search.Base = Class.extend({ if ($content === '') { this._clearList(true); } - else { + else if ($content.length >= this._triggerLength) { var $parameters = { data: { searchString: $content @@ -3129,6 +3139,10 @@ WCF.Search.Base = Class.extend({ }); this._proxy.sendRequest(); } + else { + // input below trigger length + this._clearList(false); + } }, /** -- 2.20.1