fix category check when searching for foo.bar.tld (#863)

This commit is contained in:
tophf 2020-02-22 15:37:22 +03:00 committed by GitHub
parent df8c258c84
commit c3b7657433
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -623,7 +623,7 @@ window.addEventListener('showStyles:done', function _() {
fourth ||
third && third !== 'www' && third !== 'm'
);
return (keepThird && `${third}.` || '') + main + (keepTld ? `.${tld}` : '');
return (keepThird && `${third}.` || '') + main + (keepTld || keepThird ? `.${tld}` : '');
}
}
@ -632,7 +632,7 @@ window.addEventListener('showStyles:done', function _() {
result.subcategory &&
!processedResults.some(pr => pr.id === result.id) &&
(category !== STYLUS_CATEGORY || /\bStylus\b/i.test(result.name + result.description)) &&
category.split('.')[0] === result.subcategory.split('.')[0]
category.split('.').includes(result.subcategory.split('.')[0])
);
}