mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 23:34:06 +00:00
play sound in the dictionary html
This commit is contained in:
parent
bec982c51e
commit
bf2640bb25
|
@ -668,11 +668,16 @@ void ArticleRequest::bodyFinished()
|
|||
}
|
||||
}
|
||||
|
||||
//todo ,gdArticleContents应该可以用类变量保存。
|
||||
//todo ,gdArticleContents need refractor in the future?
|
||||
string jsVal = Html::escapeForJavaScript( dictId );
|
||||
head += "<script type=\"text/javascript\">var gdArticleContents; "
|
||||
"if ( !gdArticleContents ) gdArticleContents = \"" + jsVal +" \"; "
|
||||
"else gdArticleContents += \"" + jsVal + " \";</script>";
|
||||
"else gdArticleContents += \"" + jsVal + " \";"
|
||||
"function playSound(sound){"
|
||||
" var a=new Audio(sound);"
|
||||
" a.play();"
|
||||
"}"
|
||||
"</script>";
|
||||
|
||||
head += string( "<div class=\"gdarticle" ) +
|
||||
( closePrevSpan ? "" : " gdactivearticle" ) +
|
||||
|
|
|
@ -1700,8 +1700,6 @@ void ArticleView::playSound()
|
|||
" } "
|
||||
" "
|
||||
" var music = new Audio(link); "
|
||||
" music.muted=true; "
|
||||
|
||||
" music.play(); "
|
||||
|
||||
);
|
||||
|
|
5
dsl.cc
5
dsl.cc
|
@ -906,8 +906,9 @@ string DslDictionary::nodeToHtml( ArticleDom::Node const & node )
|
|||
|
||||
result += addAudioLink( ref, getId() );
|
||||
|
||||
result += "<span class=\"dsl_s_wav\"><a href=" + ref
|
||||
+ "><img src=\"qrcx://localhost/icons/playsound.png\" border=\"0\" align=\"absmiddle\" alt=\"Play\"/></a></span>";
|
||||
string surl=url.toEncoded().data();
|
||||
|
||||
result += "<span class=\"dsl_s_wav\"><a onclick=\"playSound('"+surl+"')\" href= \"javascript:void(0)\" ><img src=\"qrcx://localhost/icons/playsound.png\" border=\"0\" align=\"absmiddle\" alt=\"Play\"/></a></span>";
|
||||
}
|
||||
else
|
||||
if ( Filetype::isNameOfPicture( filename ) )
|
||||
|
|
Loading…
Reference in a new issue