forked from goldendict/goldendict
-
Notifications
You must be signed in to change notification settings - Fork 0
/
audiolink.cc
22 lines (19 loc) · 897 Bytes
/
audiolink.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* This file is (c) 2008-2012 Konstantin Isakov <[email protected]>
* Part of GoldenDict. Licensed under GPLv3 or later, see the LICENSE file */
#include "audiolink.hh"
std::string addAudioLink( std::string const & url,
std::string const & dictionaryId )
{
return std::string( "<script language=\"JavaScript\">" +
makeAudioLinkScript( url, dictionaryId ) +
"</script>" );
}
std::string makeAudioLinkScript( std::string const & url,
std::string const & dictionaryId )
{
return std::string( "var gdAudioLink; "
"if ( !gdAudioLink ) gdAudioLink=" ) + url +
"; if ( typeof gdActivateAudioLink_" + dictionaryId + " != 'function' ) {"
"eval( 'function gdActivateAudioLink_" + dictionaryId + "() {"
"gdAudioLink=" + url + "; }' ); }";
}