From: Alexander Ebert Date: Fri, 1 Feb 2019 17:35:12 +0000 (+0100) Subject: Decrease ACP search frequency and ignore control characters X-Git-Tag: 5.2.0_Alpha_1~319 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=001740db3fed614204be7e950ddb95c4df1f0334;p=GitHub%2FWoltLab%2FWCF.git Decrease ACP search frequency and ignore control characters The search still yields quite a few requests, but this is fine considering that it is (a) limited to the admin panel and (b) having faster results is a worthy trade off. --- diff --git a/wcfsetup/install/files/acp/js/WCF.ACP.js b/wcfsetup/install/files/acp/js/WCF.ACP.js index 6e246add6d..d48e7c392b 100644 --- a/wcfsetup/install/files/acp/js/WCF.ACP.js +++ b/wcfsetup/install/files/acp/js/WCF.ACP.js @@ -1678,6 +1678,8 @@ WCF.ACP.Category.Collapsible = WCF.Collapsible.SimpleRemote.extend({ * @see WCF.Search.Base */ WCF.ACP.Search = WCF.Search.Base.extend({ + _delay: 250, + /** * name of the selected search provider * @var string diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index 66d6682d3b..c223d5f3cb 100755 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -4101,6 +4101,11 @@ WCF.Search.Base = Class.extend({ */ _itemIndex: -1, + /** + * @var string + */ + _lastValue: '', + /** * result list * @var jQuery @@ -4156,6 +4161,7 @@ WCF.Search.Base = Class.extend({ this._caretAt = -1; this._delay = 0; this._excludedSearchValues = []; + this._lastValue = ''; if (excludedSearchValues) { this._excludedSearchValues = excludedSearchValues; } @@ -4257,6 +4263,12 @@ WCF.Search.Base = Class.extend({ this._clearList(false); } else if ($content.length >= this._triggerLength) { + if (this._lastValue === $content) { + return; + } + + this._lastValue = $content; + var $parameters = { data: { excludedSearchValues: this._excludedSearchValues,