From 4a43b41f79d46b8a677bbfb11c27d43e126e670f Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sat, 25 Jul 2020 09:58:06 -0400 Subject: Set content refactor (#686) * Simplify invoke * Pass isTerms instead of type * Update DisplaySearch.setContent to pass argument array * Simplify argument object structure for setContent * Move focus and disableHistory level * Always include focus and disableHistory options * Change disableHistory to history * Pass source text to setContent * Use consistent argument/object field order * Remove unused previous field * Combine logic for forward/back navigation --- ext/fg/js/frontend.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'ext/fg/js/frontend.js') diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js index 49cf4ca6..73cea841 100644 --- a/ext/fg/js/frontend.js +++ b/ext/fg/js/frontend.js @@ -426,12 +426,21 @@ class Frontend { this._showPopupContent( textSource, optionsContext, - type, - {definitions, context: {sentence, url, focus, disableHistory: true}} + { + focus, + history: false, + type, + source: textSource.text(), + definitions, + context: { + sentence, + url + } + } ); } - _showPopupContent(textSource, optionsContext, type=null, details=null) { + _showPopupContent(textSource, optionsContext, details=null) { this._lastShowPromise = this._popup.showContent( { source: this._id, @@ -439,10 +448,7 @@ class Frontend { elementRect: textSource.getRect(), writingMode: textSource.getWritingMode() }, - { - type, - details - } + details ); this._lastShowPromise.catch((error) => { if (yomichan.isExtensionUnloaded) { return; } -- cgit v1.2.3