mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-30 17:24:08 +00:00
fix: js undefined error (#1298)
* fix: js undefined error * [autofix.ci] apply automated fixes --------- Co-authored-by: YiFang Xiao <yifang.xiao@noreply.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
8ea4ef84d9
commit
fb85f68b21
|
@ -674,8 +674,8 @@ void ArticleRequest::bodyFinished()
|
|||
fmt::format_to( std::back_inserter( head ),
|
||||
FMT_COMPILE(
|
||||
R"( <div class="gdarticle {0} {1}" id="{2}"
|
||||
onClick="gdMakeArticleActive( '{3}', false );"
|
||||
onContextMenu="gdMakeArticleActive( '{3}', false );">)" ),
|
||||
onClick="if(typeof gdMakeArticleActive !='undefined') gdMakeArticleActive( '{3}', false );"
|
||||
onContextMenu="if(typeof gdMakeArticleActive !='undefined') gdMakeArticleActive( '{3}', false );">)" ),
|
||||
closePrevSpan ? "" : " gdactivearticle",
|
||||
collapse ? " gdcollapsedarticle" : "",
|
||||
gdFrom,
|
||||
|
|
|
@ -555,10 +555,11 @@ bool ArticleView::setCurrentArticle( QString const & id, bool moveToIt )
|
|||
QString dictId = id.mid( 7 );
|
||||
if ( dictId.isEmpty() )
|
||||
return false;
|
||||
QString script = QString(
|
||||
"var elem=document.getElementById('%1'); "
|
||||
"if(elem!=undefined){elem.scrollIntoView(true);} gdMakeArticleActive('%2',true);" )
|
||||
.arg( id, dictId );
|
||||
QString script =
|
||||
QString(
|
||||
"var elem=document.getElementById('%1'); "
|
||||
"if(elem!=undefined){elem.scrollIntoView(true);} if(typeof gdMakeArticleActive !='undefined') gdMakeArticleActive('%2',true);" )
|
||||
.arg( id, dictId );
|
||||
onJsActiveArticleChanged( id );
|
||||
webview->page()->runJavaScript( script );
|
||||
setActiveArticleId( dictId );
|
||||
|
|
Loading…
Reference in a new issue