nodebb-plugin-ezoic-infinite 1.4.24 → 1.4.26
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 +23 -27
package/package.json
CHANGED
package/public/client.js
CHANGED
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
}, WRAP_CLASS = 'ezoic-ad';
|
|
11
11
|
const PLACEHOLDER_PREFIX = 'ezoic-pub-ad-placeholder-', MAX_INSERTS_PER_RUN = 3;
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
|
|
14
|
+
|
|
15
15
|
// Nécessaire pour savoir si on doit appeler destroyPlaceholders avant recyclage.
|
|
16
16
|
const sessionDefinedIds = new Set();
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
|
|
19
19
|
const insertingIds = new Set(), state = {
|
|
20
20
|
pageKey: null,
|
|
21
21
|
cfg: null,
|
|
@@ -164,7 +164,7 @@
|
|
|
164
164
|
try {
|
|
165
165
|
if (!wrap) return;
|
|
166
166
|
try { wrap.removeAttribute('data-ezoic-filled'); } catch (e) {}
|
|
167
|
-
|
|
167
|
+
if (wrap.__ezoicFillObs) { wrap.__ezoicFillObs.disconnect(); wrap.__ezoicFillObs = null; }
|
|
168
168
|
const old = wrap.querySelector && wrap.querySelector(`#${PLACEHOLDER_PREFIX}${id}`);
|
|
169
169
|
if (old) old.remove();
|
|
170
170
|
// Remove any leftover markup inside wrapper
|
|
@@ -279,7 +279,7 @@
|
|
|
279
279
|
try {
|
|
280
280
|
if (!wrap) return;
|
|
281
281
|
// Disconnect the fill observer first (no need to remove+re-add the attribute)
|
|
282
|
-
|
|
282
|
+
if (wrap.__ezoicFillObs) { wrap.__ezoicFillObs.disconnect(); wrap.__ezoicFillObs = null; }
|
|
283
283
|
wrap.setAttribute('data-ezoic-filled', '1');
|
|
284
284
|
} catch (e) {}
|
|
285
285
|
}
|
|
@@ -326,10 +326,6 @@
|
|
|
326
326
|
return filled;
|
|
327
327
|
}
|
|
328
328
|
|
|
329
|
-
function scheduleRefill(delay = 350) {
|
|
330
|
-
state.retryTimer = setTimeout(refillUnfilled, delay);
|
|
331
|
-
}
|
|
332
|
-
|
|
333
329
|
function callShowAdsWhenReady(id) {
|
|
334
330
|
if (!id) return;
|
|
335
331
|
|
|
@@ -542,13 +538,15 @@
|
|
|
542
538
|
state.liveMessage = [];
|
|
543
539
|
state.liveCategory = [];
|
|
544
540
|
|
|
545
|
-
state.lastShowById
|
|
546
|
-
state.pendingById
|
|
547
|
-
state.definedIds
|
|
541
|
+
state.lastShowById.clear();
|
|
542
|
+
state.pendingById.clear();
|
|
543
|
+
state.definedIds.clear();
|
|
548
544
|
|
|
549
|
-
|
|
545
|
+
// NE PAS supprimer les wrappers Ezoic ici - ils seront supprimés naturellement
|
|
546
|
+
// quand NodeBB vide le DOM lors de la navigation ajaxify
|
|
547
|
+
// Les supprimer manuellement cause des problèmes avec l'état interne d'Ezoic
|
|
550
548
|
|
|
551
|
-
if (state.obs) {
|
|
549
|
+
if (state.obs) { state.obs.disconnect(); state.obs = null; }
|
|
552
550
|
state.scheduled = false;
|
|
553
551
|
clearTimeout(state.timer);
|
|
554
552
|
state.timer = null;
|
|
@@ -649,19 +647,17 @@
|
|
|
649
647
|
$(window).on('action:ajaxify.end.ezoicInfinite', () => {
|
|
650
648
|
state.pageKey = getPageKey();
|
|
651
649
|
ensureObserver();
|
|
652
|
-
|
|
653
|
-
//
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
setTimeout(scheduleRun, 500);
|
|
664
|
-
setTimeout(scheduleRun, 1000);
|
|
650
|
+
|
|
651
|
+
// Attendre que NodeBB ait fini de construire le DOM
|
|
652
|
+
// (ajaxify.end se déclenche avant que le contenu soit vraiment prêt)
|
|
653
|
+
setTimeout(() => {
|
|
654
|
+
scheduleRun();
|
|
655
|
+
}, 800);
|
|
656
|
+
|
|
657
|
+
// Second pass pour être sûr
|
|
658
|
+
setTimeout(() => {
|
|
659
|
+
scheduleRun();
|
|
660
|
+
}, 1500);
|
|
665
661
|
});
|
|
666
662
|
|
|
667
663
|
$(window).on('action:category.loaded.ezoicInfinite', () => {
|