@@ -1296,6 +1296,7 @@ export class Display extends EventDispatcher {
1296
1296
async _setContentTermsOrKanji ( type , urlSearchParams , token ) {
1297
1297
const lookup = ( urlSearchParams . get ( 'lookup' ) !== 'false' ) ;
1298
1298
const wildcardsEnabled = ( urlSearchParams . get ( 'wildcards' ) !== 'off' ) ;
1299
+ const hasEnabledDictionaries = this . _options ? this . _options . dictionaries . some ( ( { enabled} ) => enabled ) : false ;
1299
1300
1300
1301
// Set query
1301
1302
let query = urlSearchParams . get ( 'query' ) ;
@@ -1331,7 +1332,7 @@ export class Display extends EventDispatcher {
1331
1332
1332
1333
let { dictionaryEntries} = content ;
1333
1334
if ( ! Array . isArray ( dictionaryEntries ) ) {
1334
- dictionaryEntries = lookup && query . length > 0 ? await this . _findDictionaryEntries ( type === 'kanji' , query , wildcardsEnabled , optionsContext ) : [ ] ;
1335
+ dictionaryEntries = hasEnabledDictionaries && lookup && query . length > 0 ? await this . _findDictionaryEntries ( type === 'kanji' , query , wildcardsEnabled , optionsContext ) : [ ] ;
1335
1336
if ( this . _setContentToken !== token ) { return ; }
1336
1337
content . dictionaryEntries = dictionaryEntries ;
1337
1338
changeHistory = true ;
@@ -1367,7 +1368,8 @@ export class Display extends EventDispatcher {
1367
1368
this . _dictionaryEntries = dictionaryEntries ;
1368
1369
1369
1370
this . _updateNavigationAuto ( ) ;
1370
- this . _setNoContentVisible ( dictionaryEntries . length === 0 && lookup ) ;
1371
+ this . _setNoContentVisible ( hasEnabledDictionaries && dictionaryEntries . length === 0 && lookup ) ;
1372
+ this . _setNoDictionariesVisible ( ! hasEnabledDictionaries ) ;
1371
1373
1372
1374
const container = this . _container ;
1373
1375
container . textContent = '' ;
@@ -1424,6 +1426,7 @@ export class Display extends EventDispatcher {
1424
1426
1425
1427
this . _updateNavigation ( false , false ) ;
1426
1428
this . _setNoContentVisible ( false ) ;
1429
+ this . _setNoDictionariesVisible ( false ) ;
1427
1430
this . _setQuery ( '' , '' , 0 ) ;
1428
1431
1429
1432
this . _triggerContentUpdateStart ( ) ;
@@ -1452,6 +1455,18 @@ export class Display extends EventDispatcher {
1452
1455
}
1453
1456
}
1454
1457
1458
+ /**
1459
+ * @param {boolean } visible
1460
+ */
1461
+ _setNoDictionariesVisible ( visible ) {
1462
+ /** @type {?HTMLElement } */
1463
+ const noDictionaries = document . querySelector ( '#no-dictionaries' ) ;
1464
+
1465
+ if ( noDictionaries !== null ) {
1466
+ noDictionaries . hidden = ! visible ;
1467
+ }
1468
+ }
1469
+
1455
1470
/**
1456
1471
* @param {string } query
1457
1472
* @param {string } fullQuery
0 commit comments