@ecency/render-helper 2.4.19 → 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.
- package/dist/browser/index.js +40 -4
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.cjs +40 -4
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.mjs +40 -4
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/node/index.mjs
CHANGED
|
@@ -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");
|
|
@@ -1288,9 +1317,10 @@ function traverse(node, forApp, depth = 0, state = { firstImageFound: false }, p
|
|
|
1288
1317
|
if (!node || !node.childNodes) {
|
|
1289
1318
|
return;
|
|
1290
1319
|
}
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1320
|
+
let child = node.firstChild;
|
|
1321
|
+
while (child) {
|
|
1322
|
+
const next = child.nextSibling;
|
|
1323
|
+
const prev = child.previousSibling;
|
|
1294
1324
|
if (child.nodeName.toLowerCase() === "a") {
|
|
1295
1325
|
a(child, forApp, parentDomain, seoContext);
|
|
1296
1326
|
}
|
|
@@ -1308,8 +1338,14 @@ function traverse(node, forApp, depth = 0, state = { firstImageFound: false }, p
|
|
|
1308
1338
|
}
|
|
1309
1339
|
if (child.parentNode) {
|
|
1310
1340
|
traverse(child, forApp, depth + 1, state, parentDomain, seoContext);
|
|
1341
|
+
} else {
|
|
1342
|
+
const possibleReplacement = next ? next.previousSibling : node.lastChild;
|
|
1343
|
+
if (possibleReplacement && possibleReplacement !== prev && possibleReplacement.parentNode === node) {
|
|
1344
|
+
traverse(possibleReplacement, forApp, depth + 1, state, parentDomain, seoContext);
|
|
1345
|
+
}
|
|
1311
1346
|
}
|
|
1312
|
-
|
|
1347
|
+
child = next;
|
|
1348
|
+
}
|
|
1313
1349
|
}
|
|
1314
1350
|
|
|
1315
1351
|
// src/methods/clean-reply.method.ts
|