embed_embedly_integration.html 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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. function bx_embedly_process_links(e) {
  25. $(e).find('.bx-embed-link').each(function () {
  26. $(this).html('');
  27. $(this).html('<a href="' + $(this).attr('source') + '"></a>');
  28. embedly('card', $(this).find('a')[0]);
  29. });
  30. }
  31. if (typeof glOnProcessHtml === 'undefined')
  32. glOnProcessHtml = [];
  33. if (glOnProcessHtml instanceof Array)
  34. glOnProcessHtml.push(bx_embedly_process_links);
  35. bx_embedly_process_links(this);
  36. });
  37. </script>