@ecency/render-helper 2.5.12 → 2.5.13
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 +13 -6
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.cjs +13 -6
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.mjs +13 -6
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/node/index.mjs
CHANGED
|
@@ -1213,14 +1213,15 @@ function a(el, forApp, parentDomain = "ecency.com", seoContext, renderOptions) {
|
|
|
1213
1213
|
el.setAttribute("data-start-time", startTime);
|
|
1214
1214
|
}
|
|
1215
1215
|
if (renderOptions?.embedVideosDirectly) {
|
|
1216
|
+
const directSrc = `https://www.youtube.com/embed/${vid}`;
|
|
1216
1217
|
const wrapper = el.ownerDocument.createElement("span");
|
|
1217
1218
|
wrapper.setAttribute("class", "er-youtube-frame");
|
|
1218
1219
|
wrapper.setAttribute("style", "display:block");
|
|
1219
1220
|
const iframe2 = el.ownerDocument.createElement("iframe");
|
|
1220
1221
|
iframe2.setAttribute("class", "youtube-player");
|
|
1221
|
-
iframe2.setAttribute("src",
|
|
1222
|
+
iframe2.setAttribute("src", directSrc);
|
|
1222
1223
|
iframe2.setAttribute("title", "YouTube video");
|
|
1223
|
-
iframe2.setAttribute("allow", "accelerometer;
|
|
1224
|
+
iframe2.setAttribute("allow", "accelerometer; encrypted-media; gyroscope; picture-in-picture; web-share");
|
|
1224
1225
|
iframe2.setAttribute("allowfullscreen", "");
|
|
1225
1226
|
wrapper.appendChild(iframe2);
|
|
1226
1227
|
el.appendChild(wrapper);
|
|
@@ -1357,12 +1358,13 @@ function a(el, forApp, parentDomain = "ecency.com", seoContext, renderOptions) {
|
|
|
1357
1358
|
el.textContent = "";
|
|
1358
1359
|
}
|
|
1359
1360
|
if (renderOptions?.embedVideosDirectly) {
|
|
1361
|
+
const directSrc = `${videoHref}&autoplay=false`;
|
|
1360
1362
|
const wrapper = el.ownerDocument.createElement("span");
|
|
1361
1363
|
wrapper.setAttribute("class", "er-speak-frame");
|
|
1362
1364
|
wrapper.setAttribute("style", "display:block");
|
|
1363
1365
|
const iframe2 = el.ownerDocument.createElement("iframe");
|
|
1364
1366
|
iframe2.setAttribute("class", "speak-iframe");
|
|
1365
|
-
iframe2.setAttribute("src",
|
|
1367
|
+
iframe2.setAttribute("src", directSrc);
|
|
1366
1368
|
iframe2.setAttribute("title", "3Speak video");
|
|
1367
1369
|
iframe2.setAttribute("allow", "accelerometer; encrypted-media; gyroscope; picture-in-picture; web-share");
|
|
1368
1370
|
iframe2.setAttribute("allowfullscreen", "");
|
|
@@ -1475,7 +1477,7 @@ function a(el, forApp, parentDomain = "ecency.com", seoContext, renderOptions) {
|
|
|
1475
1477
|
}
|
|
1476
1478
|
|
|
1477
1479
|
// src/methods/iframe.method.ts
|
|
1478
|
-
function iframe(el, parentDomain = "ecency.com", forApp = false) {
|
|
1480
|
+
function iframe(el, parentDomain = "ecency.com", forApp = false, renderOptions) {
|
|
1479
1481
|
if (!el || !el.parentNode) {
|
|
1480
1482
|
return;
|
|
1481
1483
|
}
|
|
@@ -1518,7 +1520,12 @@ function iframe(el, parentDomain = "ecency.com", forApp = false) {
|
|
|
1518
1520
|
normalizedSrc = `${normalizedSrc}&mode=iframe`;
|
|
1519
1521
|
}
|
|
1520
1522
|
const hasAutoplay = /[?&]autoplay=/.test(normalizedSrc);
|
|
1521
|
-
let s
|
|
1523
|
+
let s;
|
|
1524
|
+
if (renderOptions?.embedVideosDirectly) {
|
|
1525
|
+
s = hasAutoplay ? normalizedSrc.replace(/([?&]autoplay=)[^&]*/i, "$1false") : `${normalizedSrc}&autoplay=false`;
|
|
1526
|
+
} else {
|
|
1527
|
+
s = hasAutoplay ? normalizedSrc : `${normalizedSrc}&autoplay=true`;
|
|
1528
|
+
}
|
|
1522
1529
|
if (forApp && !/[?&]layout=/.test(s)) {
|
|
1523
1530
|
s = `${s}&layout=mobile`;
|
|
1524
1531
|
}
|
|
@@ -1832,7 +1839,7 @@ function traverse(node, forApp, depth = 0, state = { firstImageFound: false }, p
|
|
|
1832
1839
|
a(child, forApp, parentDomain, seoContext, renderOptions);
|
|
1833
1840
|
}
|
|
1834
1841
|
if (child.nodeName.toLowerCase() === "iframe") {
|
|
1835
|
-
iframe(child, parentDomain, forApp);
|
|
1842
|
+
iframe(child, parentDomain, forApp, renderOptions);
|
|
1836
1843
|
}
|
|
1837
1844
|
if (child.nodeName === "#text") {
|
|
1838
1845
|
text(child, forApp);
|