nodebb-plugin-ezoic-infinite 1.8.77 → 1.8.78
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 +17 -0
package/package.json
CHANGED
package/public/client.js
CHANGED
|
@@ -904,11 +904,28 @@
|
|
|
904
904
|
// Retry boot: sa.min.js async + Cloudflare Rocket Loader + NodeBB SPA
|
|
905
905
|
// can cause client.js to boot before DOM/Ezoic are ready.
|
|
906
906
|
// Retries stop once ads are mounted or after ~10s.
|
|
907
|
+
// If Ezoic defineScript failed (CMP race on first load), reload sa.min.js once.
|
|
907
908
|
let _retries = 0;
|
|
909
|
+
let _scriptReloaded = false;
|
|
908
910
|
function retryBoot() {
|
|
909
911
|
if (_retries >= 12 || S.mountedIds.size > 0) return;
|
|
910
912
|
_retries++;
|
|
911
913
|
patchShowAds();
|
|
914
|
+
|
|
915
|
+
// Detect Ezoic failed state and reload sa.min.js once to recover
|
|
916
|
+
if (!_scriptReloaded && _retries <= 3) {
|
|
917
|
+
const ez = window.ezstandalone;
|
|
918
|
+
const status = ez?.loadingStatus;
|
|
919
|
+
if (status && status !== 'LOADED' && status !== 'LOADING') {
|
|
920
|
+
_scriptReloaded = true;
|
|
921
|
+
try {
|
|
922
|
+
const s = document.createElement('script');
|
|
923
|
+
s.src = '//www.ezojs.com/ezoic/sa.min.js';
|
|
924
|
+
document.head.appendChild(s);
|
|
925
|
+
} catch (_) {}
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
|
|
912
929
|
if (!isBlocked() && !S.burstActive) {
|
|
913
930
|
S.lastBurstTs = now() - TIMING.BURST_COOLDOWN_MS;
|
|
914
931
|
requestBurst();
|