nodebb-plugin-ezoic-infinite 1.6.71 → 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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/public/client.js +12 -13
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-ezoic-infinite",
3
- "version": "1.6.71",
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/topic pages we may prune filled or empty orphans if they are far away,
742
- // otherwise consecutive "stacks" can appear when posts are virtualized.
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
- if (!isMessage && isFilled(wrap)) return; // never prune filled ads for non-message lists
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,14 +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: when the user scrolls UP, NodeBB may load items above the fold.
1096
- // Injecting ads there immediately causes wrap pile-ups near the top.
1097
- // Skip targets whose anchor is above the viewport top at injection time.
1098
- try {
1099
- if (scrollDir < 0 && el.getBoundingClientRect().bottom < 0) continue;
1100
- } catch (e) {}
1101
-
1102
1101
  if (isAdjacentAd(el)) continue;
1103
1102
  if (findWrap(kindClass, afterPos)) continue;
1104
1103