Skip to content

Extension for Japanese text parsing + sentence mining with JPDB. Works with subtitles from asbplayer and apps like readwok or ttsu reader.

License

Notifications You must be signed in to change notification settings

Kagu-chan/anki-jpdb.reader

Repository files navigation

Anki JPDB Reader

Contents

  1. Downloads
  2. Automatic parsing
  3. Installation
  4. Setup
  5. Usage
  6. Customize parsing
  7. Customize text colors and furigana
  8. Building
  9. Contributing
  10. License

Downloads

A browser extension thats aims to parse most japanese text in the browser using JPDB and mining into JPDB or Anki decks.

This is a fork of the JPDB Web Reader extension

Thanks to Max and the JPDB Discord for making the original extension and fixing some issues along the way! Sadly, manifest 3 came along and thus the original is no longer working.

Please note:

  • Currently only chromium-based browsers and firefox (including Android) are supported
  • Mobile support for kiwi, Edge Canary and comparable browsers as well as firefox android is experimental
  • Bunpro is currently not supported
  • Support for youtube subtitles has been removed - please use this extension together with asbplayer
  • Extension Updates in browser app stores are sometimes delayed from releases on github - this should usually make no difference

Automatic parsing

Some web apps and sites require special attention to work properly, therefore they parse automatically on certain triggers. Those can be disabled or extended in the settings.

App URLs
ッツ Reader reader.ttsu.app, ttu-ebook.web.app
Texthooker pages anacreondjt texthooker, learnjapanese.moe texthooker, exSTATic tracker, renji-xd texthooker
Mokuro reader.mokuro.app
Mokuro (Legacy) Mokuro: IMPORTANT: File path must contain mokuro, and file name must end in .html
Readwok app.readwok.com
Satori Reader satorireader.com
NHK News nhk.or.jp
Wikipedia ja.wikipedia.org
asbplayer github.com/killergerbah/asbplayer
Youtube comments youtube.com
Custom Dictionaries CDM by Nakura Nakamoto
LunaTranslator Luna Translator with webview2 enabled

Installation

Chrome

Chrome Browser Extension or

  1. Download the latest *-chromium.zip file from the releases page
  2. Unpack the zip file in a location of your choosing
  3. Open up your browser and navigate to chrome://extensions/
  4. Check the Developer mode switch at the top right of your window
  5. Click the Load unpacked button at the top left
  6. In the file picker dialog, navigate to the folder you unpacked earlier. You should see a file called manifest.json inside the folder
  7. Click select/open/choose to exit the dialog and load the extension
  8. Continue with the Setup section

Firefox

Firefox Browser Extension, install it via Firefox for Android or

  1. Download the latest -firefox.xpi file from the releases page
  2. Open up your browser and navigate to about:debugging
  3. Click on This firefox, then Load temporary addon
  4. In the file picker dialog, navigate to the folder you downloaded the xpi file to.
  5. Click select/open/choose to exit the dialog and load the extension
  6. Continue with the Setup section

Please note, that if you use the manual setup, the extension will be unloaded the next time you open firefox. Your settings will be preserved. This is only for testing and debugging!

Edge Canary

I am currently not able to test or verify the Edge version of the extension, but you can follow the instructions on the Kiwi browser repository as a starting point.

The extension ID is gpomfklkdbhmpagecjpnlhlffdlhcbnb.

Setup

Upon installation the settings page will open. You can also find it by clicking on the reader icon (読) in the browser menu bar. It might be hidden behind the extension overflow menu, which looks like a little puzzle piece (🧩).

Here you will need to enter your jpdb API key. It can be found at the very bottom of the jpdb settings page. You can also change various hotkeys

Usage

You can use the reader on any website. Just select some text, right click, and choose the "Parse ... with jpdb" option. Alternatively use the shortcut (Alt+P) or the extension menu at the top right corner.

Words will be colored according to their state (known, new, etc.). Hover over words while holding Shift to see their meaning, and to mine or review them.

Customize parsing

Parsing can be enabled or disabled per integration. You can also add custom URLs to automatically parse in the settings.

Additionally, you can add complete meta definitions in JSON format - refer to the typings or see the docs

Customize text colors and furigana

Customization is currently done with custom CSS, because its the most simple way to offer a flexible framework. See the docs on it here

Building

Node version 22.x is used!

You can run the following command to build the extension locally:

$ npm install
$ npm run build

The resulting files will be located in the anki-jpdb.reader/ folder

For development, you can also run the build in watch mode:

$ npm install
$ npm run watch

This will continuously rebuild the source code as it changes, and place the output in the anki-jpdb.reader/ folder. It can be loaded as an unpacked extension from there. Please remember to wait until building is done, and reload the extension on the "manage extensions" page before testing your changes.

Reloading is not required for the browser popup (top right) or the settings page.

Also, please look at the Contributing section if you plan on contributing your changes.

Contributing

Issues with feedback or ideas for new features are very welcome. You can also message me on the JPDB and Refold Japanese Discord servers (@chinokusari).

The following commands may be of interest to you:

  • npm run lint: Checks your code for formatting issues, linter warnings and type errors. The CI also runs this, so your pull request will only be accepted if it passes. You can use eslint ignore comments if you get false positives, but leave a comment explaining why you think the error is false and safe to ignore.
  • npm run lint:fix: Reformats your code, as well as fixing any fixable lint issues. Note, if your editor has a prettier plugin, installing that and turning on "format on save" will be more convenient.
  • npm run build: Compiles the code for chrome, putting the compiled code into anki-jpdb.reader/
  • npm run build [target] builds for a specific target
  • npm run watch: Automatically recompiles the code for chrome when it changes, putting the output into anki-jpdb.reader/. Using this is recommended during development.
  • npm run watch [target] recompiles for the specified target
  • npm run pack builds, then packs the extension for all targets. The archives are placed inside packages/
  • npm run pack [target, [target...]] builds for specified targets

Currently chrome|chromium and firefox are supported

License

MIT

This project uses Font Awesome 4, which is licensed under the MIT License. Please ensure compliance with its license when using or distributing this project.

About

Extension for Japanese text parsing + sentence mining with JPDB. Works with subtitles from asbplayer and apps like readwok or ttsu reader.

Resources

License

Stars

Watchers

Forks

Contributors 10