nodebb-plugin-ezoic-infinite 1.4.79 → 1.4.81

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 +20 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-ezoic-infinite",
3
- "version": "1.4.79",
3
+ "version": "1.4.81",
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
@@ -283,11 +283,15 @@
283
283
  if (typeof ez.showAds !== 'function') return;
284
284
 
285
285
  window.__nodebbEzoicPatched = true;
286
+ console.log('[NODEBB-EZOIC] Patch Ezoic appliqué !');
286
287
  const orig = ez.showAds;
287
288
 
288
289
  ez.showAds = function (arg) {
290
+ console.log('[NODEBB-EZOIC] showAds() appelé, arg:', arg, 'BLOCKED:', EZOIC_BLOCKED);
291
+
289
292
  // CRITIQUE: Bloquer TOUS appels si navigation en cours
290
293
  if (EZOIC_BLOCKED) {
294
+ console.log('[NODEBB-EZOIC] showAds() BLOQUÉ par flag');
291
295
  return; // Ignorer complètement
292
296
  }
293
297
 
@@ -410,6 +414,13 @@
410
414
 
411
415
  clearTimeout(batchShowAdsTimer);
412
416
  batchShowAdsTimer = setTimeout(() => {
417
+ // CRITIQUE: Vérifier que nous sommes toujours sur la même page
418
+ const currentPageKey = getPageKey();
419
+ if (state.pageKey && currentPageKey !== state.pageKey) {
420
+ pendingShowAdsIds.clear();
421
+ return; // Page a changé, annuler
422
+ }
423
+
413
424
  if (pendingShowAdsIds.size === 0) return;
414
425
 
415
426
  const idsArray = Array.from(pendingShowAdsIds);
@@ -619,8 +630,12 @@
619
630
  }
620
631
 
621
632
  function cleanup() {
633
+ // DEBUG: Vérifier que cleanup est appelé
634
+ console.log('[NODEBB-EZOIC] cleanup() appelé');
635
+
622
636
  // CRITIQUE: BLOQUER Ezoic immédiatement
623
637
  EZOIC_BLOCKED = true;
638
+ console.log('[NODEBB-EZOIC] EZOIC_BLOCKED = true');
624
639
 
625
640
  // Détruire TOUS les placeholders Ezoic AVANT de supprimer DOM
626
641
  // Pour annuler la queue interne d'Ezoic
@@ -634,6 +649,11 @@
634
649
  }
635
650
  });
636
651
 
652
+ // CRITIQUE: Supprimer IDs de sessionDefinedIds IMMÉDIATEMENT
653
+ // Pour que le filtre validIds ne les trouve pas
654
+ console.log('[NODEBB-EZOIC] Suppression IDs de sessionDefinedIds:', allIds);
655
+ allIds.forEach(id => sessionDefinedIds.delete(id));
656
+
637
657
  if (allIds.length > 0) {
638
658
  destroyPlaceholderIds(allIds); // Dire à Ezoic d'arrêter
639
659
  }