nodebb-plugin-ezoic-infinite 1.4.45 → 1.4.47

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 +9 -21
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-ezoic-infinite",
3
- "version": "1.4.45",
3
+ "version": "1.4.47",
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
@@ -357,27 +357,10 @@
357
357
  const el = document.getElementById(phId);
358
358
  if (el && el.isConnected) {
359
359
  // CRITIQUE: Vérifier que le placeholder est VISIBLE
360
- // Ezoic refuse les placeholders invisibles (offsetHeight = 0)
361
- if (el.offsetHeight === 0 && attempts < 100) {
362
- // Pas encore visible, réessayer
363
- if (attempts % 10 === 0) {
364
- console.log('[OFFSET] ID', id, 'invisible après', attempts, 'tentatives, height:', el.offsetHeight, 'display:', window.getComputedStyle(el).display);
365
- }
366
- const timeoutId = setTimeout(waitForPh, 50);
367
- state.activeTimeouts.add(timeoutId);
368
- return;
369
- }
360
+
370
361
 
371
362
  // Si on arrive ici, soit visible, soit timeout
372
- if (el.offsetHeight === 0) {
373
- console.log('[OFFSET] ID', id, 'TIMEOUT après', attempts, 'tentatives - height:', el.offsetHeight, 'display:', window.getComputedStyle(el).display, 'parent:', el.parentElement?.tagName);
374
- }
375
-
376
- // Double-check pageKey juste avant doCall (au cas où cleanup appelé entre-temps)
377
- if (state.pageKey !== startPageKey) {
378
- // Note: les timeouts seront nettoyés par cleanup()
379
- return;
380
- }
363
+
381
364
 
382
365
  // Si doCall() réussit, Ezoic est chargé et showAds a été appelé → sortir
383
366
  if (doCall()) {
@@ -573,8 +556,13 @@
573
556
 
574
557
  // CRITIQUE: Annuler TOUS les timeouts en cours pour éviter que les anciens
575
558
  // showAds() continuent à s'exécuter après la navigation
576
- state.activeTimeouts.forEach(id => clearTimeout(id));
559
+ state.activeTimeouts.forEach(id => {
560
+ try { clearTimeout(id); } catch (e) {}
561
+ });
577
562
  state.activeTimeouts.clear();
563
+
564
+ // Vider aussi pendingById pour annuler les showAds en attente
565
+ state.pendingById.clear();
578
566
 
579
567
  if (state.obs) { state.obs.disconnect(); state.obs = null; }
580
568
  state.canShowAds = false;
@@ -690,7 +678,7 @@
690
678
  state.canShowAds = false;
691
679
  setTimeout(() => {
692
680
  state.canShowAds = true;
693
- }, 500);
681
+ }, 2000);
694
682
  });
695
683
 
696
684
  $(window).on('action:category.loaded.ezoicInfinite', () => {