From: Alexander Ebert Date: Tue, 5 Sep 2017 12:09:29 +0000 (+0200) Subject: Reset FontAweosme search filter on show X-Git-Tag: 3.1.0_Alpha_3~16 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=03919854ce5dc2f2d49c892dbd9dc9523717aa11;p=GitHub%2FWoltLab%2FWCF.git Reset FontAweosme search filter on show Fixes #2396 --- diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/ItemList/Filter.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/ItemList/Filter.js index 8c717fe229..42a7de9a28 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/ItemList/Filter.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/ItemList/Filter.js @@ -78,8 +78,7 @@ define(['Core', 'EventKey', 'Language', 'List', 'StringUtil', 'Dom/Util'], funct clearButton.addEventListener('click', (function(event) { event.preventDefault(); - this._input.value = ''; - this._keyup(); + this.reset(); }).bind(this)); inputAddon.appendChild(input); @@ -94,6 +93,14 @@ define(['Core', 'EventKey', 'Language', 'List', 'StringUtil', 'Dom/Util'], funct this._fragment = null; }, + /** + * Resets the filter. + */ + reset: function () { + this._input.value = ''; + this._keyup(); + }, + /** * Builds the item list and rebuilds the items' DOM for easier manipulation. * diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Style/FontAwesome.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Style/FontAwesome.js index bb18f8aca1..e77213bb8c 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Style/FontAwesome.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Style/FontAwesome.js @@ -20,7 +20,7 @@ define(['Language', 'Ui/Dialog', 'WoltLabSuite/Core/Ui/ItemList/Filter'], functi return Fake; } - var _callback, _iconList; + var _callback, _iconList, _itemListFilter; var _icons = []; /** @@ -88,7 +88,7 @@ define(['Language', 'Ui/Dialog', 'WoltLabSuite/Core/Ui/ItemList/Filter'], functi _iconList.innerHTML = html; _iconList.addEventListener(WCF_CLICK_EVENT, this._click.bind(this)); - new UiItemListFilter('fontAwesomeIcons', { + _itemListFilter = new UiItemListFilter('fontAwesomeIcons', { callbackPrepareItem: function (item) { var small = elBySel('small', item); var text = small.textContent.trim(); @@ -101,6 +101,9 @@ define(['Language', 'Ui/Dialog', 'WoltLabSuite/Core/Ui/ItemList/Filter'], functi } }); }).bind(this), + onShow: function () { + _itemListFilter.reset(); + }, title: Language.get('wcf.global.fontAwesome.selectIcon') }, source: ''