summaryrefslogtreecommitdiff
path: root/ext/js/display
diff options
context:
space:
mode:
authorCashew <52880648+Scrub1492@users.noreply.github.com>2023-12-20 21:36:27 +0900
committerGitHub <noreply@github.com>2023-12-20 12:36:27 +0000
commit229f04ba358b3485fa7952088e03dad9e651bb23 (patch)
treedfb4a0431368e2067d7e6f5d9ce08bf88e1730cd /ext/js/display
parent8b943cc97fab890085448122e7c13dd035d0e238 (diff)
rename variables (#409)
* rename variables * add comment to ambiguous variable * rename variables * add comments * rename functions
Diffstat (limited to 'ext/js/display')
-rw-r--r--ext/js/display/display-generator.js6
-rw-r--r--ext/js/display/option-toggle-hotkey-handler.js18
-rw-r--r--ext/js/display/query-parser.js1
3 files changed, 13 insertions, 12 deletions
diff --git a/ext/js/display/display-generator.js b/ext/js/display/display-generator.js
index ccdd49cf..87b02f8a 100644
--- a/ext/js/display/display-generator.js
+++ b/ext/js/display/display-generator.js
@@ -882,13 +882,13 @@ export class DisplayGenerator {
_appendFurigana(container, term, reading, addText) {
container.lang = 'ja';
const segments = this._japaneseUtil.distributeFurigana(term, reading);
- for (const {text, reading: reading2} of segments) {
- if (reading2) {
+ for (const {text, reading: furigana} of segments) {
+ if (furigana) {
const ruby = document.createElement('ruby');
const rt = document.createElement('rt');
addText(ruby, text);
ruby.appendChild(rt);
- rt.appendChild(document.createTextNode(reading2));
+ rt.appendChild(document.createTextNode(furigana));
container.appendChild(ruby);
} else {
addText(container, text);
diff --git a/ext/js/display/option-toggle-hotkey-handler.js b/ext/js/display/option-toggle-hotkey-handler.js
index edd7de5b..73c92d59 100644
--- a/ext/js/display/option-toggle-hotkey-handler.js
+++ b/ext/js/display/option-toggle-hotkey-handler.js
@@ -71,17 +71,17 @@ export class OptionToggleHotkeyHandler {
try {
const optionsContext = this._display.getOptionsContext();
- const result = (await yomitan.api.getSettings([{
+ const getSettingsResponse = (await yomitan.api.getSettings([{
scope: 'profile',
path,
optionsContext
}]))[0];
- const {error} = result;
- if (typeof error !== 'undefined') {
- throw ExtensionError.deserialize(error);
+ const {error: getSettingsError} = getSettingsResponse;
+ if (typeof getSettingsError !== 'undefined') {
+ throw ExtensionError.deserialize(getSettingsError);
}
- value = result.result;
+ value = getSettingsResponse.result;
if (typeof value !== 'boolean') {
throw new Error(`Option value of type ${typeof value} cannot be toggled`);
}
@@ -96,10 +96,10 @@ export class OptionToggleHotkeyHandler {
value,
optionsContext
};
- const result2 = (await yomitan.api.modifySettings([modification], this._source))[0];
- const {error: error2} = result2;
- if (typeof error2 !== 'undefined') {
- throw ExtensionError.deserialize(error2);
+ const modifySettingsResponse = (await yomitan.api.modifySettings([modification], this._source))[0];
+ const {error: modifySettingsError} = modifySettingsResponse;
+ if (typeof modifySettingsError !== 'undefined') {
+ throw ExtensionError.deserialize(modifySettingsError);
}
this._showNotification(this._createSuccessMessage(path, value), true);
diff --git a/ext/js/display/query-parser.js b/ext/js/display/query-parser.js
index e71c7251..3e59098f 100644
--- a/ext/js/display/query-parser.js
+++ b/ext/js/display/query-parser.js
@@ -339,6 +339,7 @@ export class QueryParser extends EventDispatcher {
}
/**
+ * Convert _reading_ to hiragana, katakana, or romaji, or _term_ if it is entirely kana and _reading_ is an empty string, based on _readingMode.
* @param {string} term
* @param {string} reading
* @returns {string}