nodebb-plugin-ezoic-infinite 1.4.14 → 1.4.16

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 +11 -27
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-ezoic-infinite",
3
- "version": "1.4.14",
3
+ "version": "1.4.16",
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
@@ -12,7 +12,7 @@
12
12
  const WRAP_CLASS = 'ezoic-ad';
13
13
  const PLACEHOLDER_PREFIX = 'ezoic-pub-ad-placeholder-';
14
14
 
15
- const MAX_INSERTS_PER_RUN = 2;
15
+ const MAX_INSERTS_PER_RUN = 3;
16
16
 
17
17
  // IDs ayant été définis par Ezoic au moins une fois dans cette session navigateur.
18
18
  // Survit aux navigations ajaxify (contrairement à state.definedIds remis à zéro dans cleanup).
@@ -680,20 +680,6 @@
680
680
  }
681
681
 
682
682
  enforceNoAdjacentAds();
683
-
684
- // Forcer Ezoic à re-scanner les placeholders et recalculer le contenu
685
- // après insertion de nouveaux wrappers (nécessaire pour infinite scroll)
686
- if (inserted > 0) {
687
- try {
688
- if (window.ezstandalone && typeof window.ezstandalone.defineSlots === 'function') {
689
- // defineSlots() force un re-scan sans l'erreur "cannot call refresh"
690
- window.ezstandalone.defineSlots();
691
- }
692
- } catch (e) {
693
- // Fallback silencieux si defineSlots n'existe pas
694
- }
695
- }
696
-
697
683
  scheduleRefill(250);
698
684
 
699
685
  // If nothing inserted and list isn't in DOM yet (first click), retry a bit
@@ -749,33 +735,31 @@
749
735
  $(window).on('action:ajaxify.end.ezoicInfinite', () => {
750
736
  state.pageKey = getPageKey();
751
737
  ensureObserver();
752
- scheduleRun();
753
- setTimeout(scheduleRun, 200);
754
- setTimeout(scheduleRun, 700);
738
+ // Attendre que le DOM soit stable avant d'insérer
739
+ setTimeout(scheduleRun, 150);
740
+ setTimeout(scheduleRun, 500);
755
741
  });
756
742
 
757
743
  $(window).on('action:category.loaded.ezoicInfinite', () => {
758
744
  ensureObserver();
759
- scheduleRun();
760
- setTimeout(scheduleRun, 250);
745
+ // category.loaded se déclenche après ajaxify.end, ne pas dupliquer
746
+ setTimeout(scheduleRun, 100);
761
747
  });
762
748
 
763
749
  $(window).on('action:topics.loaded.ezoicInfinite', () => {
764
750
  ensureObserver();
765
- scheduleRun();
766
- setTimeout(scheduleRun, 150);
751
+ setTimeout(scheduleRun, 100);
767
752
  });
768
753
 
769
754
  $(window).on('action:topic.loaded.ezoicInfinite', () => {
770
755
  ensureObserver();
771
- scheduleRun();
772
- setTimeout(scheduleRun, 200);
756
+ setTimeout(scheduleRun, 100);
773
757
  });
774
758
 
775
759
  $(window).on('action:posts.loaded.ezoicInfinite', () => {
776
760
  ensureObserver();
777
- scheduleRun();
778
- setTimeout(scheduleRun, 150);
761
+ // posts.loaded = infinite scroll, attendre un peu pour éviter trop de runs rapprochés
762
+ setTimeout(scheduleRun, 200);
779
763
  });
780
764
  }
781
765
 
@@ -804,5 +788,5 @@
804
788
  ensureObserver();
805
789
  state.pageKey = getPageKey();
806
790
  scheduleRun();
807
- setTimeout(scheduleRun, 250);
791
+ setTimeout(scheduleRun, 300);
808
792
  })();