nodebb-plugin-ezoic-infinite 1.4.14 → 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 +29 -17
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).
|
|
@@ -685,12 +685,26 @@
|
|
|
685
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
|
-
|
|
690
|
-
|
|
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
|
+
}
|
|
691
705
|
}
|
|
692
706
|
} catch (e) {
|
|
693
|
-
|
|
707
|
+
console.error('[Ezoic Plugin] Error calling Ezoic refresh:', e);
|
|
694
708
|
}
|
|
695
709
|
}
|
|
696
710
|
|
|
@@ -749,33 +763,31 @@
|
|
|
749
763
|
$(window).on('action:ajaxify.end.ezoicInfinite', () => {
|
|
750
764
|
state.pageKey = getPageKey();
|
|
751
765
|
ensureObserver();
|
|
752
|
-
|
|
753
|
-
setTimeout(scheduleRun,
|
|
754
|
-
setTimeout(scheduleRun,
|
|
766
|
+
// Attendre que le DOM soit stable avant d'insérer
|
|
767
|
+
setTimeout(scheduleRun, 150);
|
|
768
|
+
setTimeout(scheduleRun, 500);
|
|
755
769
|
});
|
|
756
770
|
|
|
757
771
|
$(window).on('action:category.loaded.ezoicInfinite', () => {
|
|
758
772
|
ensureObserver();
|
|
759
|
-
|
|
760
|
-
setTimeout(scheduleRun,
|
|
773
|
+
// category.loaded se déclenche après ajaxify.end, ne pas dupliquer
|
|
774
|
+
setTimeout(scheduleRun, 100);
|
|
761
775
|
});
|
|
762
776
|
|
|
763
777
|
$(window).on('action:topics.loaded.ezoicInfinite', () => {
|
|
764
778
|
ensureObserver();
|
|
765
|
-
scheduleRun
|
|
766
|
-
setTimeout(scheduleRun, 150);
|
|
779
|
+
setTimeout(scheduleRun, 100);
|
|
767
780
|
});
|
|
768
781
|
|
|
769
782
|
$(window).on('action:topic.loaded.ezoicInfinite', () => {
|
|
770
783
|
ensureObserver();
|
|
771
|
-
scheduleRun
|
|
772
|
-
setTimeout(scheduleRun, 200);
|
|
784
|
+
setTimeout(scheduleRun, 100);
|
|
773
785
|
});
|
|
774
786
|
|
|
775
787
|
$(window).on('action:posts.loaded.ezoicInfinite', () => {
|
|
776
788
|
ensureObserver();
|
|
777
|
-
|
|
778
|
-
setTimeout(scheduleRun,
|
|
789
|
+
// posts.loaded = infinite scroll, attendre un peu pour éviter trop de runs rapprochés
|
|
790
|
+
setTimeout(scheduleRun, 200);
|
|
779
791
|
});
|
|
780
792
|
}
|
|
781
793
|
|
|
@@ -804,5 +816,5 @@
|
|
|
804
816
|
ensureObserver();
|
|
805
817
|
state.pageKey = getPageKey();
|
|
806
818
|
scheduleRun();
|
|
807
|
-
setTimeout(scheduleRun,
|
|
819
|
+
setTimeout(scheduleRun, 300);
|
|
808
820
|
})();
|