@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.cjs
CHANGED
|
@@ -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");
|
|
@@ -1317,9 +1346,10 @@ function traverse(node, forApp, depth = 0, state = { firstImageFound: false }, p
|
|
|
1317
1346
|
if (!node || !node.childNodes) {
|
|
1318
1347
|
return;
|
|
1319
1348
|
}
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1349
|
+
let child = node.firstChild;
|
|
1350
|
+
while (child) {
|
|
1351
|
+
const next = child.nextSibling;
|
|
1352
|
+
const prev = child.previousSibling;
|
|
1323
1353
|
if (child.nodeName.toLowerCase() === "a") {
|
|
1324
1354
|
a(child, forApp, parentDomain, seoContext);
|
|
1325
1355
|
}
|
|
@@ -1337,8 +1367,14 @@ function traverse(node, forApp, depth = 0, state = { firstImageFound: false }, p
|
|
|
1337
1367
|
}
|
|
1338
1368
|
if (child.parentNode) {
|
|
1339
1369
|
traverse(child, forApp, depth + 1, state, parentDomain, seoContext);
|
|
1370
|
+
} else {
|
|
1371
|
+
const possibleReplacement = next ? next.previousSibling : node.lastChild;
|
|
1372
|
+
if (possibleReplacement && possibleReplacement !== prev && possibleReplacement.parentNode === node) {
|
|
1373
|
+
traverse(possibleReplacement, forApp, depth + 1, state, parentDomain, seoContext);
|
|
1374
|
+
}
|
|
1340
1375
|
}
|
|
1341
|
-
|
|
1376
|
+
child = next;
|
|
1377
|
+
}
|
|
1342
1378
|
}
|
|
1343
1379
|
|
|
1344
1380
|
// src/methods/clean-reply.method.ts
|