diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/LiveSearch.js b/typo3/sysext/backend/Resources/Public/JavaScript/LiveSearch.js index 1120d6f12edf364c81722af153575114d82b0d63..b5bc5cfd3e7a2e8fb4d368915ea56a60048a59ee 100644 --- a/typo3/sysext/backend/Resources/Public/JavaScript/LiveSearch.js +++ b/typo3/sysext/backend/Resources/Public/JavaScript/LiveSearch.js @@ -19,9 +19,10 @@ define([ 'jquery', 'TYPO3/CMS/Backend/Viewport', + 'TYPO3/CMS/Backend/Icons', 'jquery/autocomplete', 'TYPO3/CMS/Backend/jquery.clearable' -], function ($, Viewport) { +], function ($, Viewport, Icons) { 'use strict'; var containerSelector = '#typo3-cms-backend-backend-toolbaritems-livesearchtoolbaritem'; @@ -82,11 +83,25 @@ define([ + '</div>' + ''; }, + onSearchStart: function () { + if(!$(toolbarItem).hasClass('loading')) { + $(toolbarItem).addClass('loading'); + Icons.getIcon('spinner-circle-light', Icons.sizes.small, '', 'default', 'inline').done(function (markup) { + $(toolbarItem).find('.icon-apps-toolbar-menu-search').replaceWith(markup) + }); + } + }, onSearchComplete: function(query, suggestions) { if (!$(toolbarItem).hasClass('open') && $(searchFieldSelector).val().length > 1) { $(dropdownToggle).dropdown('toggle'); $(searchFieldSelector).focus(); } + if ($(toolbarItem).hasClass('loading')) { + $(toolbarItem).removeClass('loading'); + Icons.getIcon('apps-toolbar-menu-search', Icons.sizes.small, '', 'default', 'inline').done(function (markup) { + $(toolbarItem).find('.icon-spinner-circle-light').replaceWith(markup) + }); + } }, beforeRender: function(container) { // Unset height, width and z-index again, should be fixed by the plugin at a later point