From 9745dcc7071155462d38d848e072de17919f3e61 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sat, 26 Nov 2016 02:08:33 -0800 Subject: [PATCH] Fix iframes from Embedding being reloaded when switching to catalog. --- src/General/Index.coffee | 2 ++ src/Linkification/Embedding.coffee | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/src/General/Index.coffee b/src/General/Index.coffee index caf926936..c2827e209 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -11,6 +11,8 @@ Index = return unless Conf['JSON Index'] + @enabled = true + Callbacks.Post.push name: 'Index Page Numbers' cb: @node diff --git a/src/Linkification/Embedding.coffee b/src/Linkification/Embedding.coffee index 7c6544bf8..188779901 100644 --- a/src/Linkification/Embedding.coffee +++ b/src/Linkification/Embedding.coffee @@ -55,6 +55,7 @@ Embedding = embed.dataset[name] = value for name, value of {key, uid, options, href} $.on embed, 'click', Embedding.cb.click + $.on d, 'IndexRefreshInternal', Embedding.cb.catalogRemove.bind(embed) if Index.enabled $.after link, [$.tn(' '), embed] if Conf['Auto-embed'] and !Conf['Floating Embeds'] and !post.isFetchedQuote @@ -146,6 +147,12 @@ Embedding = return container + catalogRemove: -> + isCatalog = $.hasClass(doc, 'catalog-mode') + if (isCatalog and $.hasClass(@, 'embedded')) or (!isCatalog and $.hasClass(@, 'embed-removed')) + Embedding.cb.toggle.call @ + $.toggleClass @, 'embed-removed' + title: (req, data) -> {key, uid, options, link, post} = data {status} = req