Merge branch 'master' into firefox-amo
This commit is contained in:
commit
681470db67
@ -26,6 +26,7 @@ function formRead() {
|
|||||||
const optionsNew = $.extend(true, {}, optionsOld);
|
const optionsNew = $.extend(true, {}, optionsOld);
|
||||||
|
|
||||||
optionsNew.general.audioPlayback = $('#audio-playback-buttons').prop('checked');
|
optionsNew.general.audioPlayback = $('#audio-playback-buttons').prop('checked');
|
||||||
|
optionsNew.general.audioVolume = $('#audio-playback-volume').val();
|
||||||
optionsNew.general.groupResults = $('#group-terms-results').prop('checked');
|
optionsNew.general.groupResults = $('#group-terms-results').prop('checked');
|
||||||
optionsNew.general.softKatakana = $('#soft-katakana-search').prop('checked');
|
optionsNew.general.softKatakana = $('#soft-katakana-search').prop('checked');
|
||||||
optionsNew.general.showAdvanced = $('#show-advanced-options').prop('checked');
|
optionsNew.general.showAdvanced = $('#show-advanced-options').prop('checked');
|
||||||
@ -111,6 +112,7 @@ $(document).ready(() => {
|
|||||||
|
|
||||||
optionsLoad().then(options => {
|
optionsLoad().then(options => {
|
||||||
$('#audio-playback-buttons').prop('checked', options.general.audioPlayback);
|
$('#audio-playback-buttons').prop('checked', options.general.audioPlayback);
|
||||||
|
$('#audio-playback-volume').val(options.general.audioVolume);
|
||||||
$('#group-terms-results').prop('checked', options.general.groupResults);
|
$('#group-terms-results').prop('checked', options.general.groupResults);
|
||||||
$('#soft-katakana-search').prop('checked', options.general.softKatakana);
|
$('#soft-katakana-search').prop('checked', options.general.softKatakana);
|
||||||
$('#show-advanced-options').prop('checked', options.general.showAdvanced);
|
$('#show-advanced-options').prop('checked', options.general.showAdvanced);
|
||||||
|
@ -85,6 +85,7 @@ function optionsSetDefaults(options) {
|
|||||||
general: {
|
general: {
|
||||||
enable: true,
|
enable: true,
|
||||||
audioPlayback: true,
|
audioPlayback: true,
|
||||||
|
audioVolume: 100,
|
||||||
groupResults: true,
|
groupResults: true,
|
||||||
softKatakana: true,
|
softKatakana: true,
|
||||||
maxResults: 32,
|
maxResults: 32,
|
||||||
@ -375,7 +376,7 @@ function dictTermsGroup(definitions, dictionaries) {
|
|||||||
expression: firstDef.expression,
|
expression: firstDef.expression,
|
||||||
reading: firstDef.reading,
|
reading: firstDef.reading,
|
||||||
reasons: firstDef.reasons,
|
reasons: firstDef.reasons,
|
||||||
score: groupDefs.reduce((x, y) => x.score > y.score ? x.score : y.score, Number.MIN_SAFE_INTEGER),
|
score: groupDefs.reduce((p, v) => v.score > p ? v.score : p, Number.MIN_SAFE_INTEGER),
|
||||||
source: firstDef.source
|
source: firstDef.source
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -25,10 +25,6 @@
|
|||||||
<div>
|
<div>
|
||||||
<h3>General Options</h3>
|
<h3>General Options</h3>
|
||||||
|
|
||||||
<div class="checkbox">
|
|
||||||
<label><input type="checkbox" id="audio-playback-buttons"> Audio playback buttons</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="checkbox">
|
<div class="checkbox">
|
||||||
<label><input type="checkbox" id="group-terms-results"> Group term results</label>
|
<label><input type="checkbox" id="group-terms-results"> Group term results</label>
|
||||||
</div>
|
</div>
|
||||||
@ -41,6 +37,15 @@
|
|||||||
<label><input type="checkbox" id="soft-katakana-search"> Soft Katakana search</label>
|
<label><input type="checkbox" id="soft-katakana-search"> Soft Katakana search</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="checkbox">
|
||||||
|
<label><input type="checkbox" id="audio-playback-buttons"> Audio playback buttons</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-group options-advanced">
|
||||||
|
<label for="audio-playback-volume">Audio playback volume (percent)</label>
|
||||||
|
<input type="number" min="0" max="100" id="audio-playback-volume" class="form-control">
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group options-advanced">
|
<div class="form-group options-advanced">
|
||||||
<label for="max-displayed-results">Maximum displayed results</label>
|
<label for="max-displayed-results">Maximum displayed results</label>
|
||||||
<input type="number" min="1" id="max-displayed-results" class="form-control">
|
<input type="number" min="1" id="max-displayed-results" class="form-control">
|
||||||
|
@ -51,6 +51,10 @@ window.displayFrame = new class extends Display {
|
|||||||
window.parent.postMessage('popupClose', '*');
|
window.parent.postMessage('popupClose', '*');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
selectionCopy() {
|
||||||
|
window.parent.postMessage('selectionCopy', '*');
|
||||||
|
}
|
||||||
|
|
||||||
showOrphaned() {
|
showOrphaned() {
|
||||||
$('#content').hide();
|
$('#content').hide();
|
||||||
$('#orphan').show();
|
$('#orphan').show();
|
||||||
@ -77,4 +81,22 @@ window.displayFrame = new class extends Display {
|
|||||||
handler(params);
|
handler(params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onKeyDown(e) {
|
||||||
|
const handlers = {
|
||||||
|
67: /* c */ () => {
|
||||||
|
if (e.ctrlKey && window.getSelection().toString() === '') {
|
||||||
|
this.selectionCopy();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handler = handlers[e.keyCode];
|
||||||
|
if (handler && handler()) {
|
||||||
|
e.preventDefault();
|
||||||
|
} else {
|
||||||
|
super.onKeyDown(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
@ -106,6 +106,10 @@ window.driver = new class {
|
|||||||
const handlers = {
|
const handlers = {
|
||||||
popupClose: () => {
|
popupClose: () => {
|
||||||
this.searchClear();
|
this.searchClear();
|
||||||
|
},
|
||||||
|
|
||||||
|
selectionCopy: () => {
|
||||||
|
document.execCommand('copy');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"name": "Yomichan",
|
"name": "Yomichan",
|
||||||
"version": "1.1.9",
|
"version": "1.1.10",
|
||||||
|
|
||||||
"description": "Japanese dictionary with Anki integration",
|
"description": "Japanese dictionary with Anki integration",
|
||||||
"icons": {"16": "mixed/img/icon16.png", "48": "mixed/img/icon48.png", "128": "mixed/img/icon128.png"},
|
"icons": {"16": "mixed/img/icon16.png", "48": "mixed/img/icon48.png", "128": "mixed/img/icon128.png"},
|
||||||
@ -29,7 +29,8 @@
|
|||||||
},
|
},
|
||||||
"permissions": [
|
"permissions": [
|
||||||
"<all_urls>",
|
"<all_urls>",
|
||||||
"storage"
|
"storage",
|
||||||
|
"clipboardWrite"
|
||||||
],
|
],
|
||||||
"commands": {
|
"commands": {
|
||||||
"toggle": {
|
"toggle": {
|
||||||
|
@ -343,6 +343,7 @@ class Display {
|
|||||||
let audio = this.audioCache[url];
|
let audio = this.audioCache[url];
|
||||||
if (audio) {
|
if (audio) {
|
||||||
audio.currentTime = 0;
|
audio.currentTime = 0;
|
||||||
|
audio.volume = this.options.general.audioVolume / 100.0;
|
||||||
audio.play();
|
audio.play();
|
||||||
} else {
|
} else {
|
||||||
audio = new Audio(url);
|
audio = new Audio(url);
|
||||||
@ -352,6 +353,7 @@ class Display {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.audioCache[url] = audio;
|
this.audioCache[url] = audio;
|
||||||
|
audio.volume = this.options.general.audioVolume / 100.0;
|
||||||
audio.play();
|
audio.play();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user