Skip to content

Commit

Permalink
Merge pull request #1 from atomiechen/dev
Browse files Browse the repository at this point in the history
Bump to version 1.0.1
  • Loading branch information
atomiechen authored Jun 7, 2022
2 parents b4956e9 + facd46e commit cf17dad
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 12 deletions.
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@

支持的具体功能如下:

- 针对任意文本(无论是否有分隔符),对照单个或多个名单查找缺失的名字,并可同时查看此时正在使用的全名单
- 针对任意文本(无论名字间是否有分隔符),对照单个或多个名单查找缺失的名字,并可同时查看此时正在使用的全名单
- 可以直接在插件内输入文本
- 👍可以选中任意文本(甚至excel表格),然后通过utools快捷面板一键呼出“查找漏网之鱼”
- 🌟 可以选中任意文本(甚至excel表格),然后通过utools快捷面板一键呼出“查找漏网之鱼”
- *注:如果“张三”和“张三丰”同时存在,会首先匹配更长的“张三丰”;如果查询字符串有歧义,例如“张三丰子恺”,可以手动在名字间添加分隔来消歧*
- 支持设置名单,自动从文本中识别连续英文字母和汉字字符构成的名字(空格、逗号等其他字符作为分断)
- 可以直接在设置输入框内键入文本
- 可以上传文件
- 👍可以选中任意文本(甚至excel表格),然后通过utools快捷面板一键呼出“新建名单”
- 🌟 可以选中任意文本(甚至excel表格),然后通过utools快捷面板一键呼出“新建名单”



Expand Down Expand Up @@ -58,12 +59,16 @@

1. 首先确保已安装[uTools](https://u.tools/)。uTools是一个跨Windows、macOS和Linux的效率工具平台,本插件基于uTools的快捷入口(如超级面板)实现一键光速获取结果的效果,打造极为高效的桌面工具。
2. 安装好uTools之后,有两种安装本插件的方式:
- **推荐**:在官方插件应用市场搜索“漏网之鱼”并安装,方便后续更新
- 从本仓库的[release界面](https://github.com/atomiechen/CatchFishIfYouCan/releases)下载插件文件,并通过utools超级面板或选中文件呼出utools来安装插件
- **推荐**:在官方插件应用市场搜索“漏网之鱼”并安装(见下图),方便后续更新
- 从本仓库的[release页面](https://github.com/atomiechen/CatchFishIfYouCan/releases)下载插件文件,并通过utools超级面板或选中文件呼出utools来安装插件

<div align="middle">
<img src="img/market_marked.png" width="600"/>
</div><br>



## Contributor
## Contributors

Atomie CHEN:[email protected]

Expand Down
Binary file added img/market_marked.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 14 additions & 6 deletions src/find.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function stringToNames(namesString) {
.filter(v => v)
// remove duplicate names
.forEach(allNames.add, allNames);
return Array.from(allNames);
return Array.from(allNames).sort((a, b) => (a.length - b.length) || a.localeCompare(b));
}

utools.onPluginEnter(({code, type, payload}) => {
Expand Down Expand Up @@ -196,11 +196,19 @@ function removeNameList() {
function findFish(namesString, allNames) {
namesString = namesString.trim();
const fish = [];
allNames.forEach(v => {
if (!namesString.includes(v)) {
fish.push(v);
}
})
// reversely loop to check the longer string first
// than the shorter one that may be the prefix
let i = allNames.length - 1;
for (; i >= 0; i--) {
let target = allNames[i];
if (!namesString.includes(target)) {
fish.push(target);
} else {
// replace all occurences of target word
let re = new RegExp(target, 'g');
namesString = namesString.replace(re,'|');
}
}
return fish;
}

Expand Down

0 comments on commit cf17dad

Please sign in to comment.