nodebb-plugin-ezoic-infinite 1.7.35 → 1.7.36

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 +13 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-ezoic-infinite",
3
- "version": "1.7.35",
3
+ "version": "1.7.36",
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
@@ -32,10 +32,12 @@
32
32
  *
33
33
  * v34 moveDistantWrap — voir v38.
34
34
  *
35
- * v42 Seuil de recyclage aligné sur IO_MARGIN par device :
36
- * desktop -(2500 + vh), mobile -(3500 + vh).
37
- * Un wrap dans la zone IO_MARGIN peut être re-observé après recyclage
38
- * conflit. On recycle uniquement au-delà de la marge d'observation.
35
+ * v43 Seuil de recyclage abaissé à -vh (hors viewport visible).
36
+ * recycleAndMove appelle unobserve(ph) avant de déplacer le wrap,
37
+ * ce qui neutralise l'IO sur ce nœud plus de risque de showAds
38
+ * parasite après recyclage. Plus de wraps éligibles = moins de pool sec.
39
+ *
40
+ * v42 Seuil -(IO_MARGIN + vh) (trop strict, peu de wraps éligibles).
39
41
  *
40
42
  * v41 Seuil -1vh (trop permissif sur mobile, ignorait IO_MARGIN).
41
43
  *
@@ -310,11 +312,10 @@
310
312
  typeof ez?.define !== 'function' ||
311
313
  typeof ez?.displayMore !== 'function') return null;
312
314
 
313
- const vh = window.innerHeight || 800;
314
- // Seuil : au-delà de l'IO_MARGIN + 1vh pour être sûr que l'observer
315
- // ne peut plus déclencher de showAds sur ce wrap après recyclage.
316
- const margin = isMobile() ? 3500 : 2500;
317
- const threshold = -(margin + vh);
315
+ const vh = window.innerHeight || 800;
316
+ // Seuil : -1vh (hors viewport visible). On appelle unobserve(ph) juste
317
+ // après pour neutraliser l'IO — plus de showAds parasite possible.
318
+ const threshold = -vh;
318
319
  let bestEmpty = null, bestEmptyBottom = Infinity;
319
320
  let bestFilled = null, bestFilledBottom = Infinity;
320
321
 
@@ -336,6 +337,9 @@
336
337
  if (!Number.isFinite(id)) return null;
337
338
 
338
339
  const oldKey = best.getAttribute(A_ANCHOR);
340
+ // Neutraliser l'IO sur ce wrap avant déplacement — évite un showAds
341
+ // parasite si le nœud était encore dans la zone IO_MARGIN.
342
+ try { const ph = best.querySelector(`#${PH_PREFIX}${id}`); if (ph) S.io?.unobserve(ph); } catch (_) {}
339
343
  mutate(() => {
340
344
  best.setAttribute(A_ANCHOR, newKey);
341
345
  best.setAttribute(A_CREATED, String(ts()));