mirror of
https://github.com/discourse/discourse.git
synced 2025-05-29 11:48:08 +08:00
FIX: Don't cloak videos once they begin playing
This commit is contained in:
@ -4,7 +4,15 @@ export default {
|
||||
name: "apply-lazyYT",
|
||||
initialize() {
|
||||
withPluginApi('0.1', api => {
|
||||
api.decorateCooked($elem => $('.lazyYT', $elem).lazyYT());
|
||||
api.decorateCooked($elem => $('.lazyYT', $elem).lazyYT({
|
||||
onPlay(e, $el) {
|
||||
// don't cloak posts that have playing videos in them
|
||||
const postId = parseInt($el.closest('article').data('post-id'));
|
||||
if (postId) {
|
||||
api.preventCloak(postId);
|
||||
}
|
||||
}
|
||||
}));
|
||||
});
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user