From a1aeedde53359a5b7224d8705e05f66131bb4334 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan Date: Thu, 5 Jan 2017 12:06:07 +0800 Subject: [PATCH] FIX: Text selection disappearing when lazyYT is applied. --- .../javascripts/initializers/lazyYT.js.es6 | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/plugins/lazyYT/assets/javascripts/initializers/lazyYT.js.es6 b/plugins/lazyYT/assets/javascripts/initializers/lazyYT.js.es6 index b05cf205393..21037618f79 100644 --- a/plugins/lazyYT/assets/javascripts/initializers/lazyYT.js.es6 +++ b/plugins/lazyYT/assets/javascripts/initializers/lazyYT.js.es6 @@ -11,14 +11,6 @@ export default { const iframes = $('.lazyYT', $elem); if (iframes.length === 0) { return; } - // We use this because watching videos fullscreen in Chrome was super buggy - // otherwise. Thanks to arrendek from q23 for the technique. - $elem.iframeTracker({ blurCallback: () => { - $(document).on("scroll.discourse-youtube", returnFalse); - window.setTimeout(() => $(document).off('scroll.discourse-youtube', returnFalse), 1500); - $(document).scroll(); - }}); - $('.lazyYT', $elem).lazyYT({ onPlay(e, $el) { // don't cloak posts that have playing videos in them @@ -26,6 +18,14 @@ export default { if (postId) { api.preventCloak(postId); } + + // We use this because watching videos fullscreen in Chrome was super buggy + // otherwise. Thanks to arrendek from q23 for the technique. + $('iframe', iframes).iframeTracker({ blurCallback: () => { + $(document).on("scroll.discourse-youtube", returnFalse); + window.setTimeout(() => $(document).off('scroll.discourse-youtube', returnFalse), 1500); + $(document).scroll(); + }}); } });