aboutsummaryrefslogtreecommitdiff
path: root/ext/fg/js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/fg/js')
-rw-r--r--ext/fg/js/client.js10
-rw-r--r--ext/fg/js/frame.js8
2 files changed, 11 insertions, 7 deletions
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) {