From 83a6c30d0e68496bc7592b3adfa91ae536a487e1 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Sat, 25 Mar 2017 12:01:20 -0700 Subject: audio improvements --- ext/mixed/js/util.js | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'ext/mixed/js') diff --git a/ext/mixed/js/util.js b/ext/mixed/js/util.js index 1289455c..4ce60e4f 100644 --- a/ext/mixed/js/util.js +++ b/ext/mixed/js/util.js @@ -85,25 +85,20 @@ function audioInject(definition, fields) { return Promise.resolve(true); } - const audio = { - filename, - skipHash: '7e2c2f954ef6051373ba916f000168dc', - fields: [] - }; - + let usesAudio = false; for (const name in fields) { if (fields[name].includes('{audio}')) { - audio.fields.push(name); + usesAudio = true; + break; } } - if (audio.fields.length === 0) { + if (!usesAudio) { return Promise.resolve(true); } return audioBuildUrl(definition).then(url => { - audio.url = url; - note.audio = audio; + definition.audio = {url, filename}; return true; }).catch(() => false); } -- cgit v1.2.3