nodebb-plugin-ezoic-infinite 1.7.14 → 1.7.15

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 +6 -16
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-ezoic-infinite",
3
- "version": "1.7.14",
3
+ "version": "1.7.15",
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 v24
2
+ * NodeBB Ezoic Infinite Ads — client.js v21
3
3
  *
4
4
  * Historique des corrections majeures
5
5
  * ────────────────────────────────────
@@ -36,8 +36,6 @@
36
36
  const A_SHOWN = 'data-ezoic-shown'; // timestamp dernier showAds ms
37
37
 
38
38
  const MIN_PRUNE_AGE_MS = 8_000; // garde-fou post-batch NodeBB
39
- const PRUNE_STABLE_MS = 45_000; // délai avant qu'un wrap vide puisse être purgé
40
- // (évite la suppression lors du scroll up / virtualisation NodeBB)
41
39
  const FILL_GRACE_MS = 25_000; // fenêtre fill async Ezoic (SSP auction)
42
40
  const EMPTY_CHECK_MS = 20_000; // délai collapse wrap vide post-show
43
41
  const MAX_INSERTS_RUN = 6;
@@ -274,12 +272,8 @@
274
272
  if (!meta) return;
275
273
 
276
274
  for (const w of document.querySelectorAll(`.${WRAP_CLASS}.${klass}`)) {
277
- // Ne jamais supprimer un wrap filled
275
+ if (ts() - parseInt(w.getAttribute(A_CREATED) || '0', 10) < MIN_PRUNE_AGE_MS) continue;
278
276
  if (isFilled(w)) continue;
279
- // Attendre PRUNE_STABLE_MS depuis la création : pendant ce délai, l'ancre
280
- // peut avoir temporairement disparu du DOM par virtualisation NodeBB au
281
- // scroll up — ce n'est pas un vrai orphelin.
282
- if (ts() - parseInt(w.getAttribute(A_CREATED) || '0', 10) < PRUNE_STABLE_MS) continue;
283
277
 
284
278
  const key = w.getAttribute(A_ANCHOR) ?? '';
285
279
  const sid = key.slice(klass.length + 1);
@@ -300,23 +294,19 @@
300
294
  */
301
295
  function decluster(klass) {
302
296
  for (const w of document.querySelectorAll(`.${WRAP_CLASS}.${klass}`)) {
303
- // Ne jamais toucher un wrap filled
304
- if (isFilled(w)) continue;
305
- // Protéger par A_CREATED : un wrap récent attend encore son showAds async
306
- if (ts() - parseInt(w.getAttribute(A_CREATED) || '0', 10) < FILL_GRACE_MS) continue;
307
297
  const wShown = parseInt(w.getAttribute(A_SHOWN) || '0', 10);
308
298
  if (wShown && ts() - wShown < FILL_GRACE_MS) continue;
309
299
 
310
300
  let prev = w.previousElementSibling, steps = 0;
311
301
  while (prev && steps++ < 3) {
312
302
  if (!prev.classList?.contains(WRAP_CLASS)) { prev = prev.previousElementSibling; continue; }
313
- if (isFilled(prev)) break;
314
- if (ts() - parseInt(prev.getAttribute(A_CREATED) || '0', 10) < FILL_GRACE_MS) break;
303
+
315
304
  const pShown = parseInt(prev.getAttribute(A_SHOWN) || '0', 10);
316
305
  if (pShown && ts() - pShown < FILL_GRACE_MS) break;
317
306
 
318
- // Les deux vides et hors grâce → supprimer le courant
319
- mutate(() => dropWrap(w));
307
+ if (!isFilled(w)) mutate(() => dropWrap(w));
308
+ else if (!isFilled(prev)) mutate(() => dropWrap(prev));
309
+ // les deux remplis → on ne touche pas
320
310
  break;
321
311
  }
322
312
  }