From 046e1292f0234347d6d483305f028244245f4d07 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Tue, 20 Dec 2011 19:08:49 +0100 Subject: [PATCH] Implemented quick search (replaces Suggestions) --- wcfsetup/install/files/js/WCF.js | 144 +++++++++++++++++++++++++++++++ 1 file changed, 144 insertions(+) diff --git a/wcfsetup/install/files/js/WCF.js b/wcfsetup/install/files/js/WCF.js index c10f04c126..a9e9ea9b02 100644 --- a/wcfsetup/install/files/js/WCF.js +++ b/wcfsetup/install/files/js/WCF.js @@ -3026,6 +3026,150 @@ WCF.DOMNodeInsertedHandler = { } }; +/** + * Namespace for search related classes. + */ +WCF.Search = {}; + +/** + * Performs a quick search for users and user groups. + */ +WCF.Search.User = Class.extend({ + /** + * notification callback + * @var object + */ + _callback: null, + + /** + * include user groups in search + * @var boolean + */ + _includeUserGroups: false, + + /** + * result list + * @var jQuery + */ + _list: null, + + /** + * action proxy + * @var WCF.Action.Proxy + */ + _proxy: null, + + /** + * search input field + * @var jQuery + */ + _searchInput: null, + + /** + * Initializes a new search. + * + * @param jQuery searchInput + * @param object callback + * @param boolean includeUserGroups + */ + init: function(searchInput, callback, includeUserGroups) { + if (!$.isFunction(callback)) { + console.debug("[WCF.Search.User] Given callback is invalid, aborting."); + return; + } + + this._callback = callback; + this._includeUserGroups = includeUserGroups; + this._searchInput = $(searchInput).keyup($.proxy(this._keyUp, this)); + this._searchInput.wrap('
'); + this._list = $('