embed_embedly_integration.html 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <script>
  2. (function(w, d){
  3. var id='embedly-platform', n = 'script';
  4. if (!d.getElementById(id)){
  5. w.embedly = w.embedly || function() {(w.embedly.q = w.embedly.q || []).push(arguments);};
  6. var e = d.createElement(n); e.id = id; e.async=1;
  7. e.src = ('https:' === document.location.protocol ? 'https' : 'http') + '://cdn.embedly.com/widgets/platform.js';
  8. var s = d.getElementsByTagName(n)[0];
  9. s.parentNode.insertBefore(e, s);
  10. }
  11. })(window, document);
  12. $(document).ready(function () {
  13. embedly("defaults", {
  14. <bx_if:key>
  15. cards: {key: '__key__'},
  16. </bx_if:key>
  17. controls: 0
  18. });
  19. embedly('on', 'card.resize', function(iframe){
  20. var $card = $(iframe);
  21. var $card_parent = $card.parents('.fr-embedly');
  22. $card_parent.css('height', $card.height());
  23. });
  24. embedly('on', 'card.rendered', function(iframe){
  25. bx_redirect_for_external_links($(iframe).contents());
  26. });
  27. function bx_embedly_process_links(e) {
  28. $(e).find('.bx-embed-link').each(function () {
  29. $(this).html('');
  30. $(this).html('<a href="' + $(this).attr('source') + '"></a>');
  31. embedly('card', $(this).find('a')[0]);
  32. });
  33. }
  34. if (typeof glOnProcessHtml === 'undefined')
  35. glOnProcessHtml = [];
  36. if (glOnProcessHtml instanceof Array)
  37. glOnProcessHtml.push(bx_embedly_process_links);
  38. bx_embedly_process_links(this);
  39. });
  40. </script>