@@ -10,19 +10,23 @@ require([
10
10
'use strict' ;
11
11
12
12
$ ( function ( ) {
13
- const engineField = $ ( '#catalog_search_engine' ) ,
14
- commentContainer = $ ( '#row_catalog_search_engine p' ) ;
13
+ const engineField = $ ( '#catalog_search_engine' ) ;
14
+ const commentContainer = $ ( '#row_catalog_search_engine p' ) ;
15
15
16
- engineField . change ( ( ) => {
17
- const engineValue = engineField . val ( ) ;
18
- let commentText = $ . mage . __ ( 'If not specified, Default Search Engine will be used.' ) ;
16
+ const updateCommentText = ( ) => {
17
+ const engineValue = engineField . val ( ) ,
18
+ defaultText = $ . mage . __ ( 'If not specified, Default Search Engine will be used.' ) ,
19
+ unsupportedText = $ . mage . __ ( 'This search engine option is no longer supported by Adobe. ' +
20
+ 'It is recommended to use OpenSearch as a search engine instead.' ) ,
21
+ newCommentText = [ 'elasticsearch7' , 'elasticsearch8' ] . includes ( engineValue ) ?
22
+ unsupportedText : defaultText ;
19
23
20
- if ( [ 'elasticsearch7' , 'elasticsearch8' ] . includes ( engineValue ) ) {
21
- commentText = $ . mage . __ ( 'This search engine option is no longer supported by Adobe. ' +
22
- 'It is recommended to use OpenSearch as a search engine instead.' ) ;
24
+ if ( commentContainer . text ( ) !== newCommentText ) {
25
+ commentContainer . text ( newCommentText ) ;
23
26
}
27
+ } ;
24
28
25
- commentContainer . text ( commentText ) ;
26
- } ) ;
29
+ engineField . change ( updateCommentText ) ;
30
+ updateCommentText ( ) ;
27
31
} ) ;
28
32
} ) ;
0 commit comments