Просмотр исходного кода

#3761 Embed isn't displayed in Timeline when it's loaded in async mode

Alex Trofimov 4 лет назад
Родитель
Сommit
25b18a020a
1 измененных файлов с 20 добавлено и 2 удалено
  1. 20 2
      template/embed_embedly_integration.html

+ 20 - 2
template/embed_embedly_integration.html

@@ -9,17 +9,35 @@
         s.parentNode.insertBefore(e, s);
     }
 })(window, document);
-<bx_if:key>
+
 $(document).ready(function () {
+
     embedly("defaults", {
+<bx_if:key>
         cards: {key: '__key__'},
+</bx_if:key>
 		controls: 0
     });
+
     embedly('on', 'card.resize', function(iframe){
         var $card = $(iframe);
         var $card_parent = $card.parents('.fr-embedly');
         $card_parent.css('height', $card.height());
     });
+
+    function bx_embedly_process_links(e) {
+        $(e).find('.bx-embed-link').each(function () { 
+            $(this).html('');
+            $(this).html('<a href="' + $(this).attr('source') + '"></a>');
+            embedly('card', $(this).find('a')[0]); 
+        });
+    }
+
+    if (typeof glOnProcessHtml === 'undefined')
+        glOnProcessHtml = [];
+    if (glOnProcessHtml instanceof Array) 
+        glOnProcessHtml.push(bx_embedly_process_links);
+
+    bx_embedly_process_links(this);
 });
-</bx_if:key>
 </script>