@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.
@@ -109,6 +109,8 @@ var SKATEHIVE_IPFS_REGEX = /^https?:\/\/ipfs\.skatehive\.app\/ipfs\/([^/?#]+)/i;
109
109
  var ARCH_REGEX = /^(https?:)?\/\/archive.org\/embed\/[^/?#]+(?:$|[?#])/i;
110
110
  var SPEAK_REGEX = /(?:https?:\/\/(?:(?:play\.)?3speak\.([a-z]+)\/watch\?v=)|(?:(?:play\.)?3speak\.([a-z]+)\/embed\?v=))([A-Za-z0-9_\-\.\/]+)(&.*)?/i;
111
111
  var SPEAK_EMBED_REGEX = /^(https?:)?\/\/(?:play\.)?3speak\.([a-z]+)\/(?:embed|watch)\?.+$/i;
112
+ var SPEAK_AUDIO_REGEX = /https?:\/\/audio\.3speak\.tv\/play\?[^\s]+/i;
113
+ var SPEAK_AUDIO_EMBED_REGEX = /^https?:\/\/audio\.3speak\.tv\/play\?.+$/i;
112
114
  var TWITTER_REGEX = /(?:https?:\/\/(?:(?:twitter\.com\/(.*?)\/status\/(.*))))/gi;
113
115
  var SPOTIFY_REGEX = /^https:\/\/open\.spotify\.com\/playlist\/(.*)?$/gi;
114
116
  var RUMBLE_REGEX = /^https:\/\/rumble.com\/embed\/([a-zA-Z0-9-]+)\/\?pub=\w+/;
@@ -957,6 +959,19 @@ function a(el, forApp, parentDomain = "ecency.com", seoContext) {
957
959
  }
958
960
  }
959
961
  }
962
+ if (href.match(SPEAK_AUDIO_REGEX) && el.textContent.trim() === href) {
963
+ el.setAttribute("class", "markdown-audio-link markdown-audio-link-speak");
964
+ el.removeAttribute("href");
965
+ const embedSrc = /[?&]iframe=/.test(href) ? href : `${href}&iframe=1`;
966
+ const finalSrc = /[?&]mode=/.test(embedSrc) ? embedSrc : `${embedSrc}&mode=compact`;
967
+ el.textContent = "";
968
+ const ifr = el.ownerDocument.createElement("iframe");
969
+ ifr.setAttribute("frameborder", "0");
970
+ ifr.setAttribute("src", finalSrc);
971
+ ifr.setAttribute("sandbox", "allow-scripts allow-same-origin allow-popups");
972
+ el.appendChild(ifr);
973
+ return;
974
+ }
960
975
  const matchT = href.match(TWITTER_REGEX);
961
976
  if (matchT && el.textContent.trim() === href) {
962
977
  TWITTER_REGEX.lastIndex = 0;
@@ -1078,6 +1093,20 @@ function iframe(el, parentDomain = "ecency.com") {
1078
1093
  el.setAttribute("class", "speak-iframe");
1079
1094
  return;
1080
1095
  }
1096
+ if (src.match(SPEAK_AUDIO_EMBED_REGEX)) {
1097
+ let normalizedSrc = src;
1098
+ if (!/[?&]iframe=/.test(normalizedSrc)) {
1099
+ normalizedSrc = `${normalizedSrc}&iframe=1`;
1100
+ }
1101
+ if (!/[?&]mode=/.test(normalizedSrc)) {
1102
+ normalizedSrc = `${normalizedSrc}&mode=compact`;
1103
+ }
1104
+ el.setAttribute("src", normalizedSrc);
1105
+ el.setAttribute("class", "speak-audio-iframe");
1106
+ el.setAttribute("frameborder", "0");
1107
+ el.setAttribute("sandbox", "allow-scripts allow-same-origin allow-popups");
1108
+ return;
1109
+ }
1081
1110
  if (src.match(SPOTIFY_EMBED_REGEX)) {
1082
1111
  el.setAttribute("src", src);
1083
1112
  el.setAttribute("sandbox", "allow-scripts allow-same-origin allow-popups");