Skip to content

Commit

Permalink
fix(dicts): fix camberidge audio
Browse files Browse the repository at this point in the history
Closes #192
  • Loading branch information
crimx committed Aug 30, 2018
1 parent 5d7660b commit f4c48b2
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/components/dictionaries/cambridge/engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,16 @@ function handleDOM (
const $btn = $pron.querySelector<HTMLSpanElement>('.audio_play_button')
if ($btn) {
if ($btn.dataset.srcMp3) {
const mp3 = $btn.dataset.srcMp3.replace(/^\//, 'https://dictionary.cambridge.org/')
entry.prons.push({
phsym: getText($pron),
pron: mp3,
})

if (!audio.uk && $btn.classList.contains('uk')) {
audio.uk = mp3
const pron = $btn.dataset.srcMp3.replace(/^\//, 'https://dictionary.cambridge.org/')
const phsym = getText($pron)
entry.prons.push({ phsym, pron })

if (!audio.uk && phsym.includes('uk')) {
audio.uk = pron
}

if (!audio.us && $btn.classList.contains('us')) {
audio.us = mp3
if (!audio.us && phsym.includes('us')) {
audio.us = pron
}
}
}
Expand Down

0 comments on commit f4c48b2

Please sign in to comment.