Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
liubiantao committed Aug 15, 2019
0 parents commit 53dea49
Show file tree
Hide file tree
Showing 10 changed files with 1,924 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
Binary file added 74B7D431-CFC6-4F34-A9DE-112C844A7676.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# alfred-workflow-xhyx for Alfred 3
小鹤音形编码查询

## [DOWNLOAD](https://github.com/liubiantao/alfred-workflow-what-rubbish/blob/master/xhyx.alfredworkflow)

![demo](demo.png)

## Requirements
1. [Alfred App v3](http://www.alfredapp.com/#download)
1. [Alfred Powerpack](https://buy.alfredapp.com/)

## Installing
1. Click the download buttons below
2. Double-click to import into Alfred

## Commands
- `xh {query}`

Binary file added demo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
57 changes: 57 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
const alfy = require('alfy')
const FormData = require('form-data')

const form = new FormData()
form.append('search_word', alfy.input)

const rawData = await alfy.fetch(
'http://www.xhup.club/Xhup/Search/searchCode',
{
method: 'POST',
body: form,
json: false
}
)

const data = JSON.parse(rawData)

const getItems = () => {
if (data.noResultCount > 0) {
return [
{
title: `${alfy.input}: 未收录的字`,
subtitle: '非《通用规范汉字表》国发〔2013〕23号文规定用字,故未收录',
arg: alfy.input
}
]
} else if (data.list_dz.length > 0) {
const list = data.list_dz[0]
return [
{
title: list[0],
arg: list[6]
},
{
title: `拆 分: ${list[1]}`,
arg: list[6]
},
{
title: `首 末: ${list[2]} ${list[3]}`,
arg: list[6]
},
{
title: `编 码: ${list[4]} ${list[5]}`,
arg: list[6]
}
]
} else {
return [
{
title: '请输入汉字',
arg: alfy.input
}
]
}
}

alfy.output(getItems())
124 changes: 124 additions & 0 deletions info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>bundleid</key>
<string>com.alfredapp.xhyx</string>
<key>category</key>
<string>Tools</string>
<key>connections</key>
<dict>
<key>74B7D431-CFC6-4F34-A9DE-112C844A7676</key>
<array>
<dict>
<key>destinationuid</key>
<string>23DD75F3-9D0D-469A-BCFE-7CAC9843B96F</string>
<key>modifiers</key>
<integer>0</integer>
<key>modifiersubtext</key>
<string></string>
<key>vitoclose</key>
<false/>
</dict>
</array>
</dict>
<key>createdby</key>
<string>liubiantao</string>
<key>description</key>
<string>小鹤音形编码查询</string>
<key>disabled</key>
<false/>
<key>name</key>
<string>小鹤查形</string>
<key>objects</key>
<array>
<dict>
<key>config</key>
<dict>
<key>alfredfiltersresults</key>
<false/>
<key>alfredfiltersresultsmatchmode</key>
<integer>0</integer>
<key>argumenttrimmode</key>
<integer>0</integer>
<key>argumenttype</key>
<integer>0</integer>
<key>escaping</key>
<integer>102</integer>
<key>keyword</key>
<string>xh</string>
<key>queuedelaycustom</key>
<integer>3</integer>
<key>queuedelayimmediatelyinitially</key>
<true/>
<key>queuedelaymode</key>
<integer>0</integer>
<key>queuemode</key>
<integer>1</integer>
<key>runningsubtext</key>
<string>查询中……</string>
<key>script</key>
<string>./node_modules/.bin/run-node index.js "$1"</string>
<key>scriptargtype</key>
<integer>1</integer>
<key>scriptfile</key>
<string></string>
<key>subtext</key>
<string>小鹤音形编码查询</string>
<key>title</key>
<string>小鹤查形</string>
<key>type</key>
<integer>0</integer>
<key>withspace</key>
<true/>
</dict>
<key>type</key>
<string>alfred.workflow.input.scriptfilter</string>
<key>uid</key>
<string>74B7D431-CFC6-4F34-A9DE-112C844A7676</string>
<key>version</key>
<integer>2</integer>
</dict>
<dict>
<key>config</key>
<dict>
<key>browser</key>
<string></string>
<key>spaces</key>
<string></string>
<key>url</key>
<string>https://www.zdic.net/hans/{query}</string>
<key>utf8</key>
<true/>
</dict>
<key>type</key>
<string>alfred.workflow.action.openurl</string>
<key>uid</key>
<string>23DD75F3-9D0D-469A-BCFE-7CAC9843B96F</string>
<key>version</key>
<integer>1</integer>
</dict>
</array>
<key>readme</key>
<string></string>
<key>uidata</key>
<dict>
<key>23DD75F3-9D0D-469A-BCFE-7CAC9843B96F</key>
<dict>
<key>xpos</key>
<integer>510</integer>
<key>ypos</key>
<integer>190</integer>
</dict>
<key>74B7D431-CFC6-4F34-A9DE-112C844A7676</key>
<dict>
<key>xpos</key>
<integer>260</integer>
<key>ypos</key>
<integer>190</integer>
</dict>
</dict>
<key>webaddress</key>
<string>https://github.com/liubiantao/alfred-workflow-xhyx</string>
</dict>
</plist>
Loading

0 comments on commit 53dea49

Please sign in to comment.