nodebb-plugin-ezoic-infinite 1.6.71 → 1.6.72

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 +1 -1
  2. package/public/client.js +11 -4
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.72",
4
4
  "description": "Production-ready Ezoic infinite ads integration for NodeBB 4.x",
5
5
  "main": "library.js",
6
6
  "license": "MIT",
package/public/client.js CHANGED
@@ -1092,11 +1092,18 @@ function buildOrdinalMap(items) {
1092
1092
  if (!el) continue;
1093
1093
  if (!el || !el.isConnected) continue;
1094
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.
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.
1098
1101
  try {
1099
- if (scrollDir < 0 && el.getBoundingClientRect().bottom < 0) continue;
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
+ }
1100
1107
  } catch (e) {}
1101
1108
 
1102
1109
  if (isAdjacentAd(el)) continue;