nodebb-plugin-ezoic-infinite 1.4.75 → 1.4.76

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 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-ezoic-infinite",
3
- "version": "1.4.75",
3
+ "version": "1.4.76",
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
@@ -142,10 +142,15 @@
142
142
  const ph = wrapper.querySelector('[id^="ezoic-pub-ad-placeholder-"]');
143
143
  if (!ph) return;
144
144
 
145
- // ULTRA-AGRESSIF: Supprimer TOUT sauf le placeholder
145
+ // SÉCURISÉ: Supprimer TOUT sauf le placeholder
146
+ // CRITIQUE: Ne JAMAIS toucher au placeholder ou ses enfants
146
147
  Array.from(wrapper.children).forEach(child => {
147
- if (child === ph || child.contains(ph)) return;
148
- // Supprimer TOUT le reste
148
+ // Vérifier que ce n'est PAS le placeholder
149
+ if (child === ph) return;
150
+ if (child.contains(ph)) return;
151
+ if (child.id && child.id.startsWith('ezoic-pub-ad-placeholder-')) return;
152
+
153
+ // Supprimer le reste
149
154
  child.remove();
150
155
  });
151
156
 
@@ -379,6 +384,14 @@
379
384
  const idsArray = Array.from(pendingShowAdsIds);
380
385
  pendingShowAdsIds.clear();
381
386
 
387
+ // CRITIQUE: Vérifier que placeholders existent encore
388
+ const validIds = idsArray.filter(id => {
389
+ const ph = document.getElementById(`${PLACEHOLDER_PREFIX}${id}`);
390
+ return ph && ph.isConnected;
391
+ });
392
+
393
+ if (validIds.length === 0) return;
394
+
382
395
  // Appeler showAds avec TOUS les IDs en une fois
383
396
  try {
384
397
  window.ezstandalone = window.ezstandalone || {};
@@ -386,9 +399,9 @@
386
399
  window.ezstandalone.cmd.push(function() {
387
400
  if (typeof window.ezstandalone.showAds === 'function') {
388
401
  // Appel batch: showAds(id1, id2, id3...)
389
- window.ezstandalone.showAds(...idsArray);
402
+ window.ezstandalone.showAds(...validIds);
390
403
  // Tracker tous les IDs
391
- idsArray.forEach(id => {
404
+ validIds.forEach(id => {
392
405
  state.lastShowById.set(id, Date.now());
393
406
  sessionDefinedIds.add(id);
394
407
  });
@@ -399,7 +412,7 @@
399
412
  // CRITIQUE: Nettoyer éléments invisibles APRÈS que pubs soient chargées
400
413
  setTimeout(() => {
401
414
  cleanupInvisibleEzoicElements();
402
- }, 800); // 1.5s pour laisser Ezoic charger
415
+ }, 1500); // 1.5s pour laisser Ezoic charger
403
416
  }, 100);
404
417
  }
405
418