@ecency/render-helper 2.4.20 → 2.4.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -80,6 +80,8 @@ var SKATEHIVE_IPFS_REGEX = /^https?:\/\/ipfs\.skatehive\.app\/ipfs\/([^/?#]+)/i;
80
80
  var ARCH_REGEX = /^(https?:)?\/\/archive.org\/embed\/[^/?#]+(?:$|[?#])/i;
81
81
  var SPEAK_REGEX = /(?:https?:\/\/(?:(?:play\.)?3speak\.([a-z]+)\/watch\?v=)|(?:(?:play\.)?3speak\.([a-z]+)\/embed\?v=))([A-Za-z0-9_\-\.\/]+)(&.*)?/i;
82
82
  var SPEAK_EMBED_REGEX = /^(https?:)?\/\/(?:play\.)?3speak\.([a-z]+)\/(?:embed|watch)\?.+$/i;
83
+ var SPEAK_AUDIO_REGEX = /https?:\/\/audio\.3speak\.tv\/play\?[^\s]+/i;
84
+ var SPEAK_AUDIO_EMBED_REGEX = /^https?:\/\/audio\.3speak\.tv\/play\?.+$/i;
83
85
  var TWITTER_REGEX = /(?:https?:\/\/(?:(?:twitter\.com\/(.*?)\/status\/(.*))))/gi;
84
86
  var SPOTIFY_REGEX = /^https:\/\/open\.spotify\.com\/playlist\/(.*)?$/gi;
85
87
  var RUMBLE_REGEX = /^https:\/\/rumble.com\/embed\/([a-zA-Z0-9-]+)\/\?pub=\w+/;
@@ -925,6 +927,19 @@ function a(el, forApp, parentDomain = "ecency.com", seoContext) {
925
927
  }
926
928
  }
927
929
  }
930
+ if (href.match(SPEAK_AUDIO_REGEX) && el.textContent.trim() === href) {
931
+ el.setAttribute("class", "markdown-audio-link markdown-audio-link-speak");
932
+ el.removeAttribute("href");
933
+ const embedSrc = /[?&]iframe=/.test(href) ? href : `${href}&iframe=1`;
934
+ const finalSrc = /[?&]mode=/.test(embedSrc) ? embedSrc : `${embedSrc}&mode=compact`;
935
+ el.textContent = "";
936
+ const ifr = el.ownerDocument.createElement("iframe");
937
+ ifr.setAttribute("frameborder", "0");
938
+ ifr.setAttribute("src", finalSrc);
939
+ ifr.setAttribute("sandbox", "allow-scripts allow-same-origin allow-popups");
940
+ el.appendChild(ifr);
941
+ return;
942
+ }
928
943
  const matchT = href.match(TWITTER_REGEX);
929
944
  if (matchT && el.textContent.trim() === href) {
930
945
  TWITTER_REGEX.lastIndex = 0;
@@ -1046,6 +1061,20 @@ function iframe(el, parentDomain = "ecency.com") {
1046
1061
  el.setAttribute("class", "speak-iframe");
1047
1062
  return;
1048
1063
  }
1064
+ if (src.match(SPEAK_AUDIO_EMBED_REGEX)) {
1065
+ let normalizedSrc = src;
1066
+ if (!/[?&]iframe=/.test(normalizedSrc)) {
1067
+ normalizedSrc = `${normalizedSrc}&iframe=1`;
1068
+ }
1069
+ if (!/[?&]mode=/.test(normalizedSrc)) {
1070
+ normalizedSrc = `${normalizedSrc}&mode=compact`;
1071
+ }
1072
+ el.setAttribute("src", normalizedSrc);
1073
+ el.setAttribute("class", "speak-audio-iframe");
1074
+ el.setAttribute("frameborder", "0");
1075
+ el.setAttribute("sandbox", "allow-scripts allow-same-origin allow-popups");
1076
+ return;
1077
+ }
1049
1078
  if (src.match(SPOTIFY_EMBED_REGEX)) {
1050
1079
  el.setAttribute("src", src);
1051
1080
  el.setAttribute("sandbox", "allow-scripts allow-same-origin allow-popups");