nodebb-plugin-ezoic-infinite 1.4.53 → 1.4.55
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 +34 -30
package/package.json
CHANGED
package/public/client.js
CHANGED
|
@@ -33,9 +33,7 @@
|
|
|
33
33
|
|
|
34
34
|
obs: null,
|
|
35
35
|
activeTimeouts: new Set(),
|
|
36
|
-
lastScrollRun: 0,
|
|
37
|
-
__scrollBound: false,
|
|
38
|
-
};
|
|
36
|
+
lastScrollRun: 0, };
|
|
39
37
|
|
|
40
38
|
function normalizeBool(v) {
|
|
41
39
|
return v === true || v === 'true' || v === 1 || v === '1' || v === 'on';
|
|
@@ -551,6 +549,12 @@
|
|
|
551
549
|
function cleanup() {
|
|
552
550
|
destroyUsedPlaceholders();
|
|
553
551
|
|
|
552
|
+
// CRITIQUE: Supprimer TOUS les wrappers .ezoic-ad du DOM
|
|
553
|
+
// Sinon ils restent et deviennent "unused" sur la nouvelle page
|
|
554
|
+
document.querySelectorAll('.ezoic-ad').forEach(el => {
|
|
555
|
+
try { el.remove(); } catch (e) {}
|
|
556
|
+
});
|
|
557
|
+
|
|
554
558
|
state.pageKey = getPageKey();
|
|
555
559
|
state.cfg = null;
|
|
556
560
|
state.cfgPromise = null;
|
|
@@ -739,33 +743,33 @@
|
|
|
739
743
|
|
|
740
744
|
// Fonction qui attend que la page ait assez de contenu avant d'insérer les pubs
|
|
741
745
|
function waitForContentThenRun() {
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
746
|
+
const MIN_WORDS = 250;
|
|
747
|
+
let attempts = 0;
|
|
748
|
+
const maxAttempts = 20; // 20 × 200ms = 4s max
|
|
749
|
+
|
|
750
|
+
(function check() {
|
|
751
|
+
attempts++;
|
|
752
|
+
|
|
753
|
+
// Compter les mots sur la page
|
|
754
|
+
const text = document.body.innerText || '';
|
|
755
|
+
const wordCount = text.split(/\s+/).filter(Boolean).length;
|
|
756
|
+
|
|
757
|
+
if (wordCount >= MIN_WORDS) {
|
|
758
|
+
// Assez de contenu → lancer l'insertion
|
|
759
|
+
scheduleRun();
|
|
760
|
+
return;
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
// Pas assez de contenu
|
|
764
|
+
if (attempts >= maxAttempts) {
|
|
765
|
+
// Timeout après 4s → tenter quand même
|
|
766
|
+
scheduleRun();
|
|
767
|
+
return;
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
// Réessayer dans 200ms
|
|
771
|
+
setTimeout(check, 200);
|
|
772
|
+
})();
|
|
769
773
|
}
|
|
770
774
|
|
|
771
775
|
// Fonction qui attend que Ezoic soit vraiment chargé
|