From 6ea2eadba1281bcddb7c519946daaf35ec41aa56 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sun, 31 Aug 2014 17:15:31 -0700 Subject: [PATCH] Fix Mediacrush embedding bug. Network latency could cause videos to be embedded in already closed inlined quotes, which would play automatically and could not be closed. --- src/Linkification/Linkify.coffee | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Linkification/Linkify.coffee b/src/Linkification/Linkify.coffee index 7450c960e..70621bb81 100755 --- a/src/Linkification/Linkify.coffee +++ b/src/Linkification/Linkify.coffee @@ -163,7 +163,9 @@ Linkify = $.on embed, 'click', Linkify.cb.toggle $.after link, [$.tn(' '), embed] - Linkify.cb.toggle.call embed if Conf['Auto-embed'] and !post.isFetchedQuote + if Conf['Auto-embed'] and !post.isFetchedQuote + $.asap (-> doc.contains embed), -> + Linkify.cb.toggle.call embed title: (data) -> [key, uid, options, link, post] = data @@ -279,7 +281,8 @@ Linkify = style: 'border: 0;' el: (a) -> el = $.el 'div' - $.cache "https://mediacru.sh/#{a.dataset.uid}.json", -> + $.queueTask -> $.cache "https://mediacru.sh/#{a.dataset.uid}.json", -> + return unless doc.contains el {status} = @ return el.textContent = "ERROR #{status}" unless status in [200, 304] {files} = @response