@ecency/render-helper 2.4.16 → 2.4.18

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.
@@ -449,7 +449,7 @@ function a(el, forApp, parentDomain = "ecency.com", seoContext) {
449
449
  const imgHTML = createImageHTML(href, isLCP);
450
450
  const doc = DOMParser.parseFromString(imgHTML, "text/html");
451
451
  const replaceNode = doc.body?.firstChild || doc.firstChild;
452
- if (replaceNode) {
452
+ if (replaceNode && el.parentNode) {
453
453
  const importedNode = el.ownerDocument.importNode(replaceNode, true);
454
454
  el.parentNode.replaceChild(importedNode, el);
455
455
  }
@@ -899,7 +899,7 @@ function a(el, forApp, parentDomain = "ecency.com", seoContext) {
899
899
  const imgEls2 = el.getElementsByTagName("img");
900
900
  if (imgEls2.length === 1 || el.textContent.trim() === href) {
901
901
  if ((match[1] || match[2]) && match[3]) {
902
- const videoHref = `https://play.3speak.tv/embed?v=${match[3]}&mode=iframe`;
902
+ const videoHref = `https://play.3speak.tv/watch?v=${match[3]}&mode=iframe`;
903
903
  el.setAttribute("class", "markdown-video-link markdown-video-link-speak");
904
904
  el.removeAttribute("href");
905
905
  el.setAttribute("data-embed-src", videoHref);
@@ -943,7 +943,9 @@ function a(el, forApp, parentDomain = "ecency.com", seoContext) {
943
943
  blockquote.appendChild(p2);
944
944
  blockquote.appendChild(textNode);
945
945
  blockquote.appendChild(a2);
946
- el.parentNode.replaceChild(blockquote, el);
946
+ if (el.parentNode) {
947
+ el.parentNode.replaceChild(blockquote, el);
948
+ }
947
949
  return;
948
950
  }
949
951
  }
@@ -1033,7 +1035,7 @@ function iframe(el, parentDomain = "ecency.com") {
1033
1035
  }
1034
1036
  if (src.match(SPEAK_EMBED_REGEX)) {
1035
1037
  let normalizedSrc = src.replace(/(?:play\.)?3speak\.[a-z]+/i, "play.3speak.tv");
1036
- normalizedSrc = normalizedSrc.replace(/\/watch\?/, "/embed?");
1038
+ normalizedSrc = normalizedSrc.replace(/\/embed\?/, "/watch?");
1037
1039
  const hasMode = /[?&]mode=/.test(normalizedSrc);
1038
1040
  if (!hasMode) {
1039
1041
  normalizedSrc = `${normalizedSrc}&mode=iframe`;