nodebb-plugin-ezoic-infinite 1.4.11 → 1.4.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 +19 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-ezoic-infinite",
3
- "version": "1.4.11",
3
+ "version": "1.4.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
@@ -366,7 +366,10 @@
366
366
  resetPlaceholderInWrap(wrapNow, id);
367
367
  attachFillObserver(wrapNow, id);
368
368
  }
369
- callShowAdsWhenReady(id);
369
+ // Ne pas appeler showAds si un autre appel est déjà en cours pour cet ID
370
+ if (!state.pendingById.has(id)) {
371
+ callShowAdsWhenReady(id);
372
+ }
370
373
  setTimeout(step, 1100);
371
374
  };
372
375
 
@@ -554,7 +557,8 @@
554
557
  try { oldWrap && oldWrap.remove(); } catch (e) {}
555
558
  wrap = insertAfter(el, id, kindClass, afterPos);
556
559
  if (!wrap) continue;
557
- setTimeout(() => { enqueueRetry(id); }, 450);
560
+ // Attendre 1500ms après destroy pour laisser Ezoic finir son cleanup interne
561
+ setTimeout(() => { enqueueRetry(id); }, 1500);
558
562
  } else {
559
563
  usedSet.add(id);
560
564
  wrap = insertAfter(el, id, kindClass, afterPos);
@@ -676,6 +680,19 @@
676
680
  }
677
681
 
678
682
  enforceNoAdjacentAds();
683
+
684
+ // Forcer Ezoic à recalculer le nombre de mots après insertion de nouveaux wrappers
685
+ // Nécessaire pour infinite scroll : Ezoic ne recalcule pas automatiquement
686
+ if (inserted > 0) {
687
+ try {
688
+ if (window.ezstandalone && typeof window.ezstandalone.refresh === 'function') {
689
+ window.ezstandalone.refresh();
690
+ } else if (window.ezstandalone && typeof window.ezstandalone.updateContent === 'function') {
691
+ window.ezstandalone.updateContent();
692
+ }
693
+ } catch (e) {}
694
+ }
695
+
679
696
  scheduleRefill(250);
680
697
 
681
698
  // If nothing inserted and list isn't in DOM yet (first click), retry a bit