@ecency/render-helper 2.4.6 → 2.4.8
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 +34 -15
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.cjs +34 -15
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.mjs +34 -15
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/node/index.mjs
CHANGED
|
@@ -9,13 +9,6 @@ import * as htmlparser2 from 'htmlparser2';
|
|
|
9
9
|
import * as domSerializerModule from 'dom-serializer';
|
|
10
10
|
import { LRUCache } from 'lru-cache';
|
|
11
11
|
|
|
12
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
13
|
-
get: (a2, b) => (typeof require !== "undefined" ? require : a2)[b]
|
|
14
|
-
}) : x)(function(x) {
|
|
15
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
16
|
-
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
17
|
-
});
|
|
18
|
-
|
|
19
12
|
// src/consts/white-list.const.ts
|
|
20
13
|
var WHITE_LIST = [
|
|
21
14
|
"ecency.com",
|
|
@@ -395,6 +388,12 @@ var getInlineMeta = (el, href) => {
|
|
|
395
388
|
isInline: textMatches || titleMatches
|
|
396
389
|
};
|
|
397
390
|
};
|
|
391
|
+
var addLineBreakBeforePostLink = (el, forApp, isInline) => {
|
|
392
|
+
if (forApp && isInline && el.parentNode) {
|
|
393
|
+
const br = el.ownerDocument.createElement("br");
|
|
394
|
+
el.parentNode.insertBefore(br, el);
|
|
395
|
+
}
|
|
396
|
+
};
|
|
398
397
|
function a(el, forApp, webp, parentDomain = "ecency.com") {
|
|
399
398
|
if (!el || !el.parentNode) {
|
|
400
399
|
return;
|
|
@@ -458,6 +457,7 @@ function a(el, forApp, webp, parentDomain = "ecency.com") {
|
|
|
458
457
|
el.setAttribute("href", h);
|
|
459
458
|
el.setAttribute("data-is-inline", "" + isInline);
|
|
460
459
|
}
|
|
460
|
+
addLineBreakBeforePostLink(el, forApp, isInline);
|
|
461
461
|
return;
|
|
462
462
|
}
|
|
463
463
|
const mentionMatch = href.match(MENTION_REGEX);
|
|
@@ -535,6 +535,7 @@ function a(el, forApp, webp, parentDomain = "ecency.com") {
|
|
|
535
535
|
el.setAttribute("href", h);
|
|
536
536
|
el.setAttribute("data-is-inline", "" + isInline);
|
|
537
537
|
}
|
|
538
|
+
addLineBreakBeforePostLink(el, forApp, isInline);
|
|
538
539
|
return;
|
|
539
540
|
}
|
|
540
541
|
}
|
|
@@ -599,6 +600,7 @@ function a(el, forApp, webp, parentDomain = "ecency.com") {
|
|
|
599
600
|
el.setAttribute("href", h);
|
|
600
601
|
el.setAttribute("data-is-inline", "" + isInline);
|
|
601
602
|
}
|
|
603
|
+
addLineBreakBeforePostLink(el, forApp, isInline);
|
|
602
604
|
return;
|
|
603
605
|
}
|
|
604
606
|
}
|
|
@@ -684,6 +686,7 @@ function a(el, forApp, webp, parentDomain = "ecency.com") {
|
|
|
684
686
|
el.setAttribute("href", h);
|
|
685
687
|
el.setAttribute("data-is-inline", "" + isInline);
|
|
686
688
|
}
|
|
689
|
+
addLineBreakBeforePostLink(el, forApp, isInline);
|
|
687
690
|
return;
|
|
688
691
|
}
|
|
689
692
|
const BCmatch = href.match(BITCHUTE_REGEX);
|
|
@@ -1269,16 +1272,32 @@ function cleanReply(s) {
|
|
|
1269
1272
|
return (s ? s.split("\n").filter((item) => item.toLowerCase().includes("posted using [partiko") === false).filter((item) => item.toLowerCase().includes("posted using [dapplr") === false).filter((item) => item.toLowerCase().includes("posted using [leofinance") === false).filter((item) => item.toLowerCase().includes("posted via [neoxian") === false).filter((item) => item.toLowerCase().includes("posted using [neoxian") === false).filter((item) => item.toLowerCase().includes("posted with [stemgeeks") === false).filter((item) => item.toLowerCase().includes("posted using [bilpcoin") === false).filter((item) => item.toLowerCase().includes("posted using [inleo") === false).filter((item) => item.toLowerCase().includes("posted using [sportstalksocial]") === false).filter((item) => item.toLowerCase().includes("<center><sub>[posted using aeneas.blog") === false).filter((item) => item.toLowerCase().includes("<center><sub>posted via [proofofbrain.io") === false).filter((item) => item.toLowerCase().includes("<center>posted on [hypnochain") === false).filter((item) => item.toLowerCase().includes("<center><sub>posted via [weedcash.network") === false).filter((item) => item.toLowerCase().includes("<center>posted on [naturalmedicine.io") === false).filter((item) => item.toLowerCase().includes("<center><sub>posted via [musicforlife.io") === false).filter((item) => item.toLowerCase().includes("if the truvvl embed is unsupported by your current frontend, click this link to view this story") === false).filter((item) => item.toLowerCase().includes("<center><em>posted from truvvl") === false).filter((item) => item.toLowerCase().includes('view this post <a href="https://travelfeed.io/') === false).filter((item) => item.toLowerCase().includes("read this post on travelfeed.io for the best experience") === false).filter((item) => item.toLowerCase().includes('posted via <a href="https://www.dporn.co/"') === false).filter((item) => item.toLowerCase().includes("\u25B6\uFE0F [watch on 3speak](https://3speak") === false).filter((item) => item.toLowerCase().includes("<sup><sub>posted via [inji.com]") === false).filter((item) => item.toLowerCase().includes("view this post on [liketu]") === false).filter((item) => item.toLowerCase().includes("[via Inbox]") === false).join("\n") : "").replace('Posted via <a href="https://d.buzz" data-link="promote-link">D.Buzz</a>', "").replace('<div class="pull-right"><a href="/@hive.engage"></a></div>', "").replace('<div><a href="https://engage.hivechain.app"></a></div>', "").replace(`<div class="text-center"><img src="https://cdn.steemitimages.com/DQmNp6YwAm2qwquALZw8PdcovDorwaBSFuxQ38TrYziGT6b/A-20.png"><a href="https://bit.ly/actifit-app"><img src="https://cdn.steemitimages.com/DQmQqfpSmcQtfrHAtzfBtVccXwUL9vKNgZJ2j93m8WNjizw/l5.png"></a><a href="https://bit.ly/actifit-ios"><img src="https://cdn.steemitimages.com/DQmbWy8KzKT1UvCvznUTaFPw6wBUcyLtBT5XL9wdbB7Hfmn/l6.png"></a></div>`, "");
|
|
1270
1273
|
}
|
|
1271
1274
|
var domSerializer = domSerializerModule.default || domSerializerModule;
|
|
1272
|
-
var
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1275
|
+
var lolightPromise = null;
|
|
1276
|
+
var lolightModule = null;
|
|
1277
|
+
async function loadLolight() {
|
|
1278
|
+
if (typeof window !== "undefined") {
|
|
1279
|
+
return null;
|
|
1280
|
+
}
|
|
1281
|
+
if (lolightModule) {
|
|
1282
|
+
return lolightModule;
|
|
1283
|
+
}
|
|
1284
|
+
if (!lolightPromise) {
|
|
1285
|
+
lolightPromise = import('lolight').then((mod) => {
|
|
1286
|
+
lolightModule = mod.default || mod;
|
|
1287
|
+
return lolightModule;
|
|
1288
|
+
}).catch(() => {
|
|
1289
|
+
lolightModule = null;
|
|
1278
1290
|
return null;
|
|
1279
|
-
}
|
|
1291
|
+
});
|
|
1280
1292
|
}
|
|
1281
|
-
return
|
|
1293
|
+
return lolightPromise;
|
|
1294
|
+
}
|
|
1295
|
+
function getLolightInstance() {
|
|
1296
|
+
return lolightModule;
|
|
1297
|
+
}
|
|
1298
|
+
if (typeof window === "undefined") {
|
|
1299
|
+
loadLolight().catch(() => {
|
|
1300
|
+
});
|
|
1282
1301
|
}
|
|
1283
1302
|
function fixBlockLevelTagsInParagraphs(html) {
|
|
1284
1303
|
const blockTags = "center|div|table|figure|section|article|aside|header|footer|nav|main";
|