nodebb-plugin-ezoic-infinite 1.4.37 → 1.4.38

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 +12 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-ezoic-infinite",
3
- "version": "1.4.37",
3
+ "version": "1.4.38",
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
@@ -352,12 +352,22 @@
352
352
  if (state.pageKey !== startPageKey) return;
353
353
  // Abort if another concurrent call is already handling this id
354
354
  if (state.pendingById.has(id)) return;
355
+
355
356
  attempts += 1;
356
357
  const el = document.getElementById(phId);
357
358
  if (el && el.isConnected) {
358
359
  if (window.location.pathname !== '/') {
359
360
  console.log('[TIMING] Placeholder', id, 'trouvé dans DOM, appel showAds');
360
361
  }
362
+
363
+ // Double-check pageKey juste avant doCall (au cas où cleanup appelé entre-temps)
364
+ if (state.pageKey !== startPageKey) {
365
+ if (window.location.pathname !== '/') {
366
+ console.log('[TIMING] ABORT ID', id, '- navigation détectée avant showAds');
367
+ }
368
+ return;
369
+ }
370
+
361
371
  // Si doCall() réussit, Ezoic est chargé et showAds a été appelé → sortir
362
372
  if (doCall()) {
363
373
  state.pendingById.delete(id); // nettoyage au cas où
@@ -537,6 +547,8 @@
537
547
  state.liveCategory = [];
538
548
 
539
549
  state.lastShowById.clear();
550
+ // CRITIQUE: Vider pendingById pour annuler tous les showAds en cours
551
+ // Sinon Ezoic essaie d'accéder aux placeholders pendant que NodeBB vide le DOM
540
552
  state.pendingById.clear();
541
553
  state.definedIds.clear();
542
554