summaryrefslogtreecommitdiff
path: root/ext/bg
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2017-02-26 10:38:48 -0800
committerAlex Yatskov <alex@foosoft.net>2017-02-26 10:38:48 -0800
commit6b7e094041142b02d83ab5d11acf30565d46ee6c (patch)
treecdf37f8d39f10aa2a75a467226d84fbf66a97491 /ext/bg
parent55dd9b1e6b06401e5a5f523fce1f3d6c1db4d9da (diff)
fix options versioning code, update usage guide
Diffstat (limited to 'ext/bg')
-rw-r--r--ext/bg/guide.html7
-rw-r--r--ext/bg/js/options.js16
2 files changed, 11 insertions, 12 deletions
diff --git a/ext/bg/guide.html b/ext/bg/guide.html
index 344a84ae..4b0835b8 100644
--- a/ext/bg/guide.html
+++ b/ext/bg/guide.html
@@ -23,11 +23,10 @@
</p>
<ol>
- <li>Left-click on the <img src="../img/icon16.png" alt> icon to enable or disable Yomichan for the current browser instance.</li>
- <li>Right-click on the <img src="../img/icon16.png" alt> icon and select <em>Options</em> to open the Yomichan options page.</li>
- <li>Import any dictionaries (bundled or custom) you wish to use for Kanji and term searches; none are imported by default.</li>
+ <li>Click on the <img src="../img/icon16.png" alt> icon in the browser toolbar to open the Yomichan options page.</li>
+ <li>Import the dictionaries (bundled or custom) you wish to use for term and Kanji searches.</li>
<li>Hold down <kbd>Shift</kbd> (or the middle mouse button) as you hover over text to see term definitions.</li>
- <li>Resize the definitions window by dragging the bottom-left corner inwards or outwards to make it smaller or larger.</li>
+ <li>Click on the <img src="../fg/img/play_audio.png" alt> icon to hear the term pronounced by a native speaker (if audio is available).</li>
<li>Click on Kanji in the definition window to view additional information about that character.</li>
</ol>
</div>
diff --git a/ext/bg/js/options.js b/ext/bg/js/options.js
index 127f0421..7a47c702 100644
--- a/ext/bg/js/options.js
+++ b/ext/bg/js/options.js
@@ -51,7 +51,7 @@ function optionsSetDefaults(options) {
const combine = (target, source) => {
for (const key in source) {
- if (!(key in target)) {
+ if (!target.hasOwnProperty(key)) {
target[key] = source[key];
}
}
@@ -69,9 +69,6 @@ function optionsSetDefaults(options) {
function optionsVersion(options) {
- optionsSetDefaults(options);
- options.version = options.version || 0;
-
const fixups = [
() => {
const copy = (targetDict, targetKey, sourceDict, sourceKey) => {
@@ -125,10 +122,13 @@ function optionsVersion(options) {
}
];
- if (options.version < fixups.length) {
- fixups[options.version]();
- ++options.version;
- optionsVersion(options);
+ optionsSetDefaults(options);
+ if (!options.hasOwnProperty('version')) {
+ options.version = fixups.length;
+ }
+
+ while (options.version < fixups.length) {
+ fixups[options.version++]();
}
return options;