nodebb-plugin-ezoic-infinite 1.8.87 → 1.8.89
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 +19 -4
package/package.json
CHANGED
package/public/client.js
CHANGED
|
@@ -143,10 +143,11 @@
|
|
|
143
143
|
...parseIds(cfg.categoryPlaceholderIds),
|
|
144
144
|
];
|
|
145
145
|
if (!ids.length) return;
|
|
146
|
+
S.ezEnabled = true; // set synchronously to block concurrent calls before the callback runs
|
|
146
147
|
window.ezstandalone = window.ezstandalone || {};
|
|
147
148
|
const ez = window.ezstandalone;
|
|
148
149
|
const doEnable = () => {
|
|
149
|
-
try { ez.define(...ids); ez.enable();
|
|
150
|
+
try { ez.define(...ids); ez.enable(); } catch (_) {}
|
|
150
151
|
};
|
|
151
152
|
typeof ez.cmd?.push === 'function' ? ez.cmd.push(doEnable) : doEnable();
|
|
152
153
|
}
|
|
@@ -562,6 +563,14 @@
|
|
|
562
563
|
window.ezstandalone = window.ezstandalone || {};
|
|
563
564
|
const ez = window.ezstandalone;
|
|
564
565
|
const doShow = () => {
|
|
566
|
+
const status = ez.loadingStatus;
|
|
567
|
+
if (status && status !== 'complete') {
|
|
568
|
+
// Ezoic not ready yet — release slot and let next burst retry
|
|
569
|
+
clearTimeout(timer);
|
|
570
|
+
release();
|
|
571
|
+
setTimeout(() => { if (!isBlocked()) enqueueShow(id); }, 800);
|
|
572
|
+
return;
|
|
573
|
+
}
|
|
565
574
|
try { ez.showAds(id); } catch (_) {}
|
|
566
575
|
if (wrap) scheduleUncollapseChecks(wrap, id);
|
|
567
576
|
scheduleEmptyCheck(id, t);
|
|
@@ -890,7 +899,11 @@
|
|
|
890
899
|
bindNodeBB();
|
|
891
900
|
bindScroll();
|
|
892
901
|
S.blockedUntil = 0;
|
|
893
|
-
|
|
902
|
+
if (document.readyState === 'complete') {
|
|
903
|
+
requestBurst();
|
|
904
|
+
} else {
|
|
905
|
+
window.addEventListener('load', requestBurst, { once: true });
|
|
906
|
+
}
|
|
894
907
|
|
|
895
908
|
// Retry boot: sa.min.js async + Cloudflare Rocket Loader + NodeBB SPA
|
|
896
909
|
// can cause client.js to boot before DOM/Ezoic are ready.
|
|
@@ -903,12 +916,14 @@
|
|
|
903
916
|
_retries++;
|
|
904
917
|
patchShowAds();
|
|
905
918
|
|
|
906
|
-
// Reload sa.min.js only if Ezoic never initialized at all (no loadingStatus)
|
|
919
|
+
// Reload sa.min.js only if Ezoic never initialized at all (no loadingStatus)
|
|
920
|
+
// AND sa.min.js is not already present in the DOM (to avoid duplicates on first load
|
|
921
|
+
// when the script is injected server-side but loadingStatus hasn't been set yet).
|
|
907
922
|
// Do NOT reload when loadingStatus === 'complete' (post-defineScript-failure):
|
|
908
923
|
// that would trigger a second defineScript failed error.
|
|
909
924
|
if (!_scriptReloaded && _retries <= 3) {
|
|
910
925
|
const ez = window.ezstandalone;
|
|
911
|
-
if (!ez?.loadingStatus) {
|
|
926
|
+
if (!ez?.loadingStatus && !document.querySelector('script[src*="sa.min.js"]')) {
|
|
912
927
|
_scriptReloaded = true;
|
|
913
928
|
try {
|
|
914
929
|
const s = document.createElement('script');
|