mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 19:24:08 +00:00
Merge pull request #76 from xiaoyifang/golden-master
merge upstream changes
This commit is contained in:
commit
4096362183
|
@ -652,18 +652,18 @@ void ArticleView::jumpToDictionary( QString const & id, bool force )
|
|||
}
|
||||
}
|
||||
|
||||
void ArticleView::setCurrentArticle( QString const & id, bool moveToIt )
|
||||
bool ArticleView::setCurrentArticle( QString const & id, bool moveToIt )
|
||||
{
|
||||
if ( !isScrollTo( id ) )
|
||||
return; // Incorrect id
|
||||
return false; // Incorrect id
|
||||
|
||||
if ( !ui.definition->isVisible() )
|
||||
return; // No action on background page, scrollIntoView there don't work
|
||||
return false; // No action on background page, scrollIntoView there don't work
|
||||
|
||||
if(moveToIt){
|
||||
QString dictId = id.mid( 7 );
|
||||
if( dictId.isEmpty() )
|
||||
return;
|
||||
return false;
|
||||
QString script = QString( "var elem=document.getElementById('%1'); "
|
||||
"if(elem!=undefined){elem.scrollIntoView(true);} gdMakeArticleActive('%2',true);" )
|
||||
.arg( id, dictId );
|
||||
|
@ -671,6 +671,7 @@ void ArticleView::setCurrentArticle( QString const & id, bool moveToIt )
|
|||
ui.definition->page()->runJavaScript( script );
|
||||
setActiveArticleId( dictId );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void ArticleView::selectCurrentArticle()
|
||||
|
|
|
@ -364,7 +364,8 @@ private:
|
|||
|
||||
/// Sets the current article by executing a javascript code.
|
||||
/// If moveToIt is true, it moves the focus to it as well.
|
||||
void setCurrentArticle( QString const &, bool moveToIt = false );
|
||||
/// Returns true in case of success, false otherwise.
|
||||
bool setCurrentArticle( QString const &, bool moveToIt = false );
|
||||
|
||||
/// Checks if the given article in form of "gdfrom-xxx" is inside a "website"
|
||||
/// frame.
|
||||
|
|
Loading…
Reference in a new issue