nodebb-plugin-ezoic-infinite 1.6.72 → 1.6.73
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/package.json +2 -2
- package/public/client.js +12 -20
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nodebb-plugin-ezoic-infinite",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.73",
|
|
4
4
|
"description": "Production-ready Ezoic infinite ads integration for NodeBB 4.x",
|
|
5
5
|
"main": "library.js",
|
|
6
6
|
"license": "MIT",
|
|
@@ -18,4 +18,4 @@
|
|
|
18
18
|
"compatibility": "^4.0.0"
|
|
19
19
|
},
|
|
20
20
|
"private": false
|
|
21
|
-
}
|
|
21
|
+
}
|
package/public/client.js
CHANGED
|
@@ -738,10 +738,17 @@ function globalGapFixInit() {
|
|
|
738
738
|
if (wrap.getAttribute('data-ezoic-pin') === '1') return;
|
|
739
739
|
} catch (e) {}
|
|
740
740
|
|
|
741
|
-
// For message
|
|
742
|
-
//
|
|
741
|
+
// For message pages AND category topic lists, NodeBB may virtualize/recycle items.
|
|
742
|
+
// If we never hide/prune filled wraps, they can "pile up" when their anchor items
|
|
743
|
+
// temporarily leave the DOM (especially on /category/... lists).
|
|
744
|
+
//
|
|
745
|
+
// Strategy:
|
|
746
|
+
// - always hide orphan wraps (filled or empty) when their anchor item is gone
|
|
747
|
+
// - only *release* (remove) them if they are far offscreen, to avoid "vanishing" feel
|
|
743
748
|
const isMessage = (kindClass === 'ezoic-ad-message');
|
|
744
|
-
|
|
749
|
+
const isTopicList = (kindClass === 'ezoic-ad-between');
|
|
750
|
+
const allowOrphanForFilled = (isMessage || isTopicList);
|
|
751
|
+
if (!allowOrphanForFilled && isFilled(wrap)) return; // keep filled ads for non-virtualized lists
|
|
745
752
|
|
|
746
753
|
// Never prune a fresh wrap: it may fill late.
|
|
747
754
|
try {
|
|
@@ -758,8 +765,8 @@ if (hasNearbyItem(wrap)) {
|
|
|
758
765
|
// back-to-back while scrolling. We'll recycle it when its anchor comes back.
|
|
759
766
|
try { wrap.classList && wrap.classList.add('ez-orphan-hidden'); wrap.style && (wrap.style.display = 'none'); } catch (e) {}
|
|
760
767
|
|
|
761
|
-
// For message ads: only release if far offscreen to avoid perceived "vanishing" during fast scroll.
|
|
762
|
-
if (isMessage) {
|
|
768
|
+
// For message ads and topic-list ads: only release if far offscreen to avoid perceived "vanishing" during fast scroll.
|
|
769
|
+
if (isMessage || isTopicList) {
|
|
763
770
|
try {
|
|
764
771
|
const r = wrap.getBoundingClientRect();
|
|
765
772
|
const vh = Math.max(1, window.innerHeight || 1);
|
|
@@ -1091,21 +1098,6 @@ function buildOrdinalMap(items) {
|
|
|
1091
1098
|
const el = ordinalMap.get(afterPos);
|
|
1092
1099
|
if (!el) continue;
|
|
1093
1100
|
if (!el || !el.isConnected) continue;
|
|
1094
|
-
|
|
1095
|
-
// Viewport guard (loose): NodeBB may load batches above the fold when the user scrolls up.
|
|
1096
|
-
// If we inject immediately into anchors that are *far* above the viewport, wraps tend to
|
|
1097
|
-
// accumulate/pile near the top once the DOM is recycled.
|
|
1098
|
-
//
|
|
1099
|
-
// Important: do NOT skip when the anchor is only slightly above the viewport (e.g. -10px),
|
|
1100
|
-
// otherwise injection feels "missing" compared to v17. We only skip when it's well above.
|
|
1101
|
-
try {
|
|
1102
|
-
if (scrollDir < 0) {
|
|
1103
|
-
const bottom = el.getBoundingClientRect().bottom;
|
|
1104
|
-
const cutoff = -Math.max(240, (window.innerHeight || 800) * 0.75);
|
|
1105
|
-
if (bottom < cutoff) continue;
|
|
1106
|
-
}
|
|
1107
|
-
} catch (e) {}
|
|
1108
|
-
|
|
1109
1101
|
if (isAdjacentAd(el)) continue;
|
|
1110
1102
|
if (findWrap(kindClass, afterPos)) continue;
|
|
1111
1103
|
|