Add playAudioFromSource hotkey (#1570)
This commit is contained in:
parent
1664cc75f1
commit
98994d0b65
@ -126,6 +126,7 @@ class Display extends EventDispatcher {
|
|||||||
['addNoteTermKana', () => { this._tryAddAnkiNoteForSelectedDefinition('term-kana'); }],
|
['addNoteTermKana', () => { this._tryAddAnkiNoteForSelectedDefinition('term-kana'); }],
|
||||||
['viewNote', () => { this._tryViewAnkiNoteForSelectedDefinition(); }],
|
['viewNote', () => { this._tryViewAnkiNoteForSelectedDefinition(); }],
|
||||||
['playAudio', () => { this._playAudioCurrent(); }],
|
['playAudio', () => { this._playAudioCurrent(); }],
|
||||||
|
['playAudioFromSource', this._onHotkeyActionPlayAudioFromSource.bind(this)],
|
||||||
['copyHostSelection', () => this._copyHostSelection()],
|
['copyHostSelection', () => this._copyHostSelection()],
|
||||||
['nextEntryDifferentDictionary', () => { this._focusEntryWithDifferentDictionary(1, true); }],
|
['nextEntryDifferentDictionary', () => { this._focusEntryWithDifferentDictionary(1, true); }],
|
||||||
['previousEntryDifferentDictionary', () => { this._focusEntryWithDifferentDictionary(-1, true); }]
|
['previousEntryDifferentDictionary', () => { this._focusEntryWithDifferentDictionary(-1, true); }]
|
||||||
@ -1830,6 +1831,10 @@ class Display extends EventDispatcher {
|
|||||||
this._focusEntry(this._index + count * sign, true);
|
this._focusEntry(this._index + count * sign, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_onHotkeyActionPlayAudioFromSource(source) {
|
||||||
|
this._displayAudio.playAudio(this._index, 0, [source]);
|
||||||
|
}
|
||||||
|
|
||||||
_closeAllPopupMenus() {
|
_closeAllPopupMenus() {
|
||||||
for (const popupMenu of PopupMenu.openMenus) {
|
for (const popupMenu of PopupMenu.openMenus) {
|
||||||
popupMenu.close();
|
popupMenu.close();
|
||||||
|
@ -48,6 +48,7 @@ class KeyboardShortcutController {
|
|||||||
['addNoteTermKana', {scopes: new Set(['popup', 'search'])}],
|
['addNoteTermKana', {scopes: new Set(['popup', 'search'])}],
|
||||||
['viewNote', {scopes: new Set(['popup', 'search'])}],
|
['viewNote', {scopes: new Set(['popup', 'search'])}],
|
||||||
['playAudio', {scopes: new Set(['popup', 'search'])}],
|
['playAudio', {scopes: new Set(['popup', 'search'])}],
|
||||||
|
['playAudioFromSource', {scopes: new Set(['popup', 'search']), argument: {template: 'hotkey-argument-audio-source', default: 'jpod101'}}],
|
||||||
['copyHostSelection', {scopes: new Set(['popup'])}],
|
['copyHostSelection', {scopes: new Set(['popup'])}],
|
||||||
['scanSelectedText', {scopes: new Set(['web'])}]
|
['scanSelectedText', {scopes: new Set(['web'])}]
|
||||||
]);
|
]);
|
||||||
|
@ -3169,6 +3169,7 @@
|
|||||||
<option value="addNoteTermKana">Add term note (reading)</option>
|
<option value="addNoteTermKana">Add term note (reading)</option>
|
||||||
<option value="viewNote">View note</option>
|
<option value="viewNote">View note</option>
|
||||||
<option value="playAudio">Play audio</option>
|
<option value="playAudio">Play audio</option>
|
||||||
|
<option value="playAudioFromSource">Play audio from source</option>
|
||||||
<option value="copyHostSelection">Copy host window selection</option>
|
<option value="copyHostSelection">Copy host window selection</option>
|
||||||
<option value="scanSelectedText">Scan selected text</option>
|
<option value="scanSelectedText">Scan selected text</option>
|
||||||
</select>
|
</select>
|
||||||
@ -3220,6 +3221,18 @@
|
|||||||
<input type="number" step="1" min="1" class="hotkey-argument-input">
|
<input type="number" step="1" min="1" class="hotkey-argument-input">
|
||||||
</div></template>
|
</div></template>
|
||||||
|
|
||||||
|
<template id="hotkey-argument-audio-source-template"><div class="flex-row-nowrap">
|
||||||
|
<span class="hotkey-argument-label">Source:</span>
|
||||||
|
<select class="audio-source-select hotkey-argument-input">
|
||||||
|
<option value="jpod101">JapanesePod101</option>
|
||||||
|
<option value="jpod101-alternate">JapanesePod101 (Alternate)</option>
|
||||||
|
<option value="jisho">Jisho.org</option>
|
||||||
|
<option value="text-to-speech">Text-to-speech</option>
|
||||||
|
<option value="text-to-speech-reading">Text-to-speech (Kana reading)</option>
|
||||||
|
<option value="custom">Custom</option>
|
||||||
|
</select>
|
||||||
|
</div></template>
|
||||||
|
|
||||||
|
|
||||||
<!-- Scripts -->
|
<!-- Scripts -->
|
||||||
<script src="/lib/jszip.min.js"></script>
|
<script src="/lib/jszip.min.js"></script>
|
||||||
|
Loading…
Reference in New Issue
Block a user