Rename lazyYT plugin directory name to lazy-yt

This commit is contained in:
Arpit Jalan
2019-08-21 14:32:55 +05:30
parent cc7b24b88b
commit 75f37ac16a
9 changed files with 4 additions and 4 deletions

View File

@ -0,0 +1,28 @@
import { withPluginApi } from "discourse/lib/plugin-api";
export default {
name: "apply-lazyYT",
initialize() {
withPluginApi("0.1", api => {
api.decorateCooked(
$elem => {
const iframes = $(".lazyYT", $elem);
if (iframes.length === 0) {
return;
}
$(".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);
}
}
});
},
{ id: "discourse-lazyyt" }
);
});
}
};