diff --git a/.eslintrc.cjs b/.eslintrc.cjs index fbe278a2..f3a2c0c5 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -24,6 +24,7 @@ module.exports = { }, plugins: ["react", "@typescript-eslint", "prettier"], rules: { + "no-restricted-syntax": "off", "react/jsx-filename-extension": [1, { extensions: [".tsx"] }], "no-unused-expressions": ["error", { allowShortCircuit: true }], "react/jsx-props-no-spreading": "off", diff --git a/src/manifest.json b/src/manifest.json index a55f0085..96d8403f 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "name": "ScriptCat", - "version": "0.16.0.1010", + "version": "0.16.1", "author": "CodFrm", "description": "脚本猫,一个用户脚本管理器,支持后台脚本、定时脚本、页面脚本,可编写脚本每天帮你自动处理事务.", "options_ui": { diff --git a/src/pages/options/routes/ScriptList.tsx b/src/pages/options/routes/ScriptList.tsx index 43dd3fae..fe71c852 100644 --- a/src/pages/options/routes/ScriptList.tsx +++ b/src/pages/options/routes/ScriptList.tsx @@ -202,11 +202,22 @@ function ScriptList() { ); }, - onFilter: (value, row) => - value - ? row.name.indexOf(value) !== -1 || - i18nName(row).indexOf(value) !== -1 - : true, + onFilter: (value: string, row) => { + if (!value) { + return true; + } + value = value.toLocaleLowerCase(); + row.name = row.name.toLocaleLowerCase(); + const i18n = i18nName(row).toLocaleLowerCase(); + // 空格分开关键字搜索 + const keys = value.split(" "); + for (const key of keys) { + if (row.name.includes(key) || i18n.includes(key)) { + return true; + } + } + return false; + }, onFilterDropdownVisibleChange: (visible) => { if (visible) { setTimeout(() => inputRef.current!.focus(), 150); diff --git a/src/runtime/background/runtime.ts b/src/runtime/background/runtime.ts index ba5c3e16..90fafe61 100644 --- a/src/runtime/background/runtime.ts +++ b/src/runtime/background/runtime.ts @@ -419,7 +419,7 @@ export default class Runtime extends Manager { addRunScript(sender.tabId!, script, false); return script.status !== SCRIPT_STATUS_ENABLE; } - ); + ).sort((a, b) => a.sort - b.sort); if (!filter.length) { resolve({ scripts: [] });