diff options
Diffstat (limited to 'ext')
-rw-r--r-- | ext/bg/js/templates.js | 4 | ||||
-rw-r--r-- | ext/fg/img/play_audio.png (renamed from ext/fg/img/pronounce.png) | bin | 610 -> 610 bytes | |||
-rw-r--r-- | ext/fg/js/client.js | 10 | ||||
-rw-r--r-- | ext/fg/js/frame.js | 8 | ||||
-rw-r--r-- | ext/manifest.json | 2 |
5 files changed, 14 insertions, 10 deletions
diff --git a/ext/bg/js/templates.js b/ext/bg/js/templates.js index 11529eff..079389f2 100644 --- a/ext/bg/js/templates.js +++ b/ext/bg/js/templates.js @@ -104,11 +104,11 @@ templates['term.html'] = template({"1":function(container,depth0,helpers,partial },"2":function(container,depth0,helpers,partials,data,blockParams,depths) { var helper, alias1=container.escapeExpression; - return " <a href=\"#\" title=\"Pronounce\" class=\"action-pronounce\" data-index=\"" + return " <a href=\"#\" title=\"Play audio\" class=\"action-play-audio\" data-index=\"" + alias1(((helper = (helper = helpers.index || (data && data.index)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(depth0 != null ? depth0 : {},{"name":"index","hash":{},"data":data}) : helper))) + "\"><img src=\"" + alias1(container.lambda((depths[1] != null ? depths[1].root : depths[1]), depth0)) - + "/img/pronounce.png\"></a>\n"; + + "/img/play_audio.png\"></a>\n"; },"4":function(container,depth0,helpers,partials,data,blockParams,depths) { var helper, alias1=depth0 != null ? depth0 : {}, alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression, alias5=container.lambda; diff --git a/ext/fg/img/pronounce.png b/ext/fg/img/play_audio.png Binary files differindex 6056d234..6056d234 100644 --- a/ext/fg/img/pronounce.png +++ b/ext/fg/img/play_audio.png diff --git a/ext/fg/js/client.js b/ext/fg/js/client.js index 1f77ed95..10e8a0ae 100644 --- a/ext/fg/js/client.js +++ b/ext/fg/js/client.js @@ -168,9 +168,13 @@ class Client { }); } - api_pronounce(index) { - const dfn = this.definitions[index]; - const url = `http://assets.languagepod101.com/dictionary/japanese/audiomp3.php?kana=${dfn.reading}&kanji=${dfn.expression}`; + api_playAudio(index) { + const definition = this.definitions[index]; + + let url = `https://assets.languagepod101.com/dictionary/japanese/audiomp3.php?kanji=${definition.expression}`; + if (definition.reading) { + url += `&kana=${definition.reading}`; + } for (let key in this.audio) { this.audio[key].pause(); diff --git a/ext/fg/js/frame.js b/ext/fg/js/frame.js index 9c4b9318..165a9795 100644 --- a/ext/fg/js/frame.js +++ b/ext/fg/js/frame.js @@ -36,12 +36,12 @@ function registerAddNoteLinks() { } } -function registerPronounceLinks() { - for (let link of [].slice.call(document.getElementsByClassName('action-pronounce'))) { +function registerAudioLinks() { + for (let link of [].slice.call(document.getElementsByClassName('action-play-audio'))) { link.addEventListener('click', (e) => { e.preventDefault(); const ds = e.currentTarget.dataset; - window.parent.postMessage({action: 'pronounce', params: ds.index}, '*'); + window.parent.postMessage({action: 'playAudio', params: ds.index}, '*'); }); } } @@ -49,7 +49,7 @@ function registerPronounceLinks() { function onDomContentLoaded() { registerKanjiLinks(); registerAddNoteLinks(); - registerPronounceLinks(); + registerAudioLinks(); } function onMessage(e) { diff --git a/ext/manifest.json b/ext/manifest.json index 0c315fa4..5234ed5d 100644 --- a/ext/manifest.json +++ b/ext/manifest.json @@ -24,7 +24,7 @@ "fg/img/add_kanji.png", "fg/img/add_vocab_kana.png", "fg/img/add_vocab_kanji.png", - "fg/img/pronounce.png", + "fg/img/play_audio.png", "fg/js/frame.js", "fg/ttf/kanji-stroke-orders.ttf", "fg/ttf/vl-gothic-regular.ttf" |