FIX: If an audio file is playing, don't cloak it

This commit is contained in:
Robin Ward 2016-12-27 11:38:14 -05:00
parent 732d0ad030
commit 98eac4924c
1 changed files with 12 additions and 0 deletions

View File

@ -8,6 +8,18 @@ export default {
withPluginApi('0.1', api => { withPluginApi('0.1', api => {
api.decorateCooked(highlightSyntax); api.decorateCooked(highlightSyntax);
api.decorateCooked(lightbox); api.decorateCooked(lightbox);
api.decorateCooked($elem => {
const players = $('audio', $elem);
if (players.length) {
players.on('play', () => {
const postId = parseInt($elem.closest('article').data('post-id'));
if (postId) {
api.preventCloak(postId);
}
});
}
});
}); });
} }
}; };