diff options
author | Alex Yatskov <alex@foosoft.net> | 2017-05-25 23:06:10 -0700 |
---|---|---|
committer | Alex Yatskov <alex@foosoft.net> | 2017-05-25 23:06:10 -0700 |
commit | 16baf9a400ac11a1c4f53ba6665db03a900511e0 (patch) | |
tree | 685096179093f112a9263f15d3cf081f50e9634d /ext/bg/js/util.js | |
parent | 1cdf496824709b4e4579d700c333e832d790925e (diff) | |
parent | 618a3cb319c247c7196b1b83389d5f43241ab0c6 (diff) |
Merge branch 'master' into firefox-amo
Diffstat (limited to 'ext/bg/js/util.js')
-rw-r--r-- | ext/bg/js/util.js | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/ext/bg/js/util.js b/ext/bg/js/util.js index 09337c63..75833871 100644 --- a/ext/bg/js/util.js +++ b/ext/bg/js/util.js @@ -98,7 +98,7 @@ function optionsSetDefaults(options) { audioSource: 'jpod101', audioVolume: 100, groupResults: true, - softKatakana: true, + debugInfo: false, maxResults: 32, showAdvanced: false, popupWidth: 400, @@ -108,13 +108,12 @@ function optionsSetDefaults(options) { }, scanning: { - requireShift: true, middleMouse: true, selectText: true, - imposter: true, alphanumeric: true, delay: 15, - length: 10 + length: 10, + modifier: 'shift' }, dictionaries: {}, @@ -150,10 +149,10 @@ function optionsSetDefaults(options) { function optionsVersion(options) { const fixups = [ - () => { }, - () => { }, - () => { }, - () => { }, + () => {}, + () => {}, + () => {}, + () => {}, () => { if (options.general.audioPlayback) { options.general.audioSource = 'jpod101'; @@ -163,6 +162,13 @@ function optionsVersion(options) { }, () => { options.general.showGuide = false; + }, + () => { + if (options.scanning.requireShift) { + options.scanning.modifier = 'shift'; + } else { + options.scanning.modifier = 'none'; + } } ]; @@ -503,6 +509,15 @@ function jsonLoadDb(indexUrl, indexLoaded, termsLoaded, kanjiLoaded) { * Helpers */ +function handlebarsEscape(text) { + return Handlebars.Utils.escapeExpression(text); +} + +function handlebarsDumpObject(options) { + const dump = JSON.stringify(options.fn(this), null, 4); + return handlebarsEscape(dump); +} + function handlebarsKanjiLinks(options) { let result = ''; for (const c of options.fn(this)) { @@ -522,6 +537,7 @@ function handlebarsMultiLine(options) { function handlebarsRegister() { Handlebars.partials = Handlebars.templates; + Handlebars.registerHelper('dumpObject', handlebarsDumpObject); Handlebars.registerHelper('kanjiLinks', handlebarsKanjiLinks); Handlebars.registerHelper('multiLine', handlebarsMultiLine); } |