mirror of
https://github.com/discourse/discourse.git
synced 2024-11-28 00:33:37 +08:00
FIX: If an audio file is playing, don't cloak it
This commit is contained in:
parent
732d0ad030
commit
98eac4924c
|
@ -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);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user