nodebb-plugin-ezoic-infinite 1.4.77 → 1.4.79
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 +37 -5
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}`;
|
|
@@ -611,13 +619,31 @@
|
|
|
611
619
|
}
|
|
612
620
|
|
|
613
621
|
function cleanup() {
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
622
|
+
// CRITIQUE: BLOQUER Ezoic immédiatement
|
|
623
|
+
EZOIC_BLOCKED = true;
|
|
624
|
+
|
|
625
|
+
// Détruire TOUS les placeholders Ezoic AVANT de supprimer DOM
|
|
626
|
+
// Pour annuler la queue interne d'Ezoic
|
|
627
|
+
const allWrappers = document.querySelectorAll('.ezoic-ad');
|
|
628
|
+
const allIds = [];
|
|
629
|
+
allWrappers.forEach(wrapper => {
|
|
630
|
+
const ph = wrapper.querySelector('[id^="ezoic-pub-ad-placeholder-"]');
|
|
631
|
+
if (ph) {
|
|
632
|
+
const match = ph.id.match(/\d+/);
|
|
633
|
+
if (match) allIds.push(parseInt(match[0]));
|
|
634
|
+
}
|
|
635
|
+
});
|
|
636
|
+
|
|
637
|
+
if (allIds.length > 0) {
|
|
638
|
+
destroyPlaceholderIds(allIds); // Dire à Ezoic d'arrêter
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
// Annuler batch showAds en attente
|
|
617
642
|
pendingShowAdsIds.clear();
|
|
618
643
|
clearTimeout(batchShowAdsTimer);
|
|
619
644
|
|
|
620
|
-
|
|
645
|
+
// Maintenant supprimer DOM
|
|
646
|
+
allWrappers.forEach(el => {
|
|
621
647
|
try { el.remove(); } catch (e) {}
|
|
622
648
|
});
|
|
623
649
|
|
|
@@ -743,6 +769,12 @@
|
|
|
743
769
|
|
|
744
770
|
$(window).on('action:ajaxify.end.ezoicInfinite', () => {
|
|
745
771
|
state.pageKey = getPageKey();
|
|
772
|
+
|
|
773
|
+
// Débloquer Ezoic après délai pour laisser DOM se stabiliser
|
|
774
|
+
setTimeout(() => {
|
|
775
|
+
EZOIC_BLOCKED = false;
|
|
776
|
+
}, 200);
|
|
777
|
+
|
|
746
778
|
ensureObserver();
|
|
747
779
|
|
|
748
780
|
state.canShowAds = true;
|