nodebb-plugin-ezoic-infinite 1.4.76 → 1.4.77

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 +27 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-ezoic-infinite",
3
- "version": "1.4.76",
3
+ "version": "1.4.77",
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,16 +283,39 @@
283
283
  const orig = ez.showAds;
284
284
 
285
285
  ez.showAds = function (arg) {
286
+ // CRITIQUE: Filtrer IDs dont placeholders n'existent pas
287
+ const filterValidIds = (ids) => {
288
+ return ids.filter(id => {
289
+ const phId = `ezoic-pub-ad-placeholder-${id}`;
290
+ const ph = document.getElementById(phId);
291
+ return ph && ph.isConnected;
292
+ });
293
+ };
294
+
286
295
  if (Array.isArray(arg)) {
287
296
  const seen = new Set();
288
297
  for (const v of arg) {
289
298
  const id = parseInt(v, 10);
290
299
  if (!Number.isFinite(id) || id <= 0 || seen.has(id)) continue;
300
+
301
+ // Vérifier existence avant appel
302
+ const phId = `ezoic-pub-ad-placeholder-${id}`;
303
+ const ph = document.getElementById(phId);
304
+ if (!ph || !ph.isConnected) continue;
305
+
291
306
  seen.add(id);
292
307
  try { orig.call(ez, id); } catch (e) {}
293
308
  }
294
309
  return;
295
310
  }
311
+
312
+ // Pour appels simples, vérifier aussi
313
+ if (typeof arg === 'number') {
314
+ const phId = `ezoic-pub-ad-placeholder-${arg}`;
315
+ const ph = document.getElementById(phId);
316
+ if (!ph || !ph.isConnected) return;
317
+ }
318
+
296
319
  return orig.apply(ez, arguments);
297
320
  };
298
321
  } catch (e) {}
@@ -590,6 +613,10 @@
590
613
  function cleanup() {
591
614
  destroyUsedPlaceholders();
592
615
 
616
+ // CRITIQUE: Annuler batch showAds en attente pour éviter erreurs console
617
+ pendingShowAdsIds.clear();
618
+ clearTimeout(batchShowAdsTimer);
619
+
593
620
  document.querySelectorAll('.ezoic-ad').forEach(el => {
594
621
  try { el.remove(); } catch (e) {}
595
622
  });