mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-24 08:34:08 +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 );
|
string jsVal = Html::escapeForJavaScript( dictId );
|
||||||
head += "<script type=\"text/javascript\">var gdArticleContents; "
|
head += "<script type=\"text/javascript\">var gdArticleContents; "
|
||||||
"if ( !gdArticleContents ) gdArticleContents = \"" + jsVal +" \"; "
|
"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" ) +
|
head += string( "<div class=\"gdarticle" ) +
|
||||||
( closePrevSpan ? "" : " gdactivearticle" ) +
|
( closePrevSpan ? "" : " gdactivearticle" ) +
|
||||||
|
|
|
@ -1700,8 +1700,6 @@ void ArticleView::playSound()
|
||||||
" } "
|
" } "
|
||||||
" "
|
" "
|
||||||
" var music = new Audio(link); "
|
" var music = new Audio(link); "
|
||||||
" music.muted=true; "
|
|
||||||
|
|
||||||
" music.play(); "
|
" music.play(); "
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
5
dsl.cc
5
dsl.cc
|
@ -906,8 +906,9 @@ string DslDictionary::nodeToHtml( ArticleDom::Node const & node )
|
||||||
|
|
||||||
result += addAudioLink( ref, getId() );
|
result += addAudioLink( ref, getId() );
|
||||||
|
|
||||||
result += "<span class=\"dsl_s_wav\"><a href=" + ref
|
string surl=url.toEncoded().data();
|
||||||
+ "><img src=\"qrcx://localhost/icons/playsound.png\" border=\"0\" align=\"absmiddle\" alt=\"Play\"/></a></span>";
|
|
||||||
|
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
|
else
|
||||||
if ( Filetype::isNameOfPicture( filename ) )
|
if ( Filetype::isNameOfPicture( filename ) )
|
||||||
|
|
Loading…
Reference in a new issue