nodebb-plugin-ezoic-infinite 1.8.75 → 1.8.77

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 +7 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-ezoic-infinite",
3
- "version": "1.8.75",
3
+ "version": "1.8.77",
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
@@ -26,13 +26,13 @@
26
26
  EMPTY_CHECK_MS_1: 30_000,
27
27
  EMPTY_CHECK_MS_2: 60_000,
28
28
  MIN_PRUNE_AGE_MS: 8_000,
29
- RECYCLE_MIN_AGE_MS: 5_000,
30
- SHOW_THROTTLE_MS: 900,
29
+ RECYCLE_MIN_AGE_MS: 8_000,
30
+ SHOW_THROTTLE_MS: 500,
31
31
  BURST_COOLDOWN_MS: 200,
32
32
  BLOCK_DURATION_MS: 1_500,
33
33
  SHOW_TIMEOUT_MS: 7_000,
34
34
  SHOW_RELEASE_MS: 700,
35
- RECYCLE_DELAY_MS: 450,
35
+ RECYCLE_DELAY_MS: 300,
36
36
  UNCOLLAPSE_CHECK_MS: [500, 3_000, 10_000],
37
37
  };
38
38
 
@@ -298,7 +298,7 @@
298
298
  if (typeof ez?.destroyPlaceholders !== 'function' ||
299
299
  typeof ez?.showAds !== 'function') return null;
300
300
 
301
- const threshold = -(3 * (window.innerHeight || 800));
301
+ const threshold = -(5 * (window.innerHeight || 800));
302
302
  const t = now();
303
303
  let bestEmpty = null, bestEmptyY = Infinity;
304
304
  let bestFull = null, bestFullY = Infinity;
@@ -309,7 +309,9 @@
309
309
  for (const wrap of wraps) {
310
310
  try {
311
311
  const created = parseInt(wrap.getAttribute(ATTR.CREATED) || '0', 10);
312
- if (t - created < TIMING.RECYCLE_MIN_AGE_MS) continue;
312
+ const shown = parseInt(wrap.getAttribute(ATTR.SHOWN) || '0', 10);
313
+ const refTs = shown > 0 ? Math.max(created, shown) : created;
314
+ if (t - refTs < TIMING.RECYCLE_MIN_AGE_MS) continue;
313
315
  const bottom = wrap.getBoundingClientRect().bottom;
314
316
  if (bottom > threshold) continue;
315
317
  if (!isFilled(wrap)) {