From 4629fb3639ec28e6c514b4a364b71e4192575b9b Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sat, 1 Feb 2020 15:00:34 -0500 Subject: Change no-undef from off to error --- ext/bg/js/handlebars.js | 1 + 1 file changed, 1 insertion(+) (limited to 'ext/bg/js/handlebars.js') diff --git a/ext/bg/js/handlebars.js b/ext/bg/js/handlebars.js index 62f89ee4..e8cb67eb 100644 --- a/ext/bg/js/handlebars.js +++ b/ext/bg/js/handlebars.js @@ -16,6 +16,7 @@ * along with this program. If not, see . */ +/*global jpIsCharCodeKanji, jpDistributeFurigana, Handlebars*/ function handlebarsEscape(text) { return Handlebars.Utils.escapeExpression(text); -- cgit v1.2.3 From e3c871bc004d9ca612d908f0f3848cdcfc286cd3 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Thu, 13 Feb 2020 20:18:15 -0500 Subject: Remove unused handlebarsRenderStatic --- ext/bg/js/api.js | 4 ++-- ext/bg/js/backend.js | 10 +++------- ext/bg/js/dictionary.js | 2 +- ext/bg/js/handlebars.js | 5 ----- ext/mixed/js/api.js | 4 ---- 5 files changed, 6 insertions(+), 19 deletions(-) (limited to 'ext/bg/js/handlebars.js') diff --git a/ext/bg/js/api.js b/ext/bg/js/api.js index cd6a9d18..4f1595c7 100644 --- a/ext/bg/js/api.js +++ b/ext/bg/js/api.js @@ -17,8 +17,8 @@ */ -function apiTemplateRender(template, data, dynamic) { - return _apiInvoke('templateRender', {data, template, dynamic}); +function apiTemplateRender(template, data) { + return _apiInvoke('templateRender', {data, template}); } function apiAudioGetUrl(definition, source, optionsContext) { diff --git a/ext/bg/js/backend.js b/ext/bg/js/backend.js index 7b2ec46d..da50bade 100644 --- a/ext/bg/js/backend.js +++ b/ext/bg/js/backend.js @@ -18,7 +18,7 @@ /*global optionsSave, utilIsolate conditionsTestValue, profileConditionsDescriptor, profileOptionsGetDefaultFieldTemplates -handlebarsRenderDynamic, handlebarsRenderStatic +handlebarsRenderDynamic requestText, requestJson, optionsLoad dictConfigured, dictTermsSort, dictEnabledSet, dictNoteFormat audioGetUrl, audioInject @@ -459,12 +459,8 @@ class Backend { return this.anki.guiBrowse(`nid:${noteId}`); } - async _onApiTemplateRender({template, data, dynamic}) { - return ( - dynamic ? - handlebarsRenderDynamic(template, data) : - handlebarsRenderStatic(template, data) - ); + async _onApiTemplateRender({template, data}) { + return handlebarsRenderDynamic(template, data); } async _onApiCommandExec({command, params}) { diff --git a/ext/bg/js/dictionary.js b/ext/bg/js/dictionary.js index e03dece0..491632a0 100644 --- a/ext/bg/js/dictionary.js +++ b/ext/bg/js/dictionary.js @@ -335,7 +335,7 @@ async function dictFieldFormat(field, definition, mode, options, templates, exce } data.marker = marker; try { - return await apiTemplateRender(templates, data, true); + return await apiTemplateRender(templates, data); } catch (e) { if (exceptions) { exceptions.push(e); } return `{${marker}-render-error}`; diff --git a/ext/bg/js/handlebars.js b/ext/bg/js/handlebars.js index e8cb67eb..b1443447 100644 --- a/ext/bg/js/handlebars.js +++ b/ext/bg/js/handlebars.js @@ -135,11 +135,6 @@ function handlebarsRegisterHelpers() { } } -function handlebarsRenderStatic(name, data) { - handlebarsRegisterHelpers(); - return Handlebars.templates[name](data).trim(); -} - function handlebarsRenderDynamic(template, data) { handlebarsRegisterHelpers(); const cache = handlebarsRenderDynamic._cache; diff --git a/ext/mixed/js/api.js b/ext/mixed/js/api.js index 0b1e7e4f..8eea0628 100644 --- a/ext/mixed/js/api.js +++ b/ext/mixed/js/api.js @@ -65,10 +65,6 @@ function apiNoteView(noteId) { return _apiInvoke('noteView', {noteId}); } -function apiTemplateRender(template, data, dynamic) { - return _apiInvoke('templateRender', {data, template, dynamic}); -} - function apiAudioGetUrl(definition, source, optionsContext) { return _apiInvoke('audioGetUrl', {definition, source, optionsContext}); } -- cgit v1.2.3