From ac406bdbf0d4b275ed8d1c48e29d0cb69e4d1800 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Tue, 23 May 2017 20:54:03 -0700 Subject: add debug info checkbox --- ext/bg/js/options.js | 2 ++ ext/bg/js/util.js | 1 + ext/bg/options.html | 4 ++++ 3 files changed, 7 insertions(+) (limited to 'ext/bg') diff --git a/ext/bg/js/options.js b/ext/bg/js/options.js index 1ea6ed68..1b675da2 100644 --- a/ext/bg/js/options.js +++ b/ext/bg/js/options.js @@ -30,6 +30,7 @@ function formRead() { optionsNew.general.audioVolume = $('#audio-playback-volume').val(); optionsNew.general.groupResults = $('#group-terms-results').prop('checked'); optionsNew.general.softKatakana = $('#soft-katakana-search').prop('checked'); + optionsNew.general.debugInfo = $('#show-debug-info').prop('checked'); optionsNew.general.showAdvanced = $('#show-advanced-options').prop('checked'); optionsNew.general.maxResults = parseInt($('#max-displayed-results').val(), 10); optionsNew.general.popupWidth = parseInt($('#popup-width').val(), 10); @@ -118,6 +119,7 @@ $(document).ready(() => { $('#audio-playback-volume').val(options.general.audioVolume); $('#group-terms-results').prop('checked', options.general.groupResults); $('#soft-katakana-search').prop('checked', options.general.softKatakana); + $('#show-debug-info').prop('checked', options.general.debugInfo); $('#show-advanced-options').prop('checked', options.general.showAdvanced); $('#max-displayed-results').val(options.general.maxResults); $('#popup-width').val(options.general.popupWidth); diff --git a/ext/bg/js/util.js b/ext/bg/js/util.js index 09337c63..74e1f49e 100644 --- a/ext/bg/js/util.js +++ b/ext/bg/js/util.js @@ -99,6 +99,7 @@ function optionsSetDefaults(options) { audioVolume: 100, groupResults: true, softKatakana: true, + debugInfo: false, maxResults: 32, showAdvanced: false, popupWidth: 400, diff --git a/ext/bg/options.html b/ext/bg/options.html index c3799b61..97dcd736 100644 --- a/ext/bg/options.html +++ b/ext/bg/options.html @@ -41,6 +41,10 @@ +
+ +
+
- +
diff --git a/ext/mixed/js/display.js b/ext/mixed/js/display.js index 0167c605..7982c69f 100644 --- a/ext/mixed/js/display.js +++ b/ext/mixed/js/display.js @@ -69,7 +69,8 @@ class Display { definitions, addable: options.anki.enable, grouped: options.general.groupResults, - playback: options.general.audioSource !== 'disabled' + playback: options.general.audioSource !== 'disabled', + debug: options.general.debugInfo }; if (context) { @@ -106,7 +107,8 @@ class Display { const params = { definitions, source: context && context.source, - addable: options.anki.enable + addable: options.anki.enable, + debug: options.general.debugInfo }; if (context) { diff --git a/tmpl/kanji.html b/tmpl/kanji.html index acd79036..a2f78aff 100644 --- a/tmpl/kanji.html +++ b/tmpl/kanji.html @@ -50,13 +50,17 @@
{{#multiLine}}{{glossary.[0]}}{{/multiLine}}
{{/if}} + + {{#if debug}} +
{{#dumpObject}}{{{.}}}{{/dumpObject}}
+ {{/if}} {{/inline}} {{#if definitions}} {{#each definitions}} {{#unless @first}}
{{/unless}} -{{> kanji addable=../addable source=../source root=../root}} +{{> kanji debug=../debug addable=../addable source=../source root=../root}} {{/each}} {{else}}

No results found.

diff --git a/tmpl/terms.html b/tmpl/terms.html index dc50efe2..80735974 100644 --- a/tmpl/terms.html +++ b/tmpl/terms.html @@ -59,13 +59,17 @@ {{> definition}} {{/if}} + + {{#if debug}} +
{{#dumpObject}}{{{.}}}{{/dumpObject}}
+ {{/if}} {{/inline}} {{#if definitions}} {{#each definitions}} {{#unless @first}}
{{/unless}} -{{> term grouped=../grouped addable=../addable playback=../playback}} +{{> term debug=../debug grouped=../grouped addable=../addable playback=../playback}} {{/each}} {{else}}

No results found.

-- cgit v1.2.3 From b2833891f9b5d0ceaebc26586b02120bacec68be Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Wed, 24 May 2017 19:03:45 -0700 Subject: fix incorrect deinflection --- ext/bg/lang/deinflect.json | 8 -------- 1 file changed, 8 deletions(-) (limited to 'ext/bg') diff --git a/ext/bg/lang/deinflect.json b/ext/bg/lang/deinflect.json index 532f8e62..7ee00b2f 100644 --- a/ext/bg/lang/deinflect.json +++ b/ext/bg/lang/deinflect.json @@ -959,14 +959,6 @@ "v5" ] }, - { - "kanaIn": "って", - "kanaOut": "く", - "rulesIn": [], - "rulesOut": [ - "v5" - ] - }, { "kanaIn": "って", "kanaOut": "つ", -- cgit v1.2.3 From 0efab9773d0cc6586eb4a1f271821795b6d07f5c Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Wed, 24 May 2017 19:13:56 -0700 Subject: options debugging code --- ext/bg/js/options.js | 9 +++++++++ ext/bg/js/util.js | 6 +++++- ext/bg/options.html | 3 +++ 3 files changed, 17 insertions(+), 1 deletion(-) (limited to 'ext/bg') diff --git a/ext/bg/js/options.js b/ext/bg/js/options.js index 1b675da2..4eafd9ef 100644 --- a/ext/bg/js/options.js +++ b/ext/bg/js/options.js @@ -86,6 +86,15 @@ function updateVisibility(options) { } else { advanced.hide(); } + + const debug = $('#debug'); + if (options.general.debugInfo) { + const text = JSON.stringify(options, null, 4); + debug.html(handlebarsEscape(text)); + debug.show(); + } else { + debug.hide(); + } } function onOptionsChanged(e) { diff --git a/ext/bg/js/util.js b/ext/bg/js/util.js index 64c79ab5..593e7d03 100644 --- a/ext/bg/js/util.js +++ b/ext/bg/js/util.js @@ -504,9 +504,13 @@ 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 Handlebars.Utils.escapeExpression(dump); + return handlebarsEscape(dump); } function handlebarsKanjiLinks(options) { diff --git a/ext/bg/options.html b/ext/bg/options.html index 434241e3..8281c317 100644 --- a/ext/bg/options.html +++ b/ext/bg/options.html @@ -8,6 +8,7 @@