nodebb-plugin-ezoic-infinite 1.4.78 → 1.4.80
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 +30 -2
package/package.json
CHANGED
package/public/client.js
CHANGED
|
@@ -7,6 +7,9 @@
|
|
|
7
7
|
categoryItem: 'li[component="categories/category"]',
|
|
8
8
|
}, WRAP_CLASS = 'ezoic-ad';
|
|
9
9
|
const PLACEHOLDER_PREFIX = 'ezoic-pub-ad-placeholder-', MAX_INSERTS_PER_RUN = 3;
|
|
10
|
+
|
|
11
|
+
// FLAG GLOBAL: Bloquer Ezoic pendant navigation
|
|
12
|
+
let EZOIC_BLOCKED = false;
|
|
10
13
|
|
|
11
14
|
const sessionDefinedIds = new Set();
|
|
12
15
|
|
|
@@ -283,7 +286,12 @@
|
|
|
283
286
|
const orig = ez.showAds;
|
|
284
287
|
|
|
285
288
|
ez.showAds = function (arg) {
|
|
286
|
-
// CRITIQUE:
|
|
289
|
+
// CRITIQUE: Bloquer TOUS appels si navigation en cours
|
|
290
|
+
if (EZOIC_BLOCKED) {
|
|
291
|
+
return; // Ignorer complètement
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
// Filtrer IDs dont placeholders n'existent pas
|
|
287
295
|
const filterValidIds = (ids) => {
|
|
288
296
|
return ids.filter(id => {
|
|
289
297
|
const phId = `ezoic-pub-ad-placeholder-${id}`;
|
|
@@ -402,6 +410,13 @@
|
|
|
402
410
|
|
|
403
411
|
clearTimeout(batchShowAdsTimer);
|
|
404
412
|
batchShowAdsTimer = setTimeout(() => {
|
|
413
|
+
// CRITIQUE: Vérifier que nous sommes toujours sur la même page
|
|
414
|
+
const currentPageKey = getPageKey();
|
|
415
|
+
if (state.pageKey && currentPageKey !== state.pageKey) {
|
|
416
|
+
pendingShowAdsIds.clear();
|
|
417
|
+
return; // Page a changé, annuler
|
|
418
|
+
}
|
|
419
|
+
|
|
405
420
|
if (pendingShowAdsIds.size === 0) return;
|
|
406
421
|
|
|
407
422
|
const idsArray = Array.from(pendingShowAdsIds);
|
|
@@ -611,7 +626,10 @@
|
|
|
611
626
|
}
|
|
612
627
|
|
|
613
628
|
function cleanup() {
|
|
614
|
-
// CRITIQUE:
|
|
629
|
+
// CRITIQUE: BLOQUER Ezoic immédiatement
|
|
630
|
+
EZOIC_BLOCKED = true;
|
|
631
|
+
|
|
632
|
+
// Détruire TOUS les placeholders Ezoic AVANT de supprimer DOM
|
|
615
633
|
// Pour annuler la queue interne d'Ezoic
|
|
616
634
|
const allWrappers = document.querySelectorAll('.ezoic-ad');
|
|
617
635
|
const allIds = [];
|
|
@@ -623,6 +641,10 @@
|
|
|
623
641
|
}
|
|
624
642
|
});
|
|
625
643
|
|
|
644
|
+
// CRITIQUE: Supprimer IDs de sessionDefinedIds IMMÉDIATEMENT
|
|
645
|
+
// Pour que le filtre validIds ne les trouve pas
|
|
646
|
+
allIds.forEach(id => sessionDefinedIds.delete(id));
|
|
647
|
+
|
|
626
648
|
if (allIds.length > 0) {
|
|
627
649
|
destroyPlaceholderIds(allIds); // Dire à Ezoic d'arrêter
|
|
628
650
|
}
|
|
@@ -758,6 +780,12 @@
|
|
|
758
780
|
|
|
759
781
|
$(window).on('action:ajaxify.end.ezoicInfinite', () => {
|
|
760
782
|
state.pageKey = getPageKey();
|
|
783
|
+
|
|
784
|
+
// Débloquer Ezoic après délai pour laisser DOM se stabiliser
|
|
785
|
+
setTimeout(() => {
|
|
786
|
+
EZOIC_BLOCKED = false;
|
|
787
|
+
}, 200);
|
|
788
|
+
|
|
761
789
|
ensureObserver();
|
|
762
790
|
|
|
763
791
|
state.canShowAds = true;
|