also use text query in inline search for Stylus category
This commit is contained in:
parent
0caf81fa46
commit
3cf7b1945a
|
@ -54,7 +54,7 @@ window.addEventListener('showStyles:done', () => {
|
||||||
href: URLS.usoArchive,
|
href: URLS.usoArchive,
|
||||||
onclick(event) {
|
onclick(event) {
|
||||||
if (!prefs.get('popup.findStylesInline') || dom.container) {
|
if (!prefs.get('popup.findStylesInline') || dom.container) {
|
||||||
this.search = `${new URLSearchParams({category, search: $('#search-query').value})}`;
|
this.search = new URLSearchParams({category, search: $('#search-query').value});
|
||||||
handleEvent.openURLandHide.call(this, event);
|
handleEvent.openURLandHide.call(this, event);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -83,6 +83,9 @@ window.addEventListener('showStyles:done', () => {
|
||||||
const n = Number(m[2]);
|
const n = Number(m[2]);
|
||||||
query.push(n >= 2000 && n <= thisYear ? n : m[1] || m[2]);
|
query.push(n >= 2000 && n <= thisYear ? n : m[1] || m[2]);
|
||||||
}
|
}
|
||||||
|
if (category === STYLUS_CATEGORY && !query.includes('stylus')) {
|
||||||
|
query.push('stylus');
|
||||||
|
}
|
||||||
ready = ready.then(start);
|
ready = ready.then(start);
|
||||||
};
|
};
|
||||||
$('#search-order').value = order;
|
$('#search-order').value = order;
|
||||||
|
@ -464,13 +467,18 @@ window.addEventListener('showStyles:done', () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
function isResultMatching(res) {
|
function isResultMatching(res) {
|
||||||
|
// We're trying to call calcHaystack only when needed, not on all 100K items
|
||||||
|
const {c} = res;
|
||||||
return (
|
return (
|
||||||
res.c === category ||
|
c === category ||
|
||||||
searchGlobals && res.c === 'global' && (query.length || calcHaystack(res)._nLC.includes(category))
|
category !== STYLUS_CATEGORY && (
|
||||||
|
searchGlobals &&
|
||||||
|
c === 'global' &&
|
||||||
|
(query.length || calcHaystack(res)._nLC.includes(category))
|
||||||
|
)
|
||||||
) && (
|
) && (
|
||||||
category === STYLUS_CATEGORY
|
!query.length || // to skip calling calcHaystack
|
||||||
? /\bStylus\b/.test(res.n)
|
query.every(isInHaystack, calcHaystack(res))
|
||||||
: !query.length || query.every(isInHaystack, calcHaystack(res))
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user