nodebb-plugin-ezoic-infinite 1.4.13 → 1.4.15
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.
- package/package.json +1 -1
- package/public/client.js +33 -20
package/package.json
CHANGED
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 =
|
|
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).
|
|
@@ -681,16 +681,31 @@
|
|
|
681
681
|
|
|
682
682
|
enforceNoAdjacentAds();
|
|
683
683
|
|
|
684
|
-
// Forcer Ezoic à
|
|
685
|
-
//
|
|
684
|
+
// Forcer Ezoic à re-scanner les placeholders et recalculer le contenu
|
|
685
|
+
// après insertion de nouveaux wrappers (nécessaire pour infinite scroll)
|
|
686
686
|
if (inserted > 0) {
|
|
687
687
|
try {
|
|
688
|
-
if (window.ezstandalone
|
|
689
|
-
window.ezstandalone.
|
|
690
|
-
|
|
691
|
-
window.ezstandalone.
|
|
688
|
+
if (window.ezstandalone) {
|
|
689
|
+
if (typeof window.ezstandalone.defineSlots === 'function') {
|
|
690
|
+
window.ezstandalone.defineSlots();
|
|
691
|
+
} else if (typeof window.ezstandalone.refresh === 'function') {
|
|
692
|
+
// Fallback : refresh() via cmd queue pour éviter l'erreur "cannot call refresh"
|
|
693
|
+
window.ezstandalone.cmd = window.ezstandalone.cmd || [];
|
|
694
|
+
window.ezstandalone.cmd.push(() => {
|
|
695
|
+
try {
|
|
696
|
+
if (typeof window.ezstandalone.refresh === 'function') {
|
|
697
|
+
window.ezstandalone.refresh();
|
|
698
|
+
}
|
|
699
|
+
} catch (e) {}
|
|
700
|
+
});
|
|
701
|
+
} else {
|
|
702
|
+
// Aucune méthode de refresh disponible - Ezoic ne recalculera pas le contenu
|
|
703
|
+
console.warn('[Ezoic Plugin] Neither defineSlots nor refresh available - ads may not load on scroll');
|
|
704
|
+
}
|
|
692
705
|
}
|
|
693
|
-
} catch (e) {
|
|
706
|
+
} catch (e) {
|
|
707
|
+
console.error('[Ezoic Plugin] Error calling Ezoic refresh:', e);
|
|
708
|
+
}
|
|
694
709
|
}
|
|
695
710
|
|
|
696
711
|
scheduleRefill(250);
|
|
@@ -748,33 +763,31 @@
|
|
|
748
763
|
$(window).on('action:ajaxify.end.ezoicInfinite', () => {
|
|
749
764
|
state.pageKey = getPageKey();
|
|
750
765
|
ensureObserver();
|
|
751
|
-
|
|
752
|
-
setTimeout(scheduleRun,
|
|
753
|
-
setTimeout(scheduleRun,
|
|
766
|
+
// Attendre que le DOM soit stable avant d'insérer
|
|
767
|
+
setTimeout(scheduleRun, 150);
|
|
768
|
+
setTimeout(scheduleRun, 500);
|
|
754
769
|
});
|
|
755
770
|
|
|
756
771
|
$(window).on('action:category.loaded.ezoicInfinite', () => {
|
|
757
772
|
ensureObserver();
|
|
758
|
-
|
|
759
|
-
setTimeout(scheduleRun,
|
|
773
|
+
// category.loaded se déclenche après ajaxify.end, ne pas dupliquer
|
|
774
|
+
setTimeout(scheduleRun, 100);
|
|
760
775
|
});
|
|
761
776
|
|
|
762
777
|
$(window).on('action:topics.loaded.ezoicInfinite', () => {
|
|
763
778
|
ensureObserver();
|
|
764
|
-
scheduleRun
|
|
765
|
-
setTimeout(scheduleRun, 150);
|
|
779
|
+
setTimeout(scheduleRun, 100);
|
|
766
780
|
});
|
|
767
781
|
|
|
768
782
|
$(window).on('action:topic.loaded.ezoicInfinite', () => {
|
|
769
783
|
ensureObserver();
|
|
770
|
-
scheduleRun
|
|
771
|
-
setTimeout(scheduleRun, 200);
|
|
784
|
+
setTimeout(scheduleRun, 100);
|
|
772
785
|
});
|
|
773
786
|
|
|
774
787
|
$(window).on('action:posts.loaded.ezoicInfinite', () => {
|
|
775
788
|
ensureObserver();
|
|
776
|
-
|
|
777
|
-
setTimeout(scheduleRun,
|
|
789
|
+
// posts.loaded = infinite scroll, attendre un peu pour éviter trop de runs rapprochés
|
|
790
|
+
setTimeout(scheduleRun, 200);
|
|
778
791
|
});
|
|
779
792
|
}
|
|
780
793
|
|
|
@@ -803,5 +816,5 @@
|
|
|
803
816
|
ensureObserver();
|
|
804
817
|
state.pageKey = getPageKey();
|
|
805
818
|
scheduleRun();
|
|
806
|
-
setTimeout(scheduleRun,
|
|
819
|
+
setTimeout(scheduleRun, 300);
|
|
807
820
|
})();
|