@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+/;
@@ -928,6 +930,19 @@ function a(el, forApp, parentDomain = "ecency.com", seoContext) {
928
930
  }
929
931
  }
930
932
  }
933
+ if (href.match(SPEAK_AUDIO_REGEX) && el.textContent.trim() === href) {
934
+ el.setAttribute("class", "markdown-audio-link markdown-audio-link-speak");
935
+ el.removeAttribute("href");
936
+ const embedSrc = /[?&]iframe=/.test(href) ? href : `${href}&iframe=1`;
937
+ const finalSrc = /[?&]mode=/.test(embedSrc) ? embedSrc : `${embedSrc}&mode=compact`;
938
+ el.textContent = "";
939
+ const ifr = el.ownerDocument.createElement("iframe");
940
+ ifr.setAttribute("frameborder", "0");
941
+ ifr.setAttribute("src", finalSrc);
942
+ ifr.setAttribute("sandbox", "allow-scripts allow-same-origin allow-popups");
943
+ el.appendChild(ifr);
944
+ return;
945
+ }
931
946
  const matchT = href.match(TWITTER_REGEX);
932
947
  if (matchT && el.textContent.trim() === href) {
933
948
  TWITTER_REGEX.lastIndex = 0;
@@ -1049,6 +1064,20 @@ function iframe(el, parentDomain = "ecency.com") {
1049
1064
  el.setAttribute("class", "speak-iframe");
1050
1065
  return;
1051
1066
  }
1067
+ if (src.match(SPEAK_AUDIO_EMBED_REGEX)) {
1068
+ let normalizedSrc = src;
1069
+ if (!/[?&]iframe=/.test(normalizedSrc)) {
1070
+ normalizedSrc = `${normalizedSrc}&iframe=1`;
1071
+ }
1072
+ if (!/[?&]mode=/.test(normalizedSrc)) {
1073
+ normalizedSrc = `${normalizedSrc}&mode=compact`;
1074
+ }
1075
+ el.setAttribute("src", normalizedSrc);
1076
+ el.setAttribute("class", "speak-audio-iframe");
1077
+ el.setAttribute("frameborder", "0");
1078
+ el.setAttribute("sandbox", "allow-scripts allow-same-origin allow-popups");
1079
+ return;
1080
+ }
1052
1081
  if (src.match(SPOTIFY_EMBED_REGEX)) {
1053
1082
  el.setAttribute("src", src);
1054
1083
  el.setAttribute("sandbox", "allow-scripts allow-same-origin allow-popups");