-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use to-jyutping Package, Strict Typing, Migrate to Manifest Version 3 (…
…#8) * Use to-jyutping Package, Strict Typing * Migrate to Manifest Version 3
- Loading branch information
1 parent
de37760
commit dc9e3b6
Showing
25 changed files
with
781 additions
and
278 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,44 @@ | ||
name: Build | ||
name: Lint & Build | ||
|
||
on: | ||
push: | ||
release: | ||
types: | ||
- created | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
release: | ||
types: | ||
- created | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.x' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install opencc | ||
- name: Build | ||
run: python build.py | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: inject-jyutping | ||
path: | | ||
_locales | ||
background_scripts | ||
content_scripts | ||
icons | ||
lib | ||
popup | ||
manifest.json | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v4 | ||
|
||
- name: Install dependencies | ||
run: npm i | ||
|
||
- name: Run lint | ||
run: npm run lint | ||
|
||
- name: Upload artifact | ||
if: ${{ github.event_name == 'release' }} | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: inject-jyutping | ||
path: | | ||
_locales | ||
background_scripts | ||
content_scripts | ||
icons | ||
lib | ||
popup | ||
manifest.json | ||
node_modules/webextension-polyfill/dist/browser-polyfill.min.js | ||
node_modules/to-jyutping/dist/index.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
/jyut6ping3.dict.yaml | ||
/jyut6ping3.simple.dict.yaml | ||
/background_scripts/dictionary.json.txt | ||
/preprocess.py | ||
/lib/browser-polyfill.js | ||
/inject-jyutping.zip | ||
inject-jyutping.zip | ||
node_modules | ||
DS_Store | ||
jsconfig.tsbuildinfo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,14 @@ | ||
<h1>Inject Jyutping <ruby>幫<rt>bong1</rt></ruby> <ruby>漢<rt>hon3</rt></ruby> <ruby>字<rt>zi6</rt></ruby> <ruby>標<rt>biu1</rt></ruby> <ruby>粵<rt>jyut6</rt></ruby> <ruby>拼<rt>ping3</rt></ruby></h1> | ||
|
||
呢個係一個可以幫網頁上面嘅漢字自動標註粵拼嘅 Chrome 同 Firefox 插件,係學習粵拼同粵語嘅強大工具。 | ||
呢個係一個可以幫網頁上面嘅漢字自動標註粵拼嘅 Chrome、Firefox 同 Edge 擴充功能,係學習粵拼同粵語嘅強大工具。 | ||
|
||
A browser extension for Mozilla Firefox and Google Chrome that adds Cantonese pronunciation (Jyutping) on Chinese characters, a powerful tool for learning Cantonese and Jyutping. | ||
A browser extension for Google Chrome, Mozilla Firefox, and Microsoft Edge that adds Cantonese pronunciation (Jyutping) on Chinese characters, a powerful tool for learning Cantonese and Jyutping. | ||
|
||
項目靈感來自 [EYHN/Furigana](https://github.com/EYHN/Furigana)。 | ||
<h2>Install <ruby>安<rt>on1</rt></ruby> <ruby>裝<rt>zong1</rt></ruby></h2> | ||
|
||
This project is inspired by [EYHN/Furigana](https://github.com/EYHN/Furigana). | ||
- [Chrome Web Store](https://chrome.google.com/webstore/detail/inject-jyutping/lfgpgjkjglogbndlkikjgbbfoiofbdjp) | ||
- [Firefox Browser Add-On](https://addons.mozilla.org/firefox/addon/inject-jyutping/) | ||
|
||
<h2>Install <ruby>安<rt>on1</rt></ruby> <ruby>裝<rt>zong1</rt></ruby> </h2> | ||
<h2>Preview <ruby>預<rt>jyu6</rt></ruby> <ruby>覽<rt>laam5</rt></ruby></h2> | ||
|
||
- [Chrome Web Store](https://chrome.google.com/webstore/detail/inject-jyutping/lfgpgjkjglogbndlkikjgbbfoiofbdjp) | ||
- [Firefox Browser Add-On](https://addons.mozilla.org/en-US/firefox/addon/inject-jyutping/) | ||
|
||
<h2>Build <ruby>編<rt>pin1</rt></ruby> <ruby>譯<rt>jik6</rt></ruby> </h2> | ||
|
||
See [`.github/workflows/build.yml`](.github/workflows/build.yml). | ||
|
||
<h2>Screenshot <ruby>截<rt>zit6</rt></ruby> <ruby>圖<rt>tou4</rt></ruby> </h2> | ||
|
||
![](./demo.jpg) | ||
![Demo](./demo.jpg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"langCode": { | ||
"message": "ko" | ||
}, | ||
"extensionName": { | ||
"message": "월병(粵拼)을 주입" | ||
}, | ||
"extensionDescription": { | ||
"message": "한자에 광동어의 발음(월병/粵拼)을 붙인다." | ||
}, | ||
"contextMenuItemDoInjectJyutping": { | ||
"message": "월병(粵拼)을 주입" | ||
}, | ||
"popupCheckboxText": { | ||
"message": "자동으로 주입" | ||
}, | ||
"refreshPromptText": { | ||
"message": "변경사항을 적용하려면 페이지를 다시 로드하세요." | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import '/node_modules/webextension-polyfill/dist/browser-polyfill.min.js'; | ||
import '/node_modules/to-jyutping/dist/index.js'; | ||
import '/lib/MessageManager.js'; | ||
|
||
/* Communicate with content script */ | ||
|
||
browser.runtime.onConnect.addListener(port => { | ||
/** @type { MessageManager<{ convert(msg: string): [string, string | null][] }> } */ | ||
const mm = new MessageManager(port); | ||
mm.registerHandler('convert', ToJyutping.getJyutpingList); | ||
}); | ||
|
||
/* Context Menu */ | ||
|
||
browser.contextMenus.onClicked.addListener((info, tab) => { | ||
if (info.menuItemId === 'do-inject-jyutping') { | ||
browser.tabs.sendMessage(tab?.id || 0, { name: 'do-inject-jyutping' }); | ||
} | ||
}); | ||
|
||
browser.contextMenus.create({ | ||
id: 'do-inject-jyutping', | ||
title: browser.i18n.getMessage('contextMenuItemDoInjectJyutping'), | ||
contexts: ['page'], | ||
}); |
This file was deleted.
Oops, something went wrong.
File renamed without changes.
Oops, something went wrong.