Rename normalizeAudioUrl to audioUrlNormalize

This commit is contained in:
toasted-nutbread 2019-02-20 21:16:40 -05:00
parent b58b91d3fc
commit ee5e47251e

View File

@ -72,7 +72,7 @@ async function audioBuildUrl(definition, mode, cache={}) {
const url = row.querySelector('audio>source[src]').getAttribute('src'); const url = row.querySelector('audio>source[src]').getAttribute('src');
const reading = row.getElementsByClassName('dc-vocab_kana').item(0).innerText; const reading = row.getElementsByClassName('dc-vocab_kana').item(0).innerText;
if (url && reading && (!definition.reading || definition.reading === reading)) { if (url && reading && (!definition.reading || definition.reading === reading)) {
return normalizeAudioUrl(url, 'https://www.japanesepod101.com', '/learningcenter/reference/'); return audioUrlNormalize(url, 'https://www.japanesepod101.com', '/learningcenter/reference/');
} }
} catch (e) { } catch (e) {
// NOP // NOP
@ -102,7 +102,7 @@ async function audioBuildUrl(definition, mode, cache={}) {
if (audio) { if (audio) {
const url = audio.getElementsByTagName('source').item(0).getAttribute('src'); const url = audio.getElementsByTagName('source').item(0).getAttribute('src');
if (url) { if (url) {
return normalizeAudioUrl(url, 'https://jisho.org', '/search/'); return audioUrlNormalize(url, 'https://jisho.org', '/search/');
} }
} }
} catch (e) { } catch (e) {
@ -115,7 +115,7 @@ async function audioBuildUrl(definition, mode, cache={}) {
} }
} }
function normalizeAudioUrl(url, baseUrl, basePath) { function audioUrlNormalize(url, baseUrl, basePath) {
if (url) { if (url) {
if (url[0] === '/') { if (url[0] === '/') {
if (url.length >= 2 && url[1] === '/') { if (url.length >= 2 && url[1] === '/') {