Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace all instances of yomichan #314

Merged
merged 7 commits into from
Nov 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@
},
{
"files": [
"ext/js/yomichan.js"
"ext/js/yomitan.js"
],
"globals": {
"chrome": "writable"
Expand Down Expand Up @@ -417,7 +417,7 @@
{
"files": [
"ext/js/core.js",
"ext/js/yomichan.js",
"ext/js/yomitan.js",
"ext/js/accessibility/accessibility-controller.js",
"ext/js/background/backend.js",
"ext/js/background/profile-conditions-util.js",
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ assignees: ''
**Browser version**
(e.g. Firefox 83.0)

**Yomichan version**
**Yomitan version**
(e.g. 20.11.1.1)

**Exported settings file**
Expand Down
18 changes: 9 additions & 9 deletions docs/permissions.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
# Yomichan Permissions
# Yomitan Permissions

* `<all_urls>` <br>
Yomichan requires access to all URLs in order to run scripts to scan text and show the definitions popup,
Yomitan requires access to all URLs in order to run scripts to scan text and show the definitions popup,
request audio for playback and download, and connect with Anki.

* `storage` and `unlimitedStorage` <br>
Yomichan uses storage permissions in order to save extension settings and dictionary data.
Yomitan uses storage permissions in order to save extension settings and dictionary data.
`unlimitedStorage` is used to help prevent web browsers from unexpectedly
deleting dictionary data.

* `declarativeNetRequest` <br>
Yomichan uses this permission to ensure certain requests have valid and secure headers.
Yomitan uses this permission to ensure certain requests have valid and secure headers.
This sometimes involves removing or changing the `Origin` request header,
as this can be used to fingerprint browser configuration.

* `scripting` <br>
Yomichan needs to inject content scripts and stylesheets into webpages in order to
Yomitan needs to inject content scripts and stylesheets into webpages in order to
properly display the search popup.

* `offscreen` _(Chrome only)_ <br>
Expand All @@ -24,17 +24,17 @@
actions that require access to DOM APIs, such as any that require clipboard access.

* `clipboardWrite` <br>
Yomichan supports simulating the `Ctrl+C` (copy to clipboard) keyboard shortcut
Yomitan supports simulating the `Ctrl+C` (copy to clipboard) keyboard shortcut
when a definitions popup is open and focused.

* `clipboardRead` _(optional)_ <br>
Yomichan supports automatically opening a search window when Japanese text is copied to the clipboard
Yomitan supports automatically opening a search window when Japanese text is copied to the clipboard
while the browser is running, depending on how certain settings are configured.
This allows Yomichan to support scanning text from external applications, provided there is a way
This allows Yomitan to support scanning text from external applications, provided there is a way
to copy text from those applications to the clipboard.

* `nativeMessaging` _(optional, unavailable on Firefox for Android)_ <br>
Yomichan has the ability to communicate with an optional native messaging component in order to support
Yomitan has the ability to communicate with an optional native messaging component in order to support
parsing large blocks of Japanese text using
[MeCab](https://en.wikipedia.org/wiki/MeCab).
The installation of this component is optional and is not included by default.
18 changes: 9 additions & 9 deletions docs/templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Helpers

Yomichan supports several custom Handlebars helpers for rendering templates.
Yomitan supports several custom Handlebars helpers for rendering templates.
The source code for these templates can be found [here](../ext/js/templates/sandbox/anki-template-renderer.js).


Expand Down Expand Up @@ -586,12 +586,12 @@ Joins the arguments to a single string with a separator, flattening any argument

```handlebars
{{set "index" 32~}}
{{~join "_" "yomichan" (get "index") "value"}}
{{~join "_" "yomitan" (get "index") "value"}}
```

Output:
```html
yomichan_32_value
yomitan_32_value
```
</details>

Expand All @@ -613,12 +613,12 @@ Joins the arguments to a single string, without flattening arguments that are ar

```handlebars
{{set "index" 32~}}
{{~concat "yomichan_" (get "index") "_value"}}
{{~concat "yomitan_" (get "index") "_value"}}
```

Output:
```html
yomichan_32_value
yomitan_32_value
```
</details>

Expand Down Expand Up @@ -727,11 +727,11 @@ These functions are used together in order to request media and other types of o

Output:
```html
The audio file name is: yomichan_audio_にほんご_日本語.mp3
The audio file name is: yomitan_audio_にほんご_日本語.mp3

The screenshot file name is: yomichan_browser_screenshot_にほんご_日本語.png
The screenshot file name is: yomitan_browser_screenshot_にほんご_日本語.png

The clipboard image file name is: yomichan_clipboard_image_にほんご_日本語.png
The clipboard image file name is: yomitan_clipboard_image_にほんご_日本語.png

The clipboard text is: This is the clipboard text

Expand All @@ -741,7 +741,7 @@ These functions are used together in order to request media and other types of o

This is an example of text with generated furigana: <ruby>日本語<rt>にほんご</rt></ruby>

The remapped file name for image.png is: yomichan_dictionary_media_1_にほんご_日本語.png
The remapped file name for image.png is: yomitan_dictionary_media_1_にほんご_日本語.png
```
</details>

Expand Down
12 changes: 6 additions & 6 deletions ext/css/popup-outer.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

iframe.yomichan-popup {
iframe.yomitan-popup {
all: initial;
font-size: 1px;
background-color: #ffffff;
Expand All @@ -28,20 +28,20 @@ iframe.yomichan-popup {
z-index: 2147483647;
box-sizing: border-box;
}
iframe.yomichan-popup[data-theme=dark] {
iframe.yomitan-popup[data-theme=dark] {
background-color: #1e1e1e;
border-color: #666666;
}
iframe.yomichan-popup[data-outer-theme=dark] {
iframe.yomitan-popup[data-outer-theme=dark] {
box-shadow: 0 0 10em rgba(255, 255, 255, 0.5);
}
iframe.yomichan-popup[data-popup-display-mode=full-width] {
iframe.yomitan-popup[data-popup-display-mode=full-width] {
border-left: none;
border-right: none;
}
iframe.yomichan-popup[data-popup-display-mode=full-width][data-below=true] {
iframe.yomitan-popup[data-popup-display-mode=full-width][data-below=true] {
border-bottom: none;
}
iframe.yomichan-popup[data-popup-display-mode=full-width]:not([data-below=true]) {
iframe.yomitan-popup[data-popup-display-mode=full-width]:not([data-below=true]) {
border-top: none;
}
8 changes: 4 additions & 4 deletions ext/js/app/content-script-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@

import {log} from '../core.js';
import {HotkeyHandler} from '../input/hotkey-handler.js';
import {yomichan} from '../yomichan.js';
import {yomitan} from '../yomitan.js';
import {Frontend} from './frontend.js';
import {PopupFactory} from './popup-factory.js';

(async () => {
try {
await yomichan.prepare();
await yomitan.prepare();

const {tabId, frameId} = await yomichan.api.frameInformationGet();
const {tabId, frameId} = await yomitan.api.frameInformationGet();
if (typeof frameId !== 'number') {
throw new Error('Failed to get frameId');
}
Expand All @@ -51,7 +51,7 @@ import {PopupFactory} from './popup-factory.js';
});
await frontend.prepare();

yomichan.ready();
yomitan.ready();
} catch (e) {
log.error(e);
}
Expand Down
34 changes: 17 additions & 17 deletions ext/js/app/frontend.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {TextSourceElement} from '../dom/text-source-element.js';
import {TextSourceRange} from '../dom/text-source-range.js';
import {HotkeyHandler} from '../input/hotkey-handler.js';
import {TextScanner} from '../language/text-scanner.js';
import {yomichan} from '../yomichan.js';
import {yomitan} from '../yomitan.js';
import {PopupFactory} from './popup-factory.js';
import {Popup} from './popup.js';

Expand Down Expand Up @@ -137,7 +137,7 @@ export class Frontend {
async prepare() {
await this.updateOptions();
try {
const {zoomFactor} = await yomichan.api.getZoom();
const {zoomFactor} = await yomitan.api.getZoom();
this._pageZoomFactor = zoomFactor;
} catch (e) {
// Ignore exceptions which may occur due to being on an unsupported page (e.g. about:blank)
Expand All @@ -154,15 +154,15 @@ export class Frontend {
visualViewport.addEventListener('resize', this._onVisualViewportResize.bind(this));
}

yomichan.on('optionsUpdated', this.updateOptions.bind(this));
yomichan.on('zoomChanged', this._onZoomChanged.bind(this));
yomichan.on('closePopups', this._onClosePopups.bind(this));
yomitan.on('optionsUpdated', this.updateOptions.bind(this));
yomitan.on('zoomChanged', this._onZoomChanged.bind(this));
yomitan.on('closePopups', this._onClosePopups.bind(this));
chrome.runtime.onMessage.addListener(this._onRuntimeMessage.bind(this));

this._textScanner.on('clear', this._onTextScannerClear.bind(this));
this._textScanner.on('searched', this._onSearched.bind(this));

yomichan.crossFrame.registerHandlers([
yomitan.crossFrame.registerHandlers([
['Frontend.closePopup', {async: false, handler: this._onApiClosePopup.bind(this)}],
['Frontend.copySelection', {async: false, handler: this._onApiCopySelection.bind(this)}],
['Frontend.getSelectionText', {async: false, handler: this._onApiGetSelectionText.bind(this)}],
Expand Down Expand Up @@ -208,7 +208,7 @@ export class Frontend {
try {
await this._updateOptionsInternal();
} catch (e) {
if (!yomichan.isExtensionUnloaded) {
if (!yomitan.isExtensionUnloaded) {
throw e;
}
}
Expand Down Expand Up @@ -319,7 +319,7 @@ export class Frontend {
const scanningOptions = this._options.scanning;

if (error !== null) {
if (yomichan.isExtensionUnloaded) {
if (yomitan.isExtensionUnloaded) {
if (textSource !== null && !passive) {
this._showExtensionUnloaded(textSource);
}
Expand Down Expand Up @@ -388,7 +388,7 @@ export class Frontend {

async _updateOptionsInternal() {
const optionsContext = await this._getOptionsContext();
const options = await yomichan.api.optionsGet(optionsContext);
const options = await yomitan.api.optionsGet(optionsContext);
const {scanning: scanningOptions, sentenceParsing: sentenceParsingOptions} = options;
this._options = options;

Expand Down Expand Up @@ -520,7 +520,7 @@ export class Frontend {
return await this._getDefaultPopup();
}

const {popupId} = await yomichan.crossFrame.invoke(targetFrameId, 'Frontend.getPopupInfo');
const {popupId} = await yomitan.crossFrame.invoke(targetFrameId, 'Frontend.getPopupInfo');
if (popupId === null) {
return null;
}
Expand Down Expand Up @@ -559,7 +559,7 @@ export class Frontend {
try {
return this._popup !== null && await this._popup.containsPoint(x, y);
} catch (e) {
if (!yomichan.isExtensionUnloaded) {
if (!yomitan.isExtensionUnloaded) {
throw e;
}
return false;
Expand Down Expand Up @@ -625,7 +625,7 @@ export class Frontend {
Promise.resolve()
);
this._lastShowPromise.catch((error) => {
if (yomichan.isExtensionUnloaded) { return; }
if (yomitan.isExtensionUnloaded) { return; }
log.error(error);
});
return this._lastShowPromise;
Expand Down Expand Up @@ -677,9 +677,9 @@ export class Frontend {
_signalFrontendReady(targetFrameId=null) {
const params = {frameId: this._frameId};
if (targetFrameId === null) {
yomichan.api.broadcastTab('frontendReady', params);
yomitan.api.broadcastTab('frontendReady', params);
} else {
yomichan.api.sendMessageToFrame(targetFrameId, 'frontendReady', params);
yomitan.api.sendMessageToFrame(targetFrameId, 'frontendReady', params);
}
}

Expand Down Expand Up @@ -716,7 +716,7 @@ export class Frontend {
}

chrome.runtime.onMessage.addListener(onMessage);
yomichan.api.broadcastTab('Frontend.requestReadyBroadcast', {frameId: this._frameId});
yomitan.api.broadcastTab('Frontend.requestReadyBroadcast', {frameId: this._frameId});
});
}

Expand All @@ -742,7 +742,7 @@ export class Frontend {
let documentTitle = document.title;
if (this._useProxyPopup) {
try {
({url, documentTitle} = await yomichan.crossFrame.invoke(this._parentFrameId, 'Frontend.getPageInfo', {}));
({url, documentTitle} = await yomitan.crossFrame.invoke(this._parentFrameId, 'Frontend.getPageInfo', {}));
} catch (e) {
// NOP
}
Expand Down Expand Up @@ -788,7 +788,7 @@ export class Frontend {

async _prepareGoogleDocs() {
if (typeof GoogleDocsUtil !== 'undefined') { return; }
await yomichan.api.loadExtensionScripts([
await yomitan.api.loadExtensionScripts([
'/js/accessibility/google-docs-util.js'
]);
if (typeof GoogleDocsUtil === 'undefined') { return; }
Expand Down
6 changes: 3 additions & 3 deletions ext/js/app/popup-factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import {FrameOffsetForwarder} from '../comm/frame-offset-forwarder.js';
import {generateId} from '../core.js';
import {yomichan} from '../yomichan.js';
import {yomitan} from '../yomitan.js';
import {PopupProxy} from './popup-proxy.js';
import {PopupWindow} from './popup-window.js';
import {Popup} from './popup.js';
Expand All @@ -43,7 +43,7 @@ export class PopupFactory {
*/
prepare() {
this._frameOffsetForwarder.prepare();
yomichan.crossFrame.registerHandlers([
yomitan.crossFrame.registerHandlers([
['PopupFactory.getOrCreatePopup', {async: true, handler: this._onApiGetOrCreatePopup.bind(this)}],
['PopupFactory.setOptionsContext', {async: true, handler: this._onApiSetOptionsContext.bind(this)}],
['PopupFactory.hide', {async: false, handler: this._onApiHide.bind(this)}],
Expand Down Expand Up @@ -151,7 +151,7 @@ export class PopupFactory {
throw new Error('Invalid frameId');
}
const useFrameOffsetForwarder = (parentPopupId === null);
({id, depth, frameId} = await yomichan.crossFrame.invoke(frameId, 'PopupFactory.getOrCreatePopup', {
({id, depth, frameId} = await yomitan.crossFrame.invoke(frameId, 'PopupFactory.getOrCreatePopup', {
id,
parentPopupId,
frameId,
Expand Down
6 changes: 3 additions & 3 deletions ext/js/app/popup-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import {FrameOffsetForwarder} from '../comm/frame-offset-forwarder.js';
import {EventDispatcher, log} from '../core.js';
import {yomichan} from '../yomichan.js';
import {yomitan} from '../yomitan.js';
import {Popup} from './popup.js';

/**
Expand Down Expand Up @@ -294,14 +294,14 @@ export class PopupProxy extends EventDispatcher {
// Private

_invoke(action, params={}) {
return yomichan.crossFrame.invoke(this._frameId, action, params);
return yomitan.crossFrame.invoke(this._frameId, action, params);
}

async _invokeSafe(action, params={}, defaultReturnValue) {
try {
return await this._invoke(action, params);
} catch (e) {
if (!yomichan.isExtensionUnloaded) { throw e; }
if (!yomitan.isExtensionUnloaded) { throw e; }
return defaultReturnValue;
}
}
Expand Down
Loading
Loading