Skip to content

Commit

Permalink
fix conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Lyroxide committed Jun 13, 2024
2 parents 8ee1489 + 850d390 commit cc78f4f
Show file tree
Hide file tree
Showing 218 changed files with 6,765 additions and 4,632 deletions.
7 changes: 6 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
"@stylistic/arrow-spacing": ["error", {"before": true, "after": true}],
"@stylistic/block-spacing": ["error", "always"],
"@stylistic/brace-style": ["error", "1tbs", {"allowSingleLine": true}],
"@stylistic/comma-dangle": ["error", "never"],
"@stylistic/comma-dangle": ["error", "always-multiline"],
"@stylistic/comma-spacing": ["error", {"before": false, "after": true}],
"@stylistic/comma-style": ["error", "last"],
"@stylistic/computed-property-spacing": ["error", "never"],
Expand Down Expand Up @@ -567,6 +567,7 @@
"ext/js/display/pronunciation-generator.js",
"ext/js/display/structured-content-generator.js",
"ext/js/dom/css-style-applier.js",
"ext/js/language/CJK-util.js",
"ext/js/language/ja/japanese.js",
"ext/js/language/text-utilities.js",
"ext/js/templates/anki-template-renderer-content-manager.js",
Expand Down Expand Up @@ -640,9 +641,11 @@
"ext/js/general/object-property-accessor.js",
"ext/js/general/regex-util.js",
"ext/js/language/ar/arabic-text-preprocessors.js",
"ext/js/language/CJK-util.js",
"ext/js/language/de/german-text-preprocessors.js",
"ext/js/language/de/german-transforms.js",
"ext/js/language/en/english-transforms.js",
"ext/js/language/es/spanish-transforms.js",
"ext/js/language/ja/japanese-text-preprocessors.js",
"ext/js/language/ja/japanese-transforms.js",
"ext/js/language/ja/japanese-wanakana.js",
Expand All @@ -657,9 +660,11 @@
"ext/js/language/multi-language-transformer.js",
"ext/js/language/ru/russian-text-preprocessors.js",
"ext/js/language/sga/old-irish-transforms.js",
"ext/js/language/sh/serbo-croatian-text-preprocessors.js",
"ext/js/language/sq/albanian-transforms.js",
"ext/js/language/text-processors.js",
"ext/js/language/translator.js",
"ext/js/language/zh/chinese.js",
"ext/js/media/audio-downloader.js",
"ext/js/media/media-util.js",
"ext/js/templates/template-patcher.js"
Expand Down
10 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE/tech-debt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
name: Tech Debt
about: Track any tech debt or dev improvements
title: ''
labels: area/tech-debt
assignees: ''

---


2 changes: 1 addition & 1 deletion .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
persist-credentials: false

- name: "Run analysis"
uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1
uses: ossf/scorecard-action@dc50aa9510b46c811795eb24b2f1ba02a914e534 # v2.3.3
with:
results_file: results.sarif
results_format: sarif
Expand Down
131 changes: 79 additions & 52 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,61 +1,56 @@
# Yomitan <!-- omit from toc -->
# Yomitan

[![Chrome Release](<https://img.shields.io/chrome-web-store/v/likgccmbimhjbgkjambclfkhldnlhbnn?logo=Google%20Chrome&logoColor=lightblue&color=lightblue&label=chrome%20release%20(stable)>)](https://chrome.google.com/webstore/detail/yomitan/likgccmbimhjbgkjambclfkhldnlhbnn)
[![Firefox Release](<https://img.shields.io/amo/v/yomitan?logo=Firefox&color=orange&label=firefox%20release%20(stable)>)](https://addons.mozilla.org/en-US/firefox/addon/yomitan/)
[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/themoeway/yomitan/badge)](https://securityscorecards.dev/viewer/?uri=github.com/themoeway/yomitan)
[![Discord](https://dcbadge.vercel.app/api/server/UGNPMDE7zC?style=flat)](https://discord.gg/UGNPMDE7zC)

:wave: **This project is a community fork of Yomichan** (which was [sunset](https://foosoft.net/posts/sunsetting-the-yomichan-project/) by its owner on Feb 26 2023). We have made a number of foundational changes to ensure **the project stays alive, works on latest browser versions, and is easy to contribute to**:
:wave: **Yomitan is [the successor](https://foosoft.net/posts/passing-the-torch-to-yomitan/) to Yomichan** ([migration guide](./docs/yomichan-migration.md#migrating-from-yomichan)) which was [sunset](https://foosoft.net/posts/sunsetting-the-yomichan-project/) by its owner on Feb 26, 2023. We have made a number of [foundational changes](#changes) to ensure **the project stays alive, works on latest browser versions, and is easy to contribute to**.

- Completed the Manifest V2 → V3 transition, [read why here!](https://developer.chrome.com/blog/resuming-the-transition-to-mv3/).
- Switched to using ECMAScript modules and npm-sourced dependencies.
- Implemented an end-to-end CI/CD pipeline.
- Switched to standard testing frameworks, vitest and playwrights.
📢 **New contributors [welcome](#contributing)!**

In addition, we are beginning to make important bug fixes and minor enhancements:
📢 **Interested in adding a new language to Yomitan? See [here](./docs/development/language-features.md) for thorough documentation!**

- Improve dictionary import speeds by 2x~10x.
- Add functionality to import/export multiple dictionaries, enabling portability across devices.
- And [more](https://github.com/themoeway/yomitan/pulls?q=is%3Apr+is%3Amerged+-label%3Aarea%2Fdependencies+-label%3Akind%2Fmeta).
## What is Yomitan?

Since the owner requested forks be uniquely named, we have chosen a new name, _yomitan_. (_-tan_ is an honorific used for anthropomorphic moe characters.) While we've made some substantial changes, the majority of the extension's functionality is thanks to hard work of foosoft and numerous other open source contributors from 2016-2023.
Yomitan turns your web browser into a tool for building Japanese language literacy by helping you **read** texts that would otherwise be too difficult to tackle.

## Contributing

Since this is a distributed effort, we **highly welcome new contributors**! Feel free to browse the [issue tracker](https://github.com/themoeway/yomitan/issues), and read our [contributing guidelines](./CONTRIBUTING.md). If you want to add or improve support for a language, read the documentation on [language features](./docs/development/language-features.md). You can also find us on [TheMoeWay Discord](https://discord.gg/UGNPMDE7zC) at [#yomitan-development](https://discord.com/channels/617136488840429598/1081538711742844980).

## What's Yomitan?<!-- omit from toc -->
Yomitan provides powerful features not available in other browser-based dictionaries:

Yomitan turns your web browser into a tool for building Japanese language literacy by helping you to decipher texts
which would be otherwise too difficult to tackle. This extension is similar to [10ten Japanese Reader (formerly Rikaichamp)](https://addons.mozilla.org/en-US/firefox/addon/10ten-ja-reader/) for Firefox and [Rikaikun](https://chrome.google.com/webstore/detail/rikaikun/jipdnfibhldikgcjhfnomkfpcebammhp) for Chrome, but it stands apart in its goal of being an all-encompassing learning tool as opposed to a mere browser-based dictionary.

Yomitan provides advanced features not available in other browser-based dictionaries:

- Interactive popup definition window for displaying search results.
- On-demand audio playback for select dictionary definitions.
- Kanji stroke order diagrams are just a click away for most characters.
- Custom search page for easily executing custom search queries.
- Support for multiple dictionary formats including [EPWING](https://ja.wikipedia.org/wiki/EPWING) via the [Yomitan Import](https://github.com/themoeway/yomitan-import) tool.
- Automatic note creation for the [Anki](https://apps.ankiweb.net/) flashcard program via the [AnkiConnect](https://foosoft.net/projects/anki-connect) plugin.
- Clean, modern code makes it easy for developers to [contribute](https://github.com/themoeway/yomitan/blob/master/CONTRIBUTING.md) new features.
- 💬 Interactive popup definition window for displaying search results.
- 🔊 Built-in native audio sources for Japanese words with the ability to add your own [custom audio sources](./docs/audio.md).
- ✍️ Kanji stroke order diagrams are just a click away.
- 📝 [Automatic flashcard creation](./docs/anki-integration.md#anki-integration) for the [Anki](https://apps.ankiweb.net/) flashcard program via the [AnkiConnect](https://foosoft.net/projects/anki-connect) plugin.
- 🔍 Custom search page for easily executing custom search queries.
- 📖 Support for multiple dictionary formats including [EPWING](https://ja.wikipedia.org/wiki/EPWING) via the [Yomitan Import](https://github.com/themoeway/yomitan-import) tool.
- ✨ Clean, modern code makes it easy for developers to [contribute](#contributing) new features and languages.

[![Term definitions](img/ss-terms-thumb.png)](img/ss-terms.png)
[![Kanji information](img/ss-kanji-thumb.png)](img/ss-kanji.png)
[![Dictionary options](img/ss-dictionaries-thumb.png)](img/ss-dictionaries.png)
[![Anki options](img/ss-anki-thumb.png)](img/ss-anki.png)

## Helpful information<!-- omit from toc -->

- [Migrating from Yomichan (legacy)](./docs/yomichan-migration.md#migrating-from-yomichan)
- [Importing standardised and custom dictionaries](./docs/dictionaries.md#dictionaries)
- [Anki integration and flashcards creation](./docs/anki-integration.md#anki-integration)
- [Advanced options, including MeCab](./docs/advanced-options.md#advanced-options)
- [Frequently asked questions](./docs/faq.md#frequently-asked-questions)
- [Keyboard shortcuts](./docs/keyboard-shortcuts.md)
## Helpful information

-[Migrating from Yomichan (legacy)](./docs/yomichan-migration.md)
- Installation and Setup
- 📚 [Recommended Dictionaries](./docs/dictionaries.md#recommended-dictionaries)
- 🗂️ [Importing and exporting dictionaries](./docs/dictionaries.md#importing-a-dictionary-collection)
- Anki Integration
- 📇 [Anki integration and flashcard creation guide](./docs/anki-integration.md)
- 🔧 [Anki handlebar templates](./docs/templates.md)
- Advanced Features
- ⌨️ [Keyboard shortcuts](./docs/keyboard-shortcuts.md)
- 🔍 [Advanced options, including MeCab](./docs/advanced-options.md)
- 🔊 [Adding custom audio sources](./docs/audio.md)
- Troubleshooting
- 🕷️ [Known browser bugs](./docs/browser-bugs.md)
-[Frequently asked questions](./docs/faq.md)
- 🔒 [Browser Permissions](./docs/permissions.md)

## Installation

Yomitan comes in two flavors: _stable_ and _testing_. New changes are initially introduced into the _testing_ version, and after some time spent ensuring that they are relatively bug free, they will be promoted to the _stable_ version. If you are technically savvy and don't mind submitting issues on GitHub, try the _testing_ version; otherwise, the _stable_ version will be your best bet.
Yomitan comes in two flavors: _stable_ and _testing_. New changes are initially introduced into the _testing_ version, and after some time spent ensuring that they are relatively bug free, they will be promoted to the _stable_ version. If you are technically savvy and don't mind [submitting issues](https://github.com/themoeway/yomitan/issues/new/choose) on GitHub, try the _testing_ version; otherwise, the _stable_ version will be your best bet. Check [contributing](#contributing) for more information on how to help.

- **Google Chrome**

Expand All @@ -66,9 +61,7 @@ Yomitan comes in two flavors: _stable_ and _testing_. New changes are initially
- [stable](https://addons.mozilla.org/en-US/firefox/addon/yomitan/)
- [testing](https://github.com/themoeway/yomitan/releases)

※ Unlike Chrome, Firefox does not allow extensions meant for testing to be hosted in the marketplace.
You will have to download a desired version and side-load it yourself. You only need to do this once and will get
updates automatically.
※ Unlike Chrome, Firefox does not allow extensions meant for testing to be hosted in the marketplace. You will have to download the desired version and side-load it yourself. You only need to do this once, and you will get updates automatically.

## Basic Usage

Expand All @@ -81,7 +74,7 @@ updates automatically.
- The <img src="ext/images/question-mark-circle.svg" width="16" height="16" alt="question mark symbol"> _question mark_ button will open the Information page.
- The <img src="ext/images/profile.svg" width="16" height="16" alt="profile icon"> _profile_ button will appear when multiple profiles exist, allowing the current profile to be quickly changed.

2. Import the dictionaries you wish to use for term and kanji searches, head over to the [the dictionary docs](./docs/dictionaries.md) to get set up! If you do not have any dictionaries installed or enabled, Yomitan will warn you that it is not ready for use by displaying an orange exclamation mark over its icon. This exclamation mark will disappear once you have installed and enabled at least one dictionary.
2. Import the dictionaries you wish to use for term and kanji searches; head over to the [dictionary docs](./docs/dictionaries.md) to get set up! If you do not have any dictionaries installed or enabled, Yomitan will warn you that it is not ready for use by displaying an orange exclamation mark over its icon. This exclamation mark will disappear once you have installed and enabled at least one dictionary.

<img src="resources/images/settings-dictionaries-popup.png" width="300" alt="custom dictionaries list">

Expand All @@ -91,25 +84,59 @@ updates automatically.

4. Click on the <img src="ext/images/play-audio.svg" width="16" height="16" alt="loudspeaker icon"> _speaker_ button to hear the term pronounced by a native speaker. If an audio sample is not available, you will hear a short click instead. For more options, see [Audio Configuration](./docs/audio.md).

5. Click on individual kanji in the term definition results to view additional information about those characters, including stroke order diagrams, readings, meanings, as well as other useful data.
5. Click on individual kanji in the term definition results to view additional information about those characters, including stroke order diagrams, readings, meanings, and other useful data.

<img src="resources/images/search-popup-kanji.png" width="300" alt="popup with kanji details">

To further enhance your Yomitan experience, it's worth [integrating with Anki](./docs/anki-integration.md), a spaced-repetition flashcard program to help solidify the words you encounter.

## Licenses
## Changes

> While we have made some substantial changes, the majority of the extension's functionality is thanks to hard work of [FooSoft](https://foosoft.net/) and many other incredible open source contributors from 2016-2023.
Major changes:

- 🌐 Added multi-language support!
- 💪 Completed the Manifest V2 → V3 transition, [read why here](https://developer.chrome.com/blog/resuming-the-transition-to-mv3/).
- ⚡ Switched to using ECMAScript modules and npm-sourced dependencies.
- 🔧 Implemented an end-to-end CI/CD pipeline.
- 🧪 Switched to standard testing frameworks, vitest and playwrights.

In addition, we have made important bug fixes and minor enhancements:

- ⚡ Improved dictionary import speeds by 2x~10x.
- 📚 Added functionality to import/export multiple dictionaries, enabling portability across devices.
- ✨ And [more](https://github.com/themoeway/yomitan/pulls?q=is%3Apr+is%3Amerged+-label%3Aarea%2Fdependencies+-label%3Akind%2Fmeta).

Since the owner requested forks be uniquely named, we have chosen a new name, _Yomitan_ (_-tan_ is an honorific used for anthropomorphic moe characters).

## Contributing

🚀 **Dip your toes into contributing by looking at issues with the label [good-first-issue](https://github.com/themoeway/yomitan/issues?q=is%3Aopen+is%3Aissue+label%3Agood-first-issue).**

Since this is a distributed effort, we **highly welcome new contributors**! Feel free to browse the [issue tracker](https://github.com/themoeway/yomitan/issues), and read our [contributing guidelines](./CONTRIBUTING.md).

Here are some ways anyone can help:

- Try using the Yomitan dev build. Not only do you get cutting edge features, but you can help uncover bugs and give feedback to developers early on.
- Document any UI/UX friction in Github Issues. We're looking to make Yomitan more accessible to non-technical users.
- All the issues in `area/bug` older than 2 months need help reproducing. If anything interests you, please try to reproduce it and report your results. We can't easily tell if these issues are one-off, have since been resolved, or are no longer relevant.

> The current active maintainers of Yomitan spend a lot of their time debugging and triaging issues. When someone files a bug report, we need to assess the frequency and severity of the bug. It is extremely helpful if we get multiple reports of people who experience a bug or people who can contribute additional detail to an existing bug report.
If you're looking to code, please let us know what you plan on working on before submitting a Pull Request. This gives the core maintainers an opportunity to provide feedback early on before you dive too deep. You can do this by opening a Github Issue with the proposal.

Some contributions we always appreciate:

- Well-written tests covering different functionalities. This includes [playwright tests](https://github.com/themoeway/yomitan/tree/master/test/playwright), [benchmark tests](https://github.com/themoeway/yomitan/tree/master/benches), and unit tests.
- Increasing our type coverage.
- More and better documentation!

Required licensing notices for this project follow below:
Information on how to setup and build the codebase can be found [here](./CONTRIBUTING.md#setup).

- **EDRDG License** \
This package uses the [EDICT](https://www.edrdg.org/jmdict/edict.html) and
[KANJIDIC](https://www.edrdg.org/wiki/index.php/KANJIDIC_Project) dictionary files. These files are the property of
the [Electronic Dictionary Research and Development Group](https://www.edrdg.org/), and are used in conformance with
the Group's [license](https://www.edrdg.org/edrdg/licence.html).
If you want to add or improve support for a language, read the documentation on [language features](./docs/development/language-features.md).

- **Kanjium License** \
The pitch accent notation, verb particle data, phonetics, homonyms and other additions or modifications to EDICT,
KANJIDIC or KRADFILE were provided by Uros Ozvatic through his free database.
Feel free to join us on [TheMoeWay Discord 🐇](https://discord.gg/UGNPMDE7zC) at [#yomitan-development](https://discord.com/channels/617136488840429598/1081538711742844980).

## Third-Party Libraries

Expand Down
29 changes: 29 additions & 0 deletions benches/canary.bench.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright (C) 2024 Yomitan Authors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

import {bench, describe} from 'vitest';


describe('Canary', () => {
bench('Loop 1 through 100,000', async () => {
let sum = 0;
for (let i = 0; i < 10000; i++) {
sum += i;
}
console.debug(sum);
});
});
Loading

0 comments on commit cc78f4f

Please sign in to comment.