mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-12-03 20:31:50 -05:00
18 lines
488 B
JavaScript
18 lines
488 B
JavaScript
import { withPluginApi } from 'discourse/lib/plugin-api';
|
|
|
|
export default {
|
|
name: "apply-lazyYT",
|
|
initialize() {
|
|
withPluginApi('0.1', api => {
|
|
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);
|
|
}
|
|
}
|
|
}));
|
|
});
|
|
}
|
|
};
|