nodebb-plugin-ezoic-infinite 1.4.29 → 1.4.31
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 +16 -3
package/package.json
CHANGED
package/public/client.js
CHANGED
|
@@ -328,6 +328,9 @@
|
|
|
328
328
|
|
|
329
329
|
function callShowAdsWhenReady(id) {
|
|
330
330
|
if (!id) return;
|
|
331
|
+
if (window.location.pathname !== '/') {
|
|
332
|
+
console.log('[AJAXIFY] callShowAdsWhenReady ID:', id);
|
|
333
|
+
}
|
|
331
334
|
|
|
332
335
|
const now = Date.now(), last = state.lastShowById.get(id) || 0;
|
|
333
336
|
if (now - last < 3500) return;
|
|
@@ -354,6 +357,9 @@
|
|
|
354
357
|
attempts += 1;
|
|
355
358
|
const el = document.getElementById(phId);
|
|
356
359
|
if (el && el.isConnected) {
|
|
360
|
+
if (window.location.pathname !== '/') {
|
|
361
|
+
console.log('[AJAXIFY] Placeholder', id, 'trouvé, appel showAds');
|
|
362
|
+
}
|
|
357
363
|
// Si doCall() réussit, Ezoic est chargé et showAds a été appelé → sortir
|
|
358
364
|
if (doCall()) {
|
|
359
365
|
state.pendingById.delete(id); // nettoyage au cas où
|
|
@@ -470,6 +476,8 @@
|
|
|
470
476
|
usedSet.add(id);
|
|
471
477
|
wrap = insertAfter(el, id, kindClass, afterPos);
|
|
472
478
|
if (!wrap) continue;
|
|
479
|
+
// Micro-délai pour laisser le DOM se synchroniser
|
|
480
|
+
setTimeout(() => callShowAdsWhenReady(id), 10);
|
|
473
481
|
}
|
|
474
482
|
|
|
475
483
|
liveArr.push({ id, wrap });
|
|
@@ -485,9 +493,6 @@
|
|
|
485
493
|
}
|
|
486
494
|
continue;
|
|
487
495
|
}
|
|
488
|
-
if (!(pick.recycled && pick.recycled.wrap)) {
|
|
489
|
-
callShowAdsWhenReady(id);
|
|
490
|
-
}
|
|
491
496
|
inserted += 1;
|
|
492
497
|
}
|
|
493
498
|
return inserted;
|
|
@@ -554,6 +559,8 @@
|
|
|
554
559
|
}
|
|
555
560
|
|
|
556
561
|
async function runCore() {
|
|
562
|
+
const isAjaxify = window.location.pathname !== '/';
|
|
563
|
+
if (isAjaxify) console.log('[AJAXIFY] runCore - pageKey:', state.pageKey);
|
|
557
564
|
patchShowAds();
|
|
558
565
|
|
|
559
566
|
const cfg = await fetchConfig();
|
|
@@ -590,6 +597,10 @@
|
|
|
590
597
|
}
|
|
591
598
|
}
|
|
592
599
|
|
|
600
|
+
if (window.location.pathname !== '/') {
|
|
601
|
+
console.log('[AJAXIFY] Inserted:', inserted, 'wrappers. Items count:', count);
|
|
602
|
+
}
|
|
603
|
+
|
|
593
604
|
enforceNoAdjacentAds();
|
|
594
605
|
|
|
595
606
|
// If nothing inserted and list isn't in DOM yet (first click), retry a bit
|
|
@@ -640,11 +651,13 @@
|
|
|
640
651
|
$(window).on('action:ajaxify.start.ezoicInfinite', () => cleanup());
|
|
641
652
|
|
|
642
653
|
$(window).on('action:ajaxify.end.ezoicInfinite', () => {
|
|
654
|
+
console.log('[AJAXIFY] ajaxify.end - pageKey:', getPageKey());
|
|
643
655
|
state.pageKey = getPageKey();
|
|
644
656
|
ensureObserver();
|
|
645
657
|
|
|
646
658
|
// Attendre que le DOM soit construit par NodeBB
|
|
647
659
|
setTimeout(() => {
|
|
660
|
+
console.log('[AJAXIFY] Après 500ms, appel waitForEzoicThenRun');
|
|
648
661
|
// Puis attendre que Ezoic soit prêt (comme au chargement initial)
|
|
649
662
|
waitForEzoicThenRun();
|
|
650
663
|
}, 500);
|