FIX: Don't cloak videos once they begin playing

This commit is contained in:
Robin Ward
2016-02-29 13:56:38 -05:00
parent 01e1bb53f1
commit d538bcbe40
4 changed files with 40 additions and 4 deletions

View File

@ -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);
}
}
}));
});
}
};