From 6b7e094041142b02d83ab5d11acf30565d46ee6c Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Sun, 26 Feb 2017 10:38:48 -0800 Subject: fix options versioning code, update usage guide --- ext/bg/guide.html | 7 +++---- ext/bg/js/options.js | 16 ++++++++-------- 2 files changed, 11 insertions(+), 12 deletions(-) (limited to 'ext') 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 @@

    -
  1. Left-click on the icon to enable or disable Yomichan for the current browser instance.
  2. -
  3. Right-click on the icon and select Options to open the Yomichan options page.
  4. -
  5. Import any dictionaries (bundled or custom) you wish to use for Kanji and term searches; none are imported by default.
  6. +
  7. Click on the icon in the browser toolbar to open the Yomichan options page.
  8. +
  9. Import the dictionaries (bundled or custom) you wish to use for term and Kanji searches.
  10. Hold down Shift (or the middle mouse button) as you hover over text to see term definitions.
  11. -
  12. Resize the definitions window by dragging the bottom-left corner inwards or outwards to make it smaller or larger.
  13. +
  14. Click on the icon to hear the term pronounced by a native speaker (if audio is available).
  15. Click on Kanji in the definition window to view additional information about that character.
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; -- cgit v1.2.3