nodebb-plugin-ezoic-infinite 1.7.11 → 1.7.13

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 +17 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-ezoic-infinite",
3
- "version": "1.7.11",
3
+ "version": "1.7.13",
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
@@ -1,5 +1,5 @@
1
1
  /**
2
- * NodeBB Ezoic Infinite Ads — client.js v22
2
+ * NodeBB Ezoic Infinite Ads — client.js v23
3
3
  *
4
4
  * Correctifs critiques vs v19
5
5
  * ───────────────────────────
@@ -317,24 +317,32 @@
317
317
 
318
318
  /**
319
319
  * Deux wraps adjacents = situation anormale → supprimer le moins prioritaire.
320
- * Priorité : filled > en grâce (fill en cours) > vide.
321
- * Ne supprime jamais un wrap dont showAds() date de moins de FILL_GRACE_MS.
320
+ * Règles absolues :
321
+ * - Jamais supprimer un wrap filled (pub affichée)
322
+ * - Jamais supprimer un wrap < FILL_GRACE_MS depuis création OU depuis showAds
323
+ * (le fill Ezoic est async : l'enchère SSP peut prendre plusieurs secondes
324
+ * après showAds, et showAds lui-même peut arriver bien après l'injection)
325
+ * - Si les deux sont filled → on ne touche rien
322
326
  */
323
327
  function decluster(klass) {
324
328
  for (const w of document.querySelectorAll(`.${WRAP_CLASS}.${klass}`)) {
325
- // Grace sur le wrap courant : on le saute entièrement
329
+ if (isFilled(w)) continue; // filled = intouchable
330
+ const wCreated = parseInt(w.getAttribute(A_CREATED) || '0', 10);
331
+ if (ts() - wCreated < FILL_GRACE_MS) continue; // trop récent
326
332
  const wShown = parseInt(w.getAttribute(A_SHOWN) || '0', 10);
327
- if (wShown && ts() - wShown < FILL_GRACE_MS) continue;
333
+ if (wShown && ts() - wShown < FILL_GRACE_MS) continue; // showAds récent
328
334
 
329
335
  let prev = w.previousElementSibling, steps = 0;
330
336
  while (prev && steps++ < 3) {
331
337
  if (!prev.classList?.contains(WRAP_CLASS)) { prev = prev.previousElementSibling; continue; }
332
-
338
+ if (isFilled(prev)) break; // précédent filled = intouchable
339
+ const pCreated = parseInt(prev.getAttribute(A_CREATED) || '0', 10);
340
+ if (ts() - pCreated < FILL_GRACE_MS) break;
333
341
  const pShown = parseInt(prev.getAttribute(A_SHOWN) || '0', 10);
334
- if (pShown && ts() - pShown < FILL_GRACE_MS) break; // précédent en grâce → rien
342
+ if (pShown && ts() - pShown < FILL_GRACE_MS) break;
335
343
 
336
- if (!isFilled(w)) mutate(() => dropWrap(w));
337
- else if (!isFilled(prev)) mutate(() => dropWrap(prev));
344
+ // Les deux vides et hors grâce → supprimer le courant
345
+ mutate(() => dropWrap(w));
338
346
  break;
339
347
  }
340
348
  }