(key)
| 289 | |
| 290 | function createSearchHandler(type, searchItems) { |
| 291 | let settingsPages; |
| 292 | |
| 293 | return (key) => { |
| 294 | if (type === "united") { |
| 295 | const $items = []; |
| 296 | settingsPages ??= getSettingsPages(true); |
| 297 | settingsPages.forEach((page) => { |
| 298 | $items.push(...page.search(key)); |
| 299 | }); |
| 300 | return $items; |
| 301 | } |
| 302 | |
| 303 | return searchItems.filter((item) => { |
| 304 | const text = item.textContent.toLowerCase(); |
| 305 | return text.match(key, "i"); |
| 306 | }); |
| 307 | }; |
| 308 | } |
| 309 | |
| 310 | function getSettingsPages(includeLazyPages = false) { |