nodebb-plugin-ezoic-infinite 1.4.21 → 1.4.22

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 +23 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-ezoic-infinite",
3
- "version": "1.4.21",
3
+ "version": "1.4.22",
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
@@ -414,6 +414,9 @@
414
414
  let scheduledAny = false;
415
415
 
416
416
  for (const wrap of wraps) {
417
+ // Skip les wrappers cachés par enforceNoAdjacentAds
418
+ if (wrap.style && wrap.style.display === 'none') continue;
419
+
417
420
  const ph = wrap.querySelector && wrap.querySelector(`[id^="${PLACEHOLDER_PREFIX}"]`);
418
421
  if (!ph) continue;
419
422
  const id = parseInt(ph.id.replace(PLACEHOLDER_PREFIX, ''), 10);
@@ -624,7 +627,10 @@
624
627
  continue;
625
628
  }
626
629
  if (!(pick.recycled && pick.recycled.wrap)) {
627
- callShowAdsWhenReady(id);
630
+ // Ne pas appeler showAds si cet ID a déjà été blacklisté
631
+ if (!state.badIds.has(id)) {
632
+ callShowAdsWhenReady(id);
633
+ }
628
634
  }
629
635
  inserted += 1;
630
636
  }
@@ -636,8 +642,22 @@
636
642
  for (let i = 0; i < ads.length; i++) {
637
643
  const ad = ads[i];
638
644
  const prev = ad.previousElementSibling;
639
- if (prev && prev.classList && prev.classList.contains(WRAP_CLASS)) ad.style.display = 'none';
640
- else ad.style.display = '';
645
+ if (prev && prev.classList && prev.classList.contains(WRAP_CLASS)) {
646
+ // Supprimer le wrapper adjacent au lieu de le cacher
647
+ try {
648
+ const ph = ad.querySelector && ad.querySelector(`[id^="${PLACEHOLDER_PREFIX}"]`);
649
+ if (ph) {
650
+ const id = parseInt(ph.id.replace(PLACEHOLDER_PREFIX, ''), 10);
651
+ if (Number.isFinite(id) && id > 0) {
652
+ // Détruire le placeholder si Ezoic l'a déjà défini
653
+ if (sessionDefinedIds.has(id)) {
654
+ destroyPlaceholderIds([id]);
655
+ }
656
+ }
657
+ }
658
+ ad.remove();
659
+ } catch (e) {}
660
+ }
641
661
  }
642
662
  }
643
663