summaryrefslogtreecommitdiff
path: root/ext/js/display
diff options
context:
space:
mode:
Diffstat (limited to 'ext/js/display')
-rw-r--r--ext/js/display/display-anki.js24
-rw-r--r--ext/js/display/display-audio.js16
-rw-r--r--ext/js/display/display-content-manager.js2
-rw-r--r--ext/js/display/display-generator.js2
-rw-r--r--ext/js/display/display-history.js2
-rw-r--r--ext/js/display/display-profile-selection.js2
-rw-r--r--ext/js/display/display.js64
-rw-r--r--ext/js/display/option-toggle-hotkey-handler.js6
-rw-r--r--ext/js/display/query-parser.js6
-rw-r--r--ext/js/display/search-display-controller.js22
-rw-r--r--ext/js/display/structured-content-generator.js6
11 files changed, 76 insertions, 76 deletions
diff --git a/ext/js/display/display-anki.js b/ext/js/display/display-anki.js
index 6ac84ede..fa82a7b6 100644
--- a/ext/js/display/display-anki.js
+++ b/ext/js/display/display-anki.js
@@ -94,7 +94,7 @@ export class DisplayAnki {
/** @type {Map<import('dictionary').DictionaryEntryType, import('display-anki').CreateMode[]>} */
this._dictionaryEntryTypeModeMap = new Map([
['kanji', ['kanji']],
- ['term', ['term-kanji', 'term-kana']]
+ ['term', ['term-kanji', 'term-kana']],
]);
/** @type {HTMLElement} */
this._menuContainer = querySelectorNotNull(document, '#popup-menus');
@@ -118,7 +118,7 @@ export class DisplayAnki {
['addNoteKanji', () => { this._hotkeySaveAnkiNoteForSelectedEntry('kanji'); }],
['addNoteTermKanji', () => { this._hotkeySaveAnkiNoteForSelectedEntry('term-kanji'); }],
['addNoteTermKana', () => { this._hotkeySaveAnkiNoteForSelectedEntry('term-kana'); }],
- ['viewNotes', this._viewNotesForSelectedEntry.bind(this)]
+ ['viewNotes', this._viewNotesForSelectedEntry.bind(this)],
]);
/* eslint-enable @stylistic/no-multi-spaces */
this._display.on('optionsUpdated', this._onOptionsUpdated.bind(this));
@@ -146,7 +146,7 @@ export class DisplayAnki {
resultOutputMode: this._resultOutputMode,
glossaryLayoutMode: this._glossaryLayoutMode,
compactTags: this._compactTags,
- marker: 'test'
+ marker: 'test',
});
} catch (e) {
ankiNoteDataException = e;
@@ -179,7 +179,7 @@ export class DisplayAnki {
return {
ankiNoteData,
ankiNoteDataException: toError(ankiNoteDataException),
- ankiNotes
+ ankiNotes,
};
}
@@ -203,9 +203,9 @@ export class DisplayAnki {
terms,
noteGuiMode,
screenshot: {format, quality},
- downloadTimeout
+ downloadTimeout,
},
- scanning: {length: scanLength}
+ scanning: {length: scanLength},
} = options;
this._checkForDuplicates = checkForDuplicates;
@@ -345,7 +345,7 @@ export class DisplayAnki {
sentence,
documentTitle,
query,
- fullQuery
+ fullQuery,
};
}
@@ -762,7 +762,7 @@ export class DisplayAnki {
const results = [];
for (let i = 0, ii = dictionaryEntries.length; i < ii; ++i) {
results.push({
- modeMap: new Map()
+ modeMap: new Map(),
});
}
@@ -828,14 +828,14 @@ export class DisplayAnki {
screenshot: {
format: this._screenshotFormat,
quality: this._screenshotQuality,
- contentOrigin
+ contentOrigin,
},
textParsing: {
optionsContext,
- scanLength: this._scanLength
- }
+ scanLength: this._scanLength,
+ },
},
- requirements
+ requirements,
});
return {note, errors, requirements: outputRequirements};
}
diff --git a/ext/js/display/display-audio.js b/ext/js/display/display-audio.js
index d19a448c..c7e08ffe 100644
--- a/ext/js/display/display-audio.js
+++ b/ext/js/display/display-audio.js
@@ -60,7 +60,7 @@ export class DisplayAudio {
['text-to-speech', 'Text-to-speech'],
['text-to-speech-reading', 'Text-to-speech (Kana reading)'],
['custom', 'Custom URL'],
- ['custom-json', 'Custom URL (JSON)']
+ ['custom-json', 'Custom URL (JSON)'],
]);
/** @type {(event: MouseEvent) => void} */
this._onAudioPlayButtonClickBind = this._onAudioPlayButtonClick.bind(this);
@@ -85,10 +85,10 @@ export class DisplayAudio {
/* eslint-disable @stylistic/no-multi-spaces */
this._display.hotkeyHandler.registerActions([
['playAudio', this._onHotkeyActionPlayAudio.bind(this)],
- ['playAudioFromSource', this._onHotkeyActionPlayAudioFromSource.bind(this)]
+ ['playAudioFromSource', this._onHotkeyActionPlayAudioFromSource.bind(this)],
]);
this._display.registerDirectMessageHandlers([
- ['displayAudioClearAutoPlayTimer', this._onMessageClearAutoPlayTimer.bind(this)]
+ ['displayAudioClearAutoPlayTimer', this._onMessageClearAutoPlayTimer.bind(this)],
]);
/* eslint-enable @stylistic/no-multi-spaces */
this._display.on('optionsUpdated', this._onOptionsUpdated.bind(this));
@@ -172,7 +172,7 @@ export class DisplayAudio {
const requiredAudioSources = new Set([
'jpod101',
'jpod101-alternate',
- 'jisho'
+ 'jisho',
]);
/** @type {Map<string, import('display-audio').AudioSource[]>} */
const nameMap = new Map();
@@ -297,7 +297,7 @@ export class DisplayAudio {
downloadable,
name,
nameIndex,
- nameUnique: (nameIndex === 0)
+ nameUnique: (nameIndex === 0),
};
entries.push(source);
@@ -369,7 +369,7 @@ export class DisplayAudio {
if (typeof cacheEntry === 'undefined' && create) {
cacheEntry = {
sourceMap: new Map(),
- primaryCardAudio: null
+ primaryCardAudio: null,
};
this._cache.set(key, cacheEntry);
}
@@ -389,7 +389,7 @@ export class DisplayAudio {
if (indexNumber >= 0 && indexNumber < this._audioSources.length) {
return {
source: this._audioSources[indexNumber],
- subIndex: typeof subIndex === 'string' ? Number.parseInt(subIndex, 10) : null
+ subIndex: typeof subIndex === 'string' ? Number.parseInt(subIndex, 10) : null,
};
}
}
@@ -617,7 +617,7 @@ export class DisplayAudio {
const result = {
audio: null,
index: -1,
- cacheUpdated: false
+ cacheUpdated: false,
};
for (let i = start; i < end; ++i) {
const item = infoList[i];
diff --git a/ext/js/display/display-content-manager.js b/ext/js/display/display-content-manager.js
index 28fdc709..070ab81a 100644
--- a/ext/js/display/display-content-manager.js
+++ b/ext/js/display/display-content-manager.js
@@ -174,7 +174,7 @@ export class DisplayContentManager {
focus: false,
params,
state: null,
- content: null
+ content: null,
});
}
diff --git a/ext/js/display/display-generator.js b/ext/js/display/display-generator.js
index 2b0ceb58..6236f749 100644
--- a/ext/js/display/display-generator.js
+++ b/ext/js/display/display-generator.js
@@ -641,7 +641,7 @@ export class DisplayGenerator {
score: 0,
content: [],
dictionaries: [],
- redundant: false
+ redundant: false,
};
}
diff --git a/ext/js/display/display-history.js b/ext/js/display/display-history.js
index 0806e17b..b7ab602c 100644
--- a/ext/js/display/display-history.js
+++ b/ext/js/display/display-history.js
@@ -231,7 +231,7 @@ export class DisplayHistory extends EventDispatcher {
next: null,
previous,
state,
- content
+ content,
};
this._historyMap.set(entry.id, entry);
return entry;
diff --git a/ext/js/display/display-profile-selection.js b/ext/js/display/display-profile-selection.js
index 6fd25835..f8e18314 100644
--- a/ext/js/display/display-profile-selection.js
+++ b/ext/js/display/display-profile-selection.js
@@ -132,7 +132,7 @@ export class DisplayProfileSelection {
path: 'profileCurrent',
value: index,
scope: 'global',
- optionsContext: null
+ optionsContext: null,
};
await this._display.application.api.modifySettings([modification], this._source);
this._setProfilePanelVisible(false);
diff --git a/ext/js/display/display.js b/ext/js/display/display.js
index 988aa0ae..dc6b4713 100644
--- a/ext/js/display/display.js
+++ b/ext/js/display/display.js
@@ -200,7 +200,7 @@ export class Display extends EventDispatcher {
['profileNext', async () => { await this._setProfile(1); }],
['copyHostSelection', () => this._copyHostSelection()],
['nextEntryDifferentDictionary', () => { this._focusEntryWithDifferentDictionary(1, true); }],
- ['previousEntryDifferentDictionary', () => { this._focusEntryWithDifferentDictionary(-1, true); }]
+ ['previousEntryDifferentDictionary', () => { this._focusEntryWithDifferentDictionary(-1, true); }],
]);
this.registerDirectMessageHandlers([
['displaySetOptionsContext', this._onMessageSetOptionsContext.bind(this)],
@@ -208,10 +208,10 @@ export class Display extends EventDispatcher {
['displaySetCustomCss', this._onMessageSetCustomCss.bind(this)],
['displaySetContentScale', this._onMessageSetContentScale.bind(this)],
['displayConfigure', this._onMessageConfigure.bind(this)],
- ['displayVisibilityChanged', this._onMessageVisibilityChanged.bind(this)]
+ ['displayVisibilityChanged', this._onMessageVisibilityChanged.bind(this)],
]);
this.registerWindowMessageHandlers([
- ['displayExtensionUnloaded', this._onMessageExtensionUnloaded.bind(this)]
+ ['displayExtensionUnloaded', this._onMessageExtensionUnloaded.bind(this)],
]);
/* eslint-enable @stylistic/no-multi-spaces */
}
@@ -325,7 +325,7 @@ export class Display extends EventDispatcher {
this._application.on('extensionUnloaded', this._onExtensionUnloaded.bind(this));
this._application.crossFrame.registerHandlers([
['displayPopupMessage1', this._onDisplayPopupMessage1.bind(this)],
- ['displayPopupMessage2', this._onDisplayPopupMessage2.bind(this)]
+ ['displayPopupMessage2', this._onDisplayPopupMessage2.bind(this)],
]);
window.addEventListener('message', this._onWindowMessage.bind(this), false);
@@ -353,7 +353,7 @@ export class Display extends EventDispatcher {
getContentOrigin() {
return {
tabId: this._contentOriginTabId,
- frameId: this._contentOriginFrameId
+ frameId: this._contentOriginFrameId,
};
}
@@ -441,8 +441,8 @@ export class Display extends EventDispatcher {
layoutAwareScan: scanningOptions.layoutAwareScan,
preventMiddleMouse: scanningOptions.preventMiddleMouse.onSearchQuery,
matchTypePrefix: false,
- sentenceParsingOptions
- }
+ sentenceParsingOptions,
+ },
});
void this._updateNestedFrontend(options);
@@ -553,7 +553,7 @@ export class Display extends EventDispatcher {
optionsContext: void 0,
url: window.location.href,
sentence: {text: query, offset: 0},
- documentTitle: document.title
+ documentTitle: document.title,
}
);
if (!hasState || updateOptionsContext) {
@@ -566,8 +566,8 @@ export class Display extends EventDispatcher {
params: this._createSearchParams(type, query, false, this._queryOffset),
state: newState,
content: {
- contentOrigin: this.getContentOrigin()
- }
+ contentOrigin: this.getContentOrigin(),
+ },
};
this.setContent(details);
}
@@ -656,7 +656,7 @@ export class Display extends EventDispatcher {
},
() => {
reject(new Error(`Invalid action: ${action}`));
- }
+ },
);
});
}
@@ -810,12 +810,12 @@ export class Display extends EventDispatcher {
state: {
sentence,
optionsContext,
- cause: 'queryParser'
+ cause: 'queryParser',
},
content: {
dictionaryEntries,
- contentOrigin: this.getContentOrigin()
- }
+ contentOrigin: this.getContentOrigin(),
+ },
};
this.setContent(details);
}
@@ -832,8 +832,8 @@ export class Display extends EventDispatcher {
params: {type},
state: {},
content: {
- contentOrigin: {tabId, frameId}
- }
+ contentOrigin: {tabId, frameId},
+ },
};
this.setContent(details);
}
@@ -911,12 +911,12 @@ export class Display extends EventDispatcher {
optionsContext,
url,
sentence,
- documentTitle
+ documentTitle,
},
content: {
dictionaryEntries,
- contentOrigin: this.getContentOrigin()
- }
+ contentOrigin: this.getContentOrigin(),
+ },
};
this.setContent(details);
} catch (error) {
@@ -1703,7 +1703,7 @@ export class Display extends EventDispatcher {
const [{PopupFactory}, {Frontend}] = await Promise.all([
import('../app/popup-factory.js'),
- import('../app/frontend.js')
+ import('../app/frontend.js'),
]);
const popupFactory = new PopupFactory(this._application);
@@ -1720,7 +1720,7 @@ export class Display extends EventDispatcher {
allowRootFramePopupProxy: true,
childrenSupported: this._childrenSupported,
hotkeyHandler: this._hotkeyHandler,
- canUseWindowPopup: true
+ canUseWindowPopup: true,
});
this._frontend = frontend;
await frontend.prepare();
@@ -1827,7 +1827,7 @@ export class Display extends EventDispatcher {
searchKanji: false,
searchOnClick: true,
searchOnClickOnly: true,
- textSourceGenerator: this._textSourceGenerator
+ textSourceGenerator: this._textSourceGenerator,
});
this._contentTextScanner.includeSelector = '.click-scannable,.click-scannable *';
this._contentTextScanner.excludeSelector = '.scan-disable,.scan-disable *';
@@ -1857,8 +1857,8 @@ export class Display extends EventDispatcher {
scanOnPenPress: false,
scanOnPenRelease: false,
preventTouchScrolling: false,
- preventPenScrolling: false
- }
+ preventPenScrolling: false,
+ },
}],
deepContentScan: scanningOptions.deepDomScan,
normalizeCssZoom: scanningOptions.normalizeCssZoom,
@@ -1869,7 +1869,7 @@ export class Display extends EventDispatcher {
scanLength: scanningOptions.length,
layoutAwareScan: scanningOptions.layoutAwareScan,
preventMiddleMouse: false,
- sentenceParsingOptions
+ sentenceParsingOptions,
});
this._contentTextScanner.setEnabled(true);
@@ -1894,19 +1894,19 @@ export class Display extends EventDispatcher {
params: {
type,
query,
- wildcards: 'off'
+ wildcards: 'off',
},
state: {
focusEntry: 0,
optionsContext: optionsContext !== null ? optionsContext : void 0,
url,
sentence: sentence !== null ? sentence : void 0,
- documentTitle
+ documentTitle,
},
content: {
dictionaryEntries: dictionaryEntries !== null ? dictionaryEntries : void 0,
- contentOrigin: this.getContentOrigin()
- }
+ contentOrigin: this.getContentOrigin(),
+ },
};
/** @type {TextScanner} */ (this._contentTextScanner).clearSelection();
this.setContent(details);
@@ -1928,8 +1928,8 @@ export class Display extends EventDispatcher {
return {
optionsContext: this.getOptionsContext(),
detail: {
- documentTitle: document.title
- }
+ documentTitle: document.title,
+ },
};
}
@@ -2014,7 +2014,7 @@ export class Display extends EventDispatcher {
path: 'profileCurrent',
value: newProfile,
scope: 'global',
- optionsContext: null
+ optionsContext: null,
};
await this.application.api.modifySettings([modification], 'search');
}
diff --git a/ext/js/display/option-toggle-hotkey-handler.js b/ext/js/display/option-toggle-hotkey-handler.js
index cf2d31e4..f419b947 100644
--- a/ext/js/display/option-toggle-hotkey-handler.js
+++ b/ext/js/display/option-toggle-hotkey-handler.js
@@ -49,7 +49,7 @@ export class OptionToggleHotkeyHandler {
/** */
prepare() {
this._display.hotkeyHandler.registerActions([
- ['toggleOption', this._onHotkeyActionToggleOption.bind(this)]
+ ['toggleOption', this._onHotkeyActionToggleOption.bind(this)],
]);
}
@@ -74,7 +74,7 @@ export class OptionToggleHotkeyHandler {
const getSettingsResponse = (await this._display.application.api.getSettings([{
scope: 'profile',
path,
- optionsContext
+ optionsContext,
}]))[0];
const {error: getSettingsError} = getSettingsResponse;
if (typeof getSettingsError !== 'undefined') {
@@ -94,7 +94,7 @@ export class OptionToggleHotkeyHandler {
action: 'set',
path,
value,
- optionsContext
+ optionsContext,
};
const modifySettingsResponse = (await this._display.application.api.modifySettings([modification], this._source))[0];
const {error: modifySettingsError} = modifySettingsResponse;
diff --git a/ext/js/display/query-parser.js b/ext/js/display/query-parser.js
index ed10dab4..c53208ca 100644
--- a/ext/js/display/query-parser.js
+++ b/ext/js/display/query-parser.js
@@ -67,7 +67,7 @@ export class QueryParser extends EventDispatcher {
searchTerms: true,
searchKanji: false,
searchOnClick: true,
- textSourceGenerator
+ textSourceGenerator,
});
/** @type {?(import('../language/ja/japanese-wanakana.js'))} */
this._japaneseWanakanaModule = null;
@@ -164,7 +164,7 @@ export class QueryParser extends EventDispatcher {
inputInfo,
textSource,
optionsContext,
- sentenceOffset: this._getSentenceOffset(textSource)
+ sentenceOffset: this._getSentenceOffset(textSource),
});
}
@@ -210,7 +210,7 @@ export class QueryParser extends EventDispatcher {
path: 'parsing.selectedParser',
value,
scope: 'profile',
- optionsContext
+ optionsContext,
};
void this._api.modifySettings([modification], 'search');
}
diff --git a/ext/js/display/search-display-controller.js b/ext/js/display/search-display-controller.js
index 62dbf343..8dad19d7 100644
--- a/ext/js/display/search-display-controller.js
+++ b/ext/js/display/search-display-controller.js
@@ -67,7 +67,7 @@ export class SearchDisplayController {
this._clipboardMonitorEnabled = false;
/** @type {import('clipboard-monitor').ClipboardReaderLike} */
this._clipboardReaderLike = {
- getText: this._display.application.api.clipboardGet.bind(this._display.application.api)
+ getText: this._display.application.api.clipboardGet.bind(this._display.application.api),
};
/** @type {ClipboardMonitor} */
this._clipboardMonitor = new ClipboardMonitor(this._clipboardReaderLike);
@@ -75,7 +75,7 @@ export class SearchDisplayController {
this._apiMap = createApiMap([
['searchDisplayControllerGetMode', this._onMessageGetMode.bind(this)],
['searchDisplayControllerSetMode', this._onMessageSetMode.bind(this)],
- ['searchDisplayControllerUpdateSearchQuery', this._onExternalSearchUpdate.bind(this)]
+ ['searchDisplayControllerUpdateSearchQuery', this._onExternalSearchUpdate.bind(this)],
]);
}
@@ -92,7 +92,7 @@ export class SearchDisplayController {
this._display.on('contentUpdateStart', this._onContentUpdateStart.bind(this));
this._display.hotkeyHandler.registerActions([
- ['focusSearchBox', this._onActionFocusSearchBox.bind(this)]
+ ['focusSearchBox', this._onActionFocusSearchBox.bind(this)],
]);
this._updateClipboardMonitorEnabled();
@@ -317,7 +317,7 @@ export class SearchDisplayController {
path: 'general.enableWanakana',
value,
scope: 'profile',
- optionsContext: this._display.getOptionsContext()
+ optionsContext: this._display.getOptionsContext(),
};
void this._display.application.api.modifySettings([modification], 'search');
}
@@ -358,7 +358,7 @@ export class SearchDisplayController {
path: 'profileCurrent',
value,
scope: 'global',
- optionsContext: null
+ optionsContext: null,
};
await this._display.application.api.modifySettings([modification], 'search');
}
@@ -477,7 +477,7 @@ export class SearchDisplayController {
path: 'clipboard.enableSearchPageMonitor',
value,
scope: 'profile',
- optionsContext: this._display.getOptionsContext()
+ optionsContext: this._display.getOptionsContext(),
};
await this._display.application.api.modifySettings([modification], 'search');
}
@@ -516,7 +516,7 @@ export class SearchDisplayController {
(granted) => {
const e = chrome.runtime.lastError;
resolve(!e && granted);
- }
+ },
);
});
}
@@ -543,20 +543,20 @@ export class SearchDisplayController {
focus: false,
historyMode,
params: {
- query
+ query,
},
state: {
focusEntry: 0,
optionsContext,
url,
sentence: {text: query, offset: 0},
- documentTitle
+ documentTitle,
},
content: {
dictionaryEntries: void 0,
animate,
- contentOrigin: {tabId, frameId}
- }
+ contentOrigin: {tabId, frameId},
+ },
};
if (!lookup) { details.params.lookup = 'false'; }
this._display.setContent(details);
diff --git a/ext/js/display/structured-content-generator.js b/ext/js/display/structured-content-generator.js
index f3b0890e..7074243a 100644
--- a/ext/js/display/structured-content-generator.js
+++ b/ext/js/display/structured-content-generator.js
@@ -74,7 +74,7 @@ export class StructuredContentGenerator {
verticalAlign,
border,
borderRadius,
- sizeUnits
+ sizeUnits,
} = data;
const hasPreferredWidth = (typeof preferredWidth === 'number');
@@ -144,7 +144,7 @@ export class StructuredContentGenerator {
path,
dictionary,
(url) => this._setImageData(node, image, imageBackground, url, false),
- () => this._setImageData(node, image, imageBackground, null, true)
+ () => this._setImageData(node, image, imageBackground, null, true),
);
}
@@ -379,7 +379,7 @@ export class StructuredContentGenerator {
wordBreak,
whiteSpace,
cursor,
- listStyleType
+ listStyleType,
} = contentStyle;
if (typeof fontStyle === 'string') { style.fontStyle = fontStyle; }
if (typeof fontWeight === 'string') { style.fontWeight = fontWeight; }