logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://anongit.hacktivis.me/git/pleroma.git/

embed.js (942B)


  1. (function () {
  2. 'use strict'
  3. var ready = function (loaded) {
  4. if (['interactive', 'complete'].indexOf(document.readyState) !== -1) {
  5. loaded()
  6. } else {
  7. document.addEventListener('DOMContentLoaded', loaded)
  8. }
  9. }
  10. ready(function () {
  11. var iframes = []
  12. window.addEventListener('message', function (e) {
  13. var data = e.data || {}
  14. if (data.type !== 'setHeightPleromaEmbed' || !iframes[data.id]) {
  15. return
  16. }
  17. iframes[data.id].height = data.height
  18. });
  19. [].forEach.call(document.querySelectorAll('iframe.pleroma-embed'), function (iframe) {
  20. iframe.scrolling = 'no'
  21. iframe.style.overflow = 'hidden'
  22. iframes.push(iframe)
  23. var id = iframes.length - 1
  24. iframe.onload = function () {
  25. iframe.contentWindow.postMessage({
  26. type: 'setHeightPleromaEmbed',
  27. id: id
  28. }, '*')
  29. }
  30. iframe.onload()
  31. })
  32. })
  33. })()