nodebb-plugin-ezoic-infinite 1.9.1 → 1.9.3
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/library.js +5 -0
- package/package.json +1 -1
- package/public/client.js +35 -30
package/library.js
CHANGED
|
@@ -208,8 +208,13 @@ plugin.addAdminNavigation = async (header) => {
|
|
|
208
208
|
return header;
|
|
209
209
|
};
|
|
210
210
|
|
|
211
|
+
const NO_ADS_PATHS = /^\/(login|register|reset|confirm|email-confirm|sso|oauth|admin)(\/|$)/i;
|
|
212
|
+
|
|
211
213
|
plugin.injectEzoicHead = async (data) => {
|
|
212
214
|
try {
|
|
215
|
+
const reqPath = data.req?.path ?? '';
|
|
216
|
+
if (NO_ADS_PATHS.test(reqPath)) return data;
|
|
217
|
+
|
|
213
218
|
const settings = await getSettings();
|
|
214
219
|
const uid = data.req?.uid ?? 0;
|
|
215
220
|
const excluded = await isUserExcluded(uid, settings.excludedGroups);
|
package/package.json
CHANGED
package/public/client.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* NodeBB Ezoic Infinite Ads — client.js v2.
|
|
2
|
+
* NodeBB Ezoic Infinite Ads — client.js v2.6.0
|
|
3
3
|
*
|
|
4
4
|
* Architecture: proven v50 core + targeted improvements.
|
|
5
5
|
* Ezoic API: showAds() + destroyPlaceholders() per official docs.
|
|
@@ -32,13 +32,13 @@
|
|
|
32
32
|
BURST_COOLDOWN_MS: 200,
|
|
33
33
|
BLOCK_DURATION_MS: 1_000,
|
|
34
34
|
SHOW_TIMEOUT_MS: 4_500,
|
|
35
|
-
SHOW_RELEASE_MS:
|
|
36
|
-
RECYCLE_DELAY_MS:
|
|
35
|
+
SHOW_RELEASE_MS: 150,
|
|
36
|
+
RECYCLE_DELAY_MS: 50,
|
|
37
37
|
UNCOLLAPSE_CHECK_MS: [500, 5_000],
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
const MAX_INSERTS_RUN = 6;
|
|
41
|
-
const MAX_INFLIGHT =
|
|
41
|
+
const MAX_INFLIGHT = 6;
|
|
42
42
|
const MAX_BURST_STEPS = 8;
|
|
43
43
|
const BURST_WINDOW_MS = 2_000;
|
|
44
44
|
|
|
@@ -562,28 +562,26 @@
|
|
|
562
562
|
};
|
|
563
563
|
const timer = setTimeout(release, TIMING.SHOW_TIMEOUT_MS);
|
|
564
564
|
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
try { wrap?.setAttribute(ATTR.SHOWN, String(t)); } catch (_) {}
|
|
565
|
+
try {
|
|
566
|
+
if (isBlocked()) { clearTimeout(timer); return release(); }
|
|
567
|
+
const ph = document.getElementById(`${PH_PREFIX}${id}`);
|
|
568
|
+
if (!ph?.isConnected || isFilled(ph)) { clearTimeout(timer); return release(); }
|
|
569
|
+
const t = now();
|
|
570
|
+
if (t - (S.lastShow.get(id) ?? 0) < TIMING.SHOW_THROTTLE_MS) { clearTimeout(timer); return release(); }
|
|
571
|
+
S.lastShow.set(id, t);
|
|
572
|
+
const wrap = ph.closest(`.${WRAP_CLASS}`);
|
|
573
|
+
try { wrap?.setAttribute(ATTR.SHOWN, String(t)); } catch (_) {}
|
|
575
574
|
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
});
|
|
575
|
+
window.ezstandalone = window.ezstandalone || {};
|
|
576
|
+
const ez = window.ezstandalone;
|
|
577
|
+
const doShow = () => {
|
|
578
|
+
try { ez.showAds(id); } catch (_) {}
|
|
579
|
+
if (wrap) scheduleUncollapseChecks(wrap, id);
|
|
580
|
+
scheduleEmptyCheck(id, t);
|
|
581
|
+
setTimeout(() => { clearTimeout(timer); release(); }, TIMING.SHOW_RELEASE_MS);
|
|
582
|
+
};
|
|
583
|
+
typeof ez.cmd?.push === 'function' ? ez.cmd.push(doShow) : doShow();
|
|
584
|
+
} catch (_) { clearTimeout(timer); release(); }
|
|
587
585
|
}
|
|
588
586
|
|
|
589
587
|
function scheduleEmptyCheck(id, showTs) {
|
|
@@ -854,7 +852,7 @@
|
|
|
854
852
|
ensureTcfLocator(); protectAriaHidden();
|
|
855
853
|
patchShowAds(); getIO(); ensureDomObserver();
|
|
856
854
|
RETRY.count = 0; RETRY.scriptReloaded = false; RETRY.postReloadShown = false; RETRY.gen++;
|
|
857
|
-
setTimeout(() => retryBoot(RETRY.gen),
|
|
855
|
+
setTimeout(() => retryBoot(RETRY.gen), 100);
|
|
858
856
|
requestBurst();
|
|
859
857
|
});
|
|
860
858
|
// action:ajaxify.contentLoaded et action:category.loaded ne passent pas par hooks → jQuery uniquement
|
|
@@ -898,6 +896,13 @@
|
|
|
898
896
|
// ── Boot ───────────────────────────────────────────────────────────────────
|
|
899
897
|
|
|
900
898
|
S.pageKey = pageKey();
|
|
899
|
+
(function () {
|
|
900
|
+
const _bootCfg = window.__nbbEzoicCfg;
|
|
901
|
+
if (_bootCfg && typeof _bootCfg === 'object' && !_bootCfg.excluded) {
|
|
902
|
+
S.cfg = _bootCfg;
|
|
903
|
+
initPools(_bootCfg);
|
|
904
|
+
}
|
|
905
|
+
}());
|
|
901
906
|
ensureTcfLocator();
|
|
902
907
|
protectAriaHidden();
|
|
903
908
|
patchShowAds();
|
|
@@ -907,10 +912,10 @@
|
|
|
907
912
|
bindScroll();
|
|
908
913
|
bindResize();
|
|
909
914
|
S.blockedUntil = 0;
|
|
910
|
-
if (document.readyState === '
|
|
911
|
-
requestBurst
|
|
915
|
+
if (document.readyState === 'loading') {
|
|
916
|
+
document.addEventListener('DOMContentLoaded', requestBurst, { once: true });
|
|
912
917
|
} else {
|
|
913
|
-
|
|
918
|
+
requestBurst();
|
|
914
919
|
}
|
|
915
920
|
|
|
916
921
|
// Retry boot: sa.min.js async + Cloudflare Rocket Loader + NodeBB SPA
|
|
@@ -982,6 +987,6 @@
|
|
|
982
987
|
}
|
|
983
988
|
setTimeout(() => retryBoot(gen), RETRY.count <= 4 ? 300 : 1000);
|
|
984
989
|
}
|
|
985
|
-
setTimeout(() => retryBoot(RETRY.gen),
|
|
990
|
+
setTimeout(() => retryBoot(RETRY.gen), 100);
|
|
986
991
|
|
|
987
992
|
})();
|