nodebb-plugin-ezoic-infinite 1.8.90 → 1.8.92
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/.claude/settings.local.json +10 -0
- package/package.json +1 -1
- package/public/client.js +42 -19
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"permissions": {
|
|
3
|
+
"allow": [
|
|
4
|
+
"WebFetch(domain:registry.npmjs.org)",
|
|
5
|
+
"Bash(curl -sL \"https://registry.npmjs.org/nodebb-plugin-ezoic-infinite/-/nodebb-plugin-ezoic-infinite-1.8.81.tgz\" -o /tmp/ezoic-1.8.81.tgz && tar -tzf /tmp/ezoic-1.8.81.tgz)",
|
|
6
|
+
"Bash(tar -xzf /tmp/ezoic-1.8.81.tgz -C /tmp/ package/library.js package/public/client.js package/package.json)",
|
|
7
|
+
"Bash(cd /tmp && curl -sL \"https://registry.npmjs.org/nodebb-plugin-ezoic-infinite/-/nodebb-plugin-ezoic-infinite-1.8.81.tgz\" -o ezoic-1.8.81.tgz && tar -xzf ezoic-1.8.81.tgz && echo \"Extracted OK\")"
|
|
8
|
+
]
|
|
9
|
+
}
|
|
10
|
+
}
|
package/package.json
CHANGED
package/public/client.js
CHANGED
|
@@ -545,14 +545,6 @@
|
|
|
545
545
|
window.ezstandalone = window.ezstandalone || {};
|
|
546
546
|
const ez = window.ezstandalone;
|
|
547
547
|
const doShow = () => {
|
|
548
|
-
const status = ez.loadingStatus;
|
|
549
|
-
if (status && status !== 'complete') {
|
|
550
|
-
// Ezoic not ready yet — release slot and let next burst retry
|
|
551
|
-
clearTimeout(timer);
|
|
552
|
-
release();
|
|
553
|
-
setTimeout(() => { if (!isBlocked()) enqueueShow(id); }, 800);
|
|
554
|
-
return;
|
|
555
|
-
}
|
|
556
548
|
try { ez.showAds(id); } catch (_) {}
|
|
557
549
|
if (wrap) scheduleUncollapseChecks(wrap, id);
|
|
558
550
|
scheduleEmptyCheck(id, t);
|
|
@@ -886,25 +878,56 @@
|
|
|
886
878
|
|
|
887
879
|
// Retry boot: sa.min.js async + Cloudflare Rocket Loader + NodeBB SPA
|
|
888
880
|
// can cause client.js to boot before DOM/Ezoic are ready.
|
|
889
|
-
//
|
|
890
|
-
//
|
|
881
|
+
//
|
|
882
|
+
// Two reload cases:
|
|
883
|
+
// 1. sa.min.js never injected (Rocket Loader stripped it) — reload immediately.
|
|
884
|
+
// 2. Cold-start crash: first visit with no Ezoic cookies causes sa.min.js to set
|
|
885
|
+
// loadingStatus='LOADING' but never reach 'complete' (_ezaq.ab_test_id undefined
|
|
886
|
+
// in ez-standalone.js → onStandaloneLoadEvent crash). After ~6s, remove and reload
|
|
887
|
+
// sa.min.js; Ezoic's partial first-run state may let the second run succeed.
|
|
888
|
+
// Once recovered, re-enqueue all mounted placeholders so showAds() fires.
|
|
891
889
|
let _retries = 0;
|
|
892
890
|
let _scriptReloaded = false;
|
|
891
|
+
let _postReloadShown = false;
|
|
893
892
|
function retryBoot() {
|
|
894
|
-
if (_retries >= 12
|
|
893
|
+
if (_retries >= 12) return;
|
|
895
894
|
_retries++;
|
|
896
895
|
patchShowAds();
|
|
897
896
|
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
//
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
const
|
|
905
|
-
|
|
897
|
+
const ez = window.ezstandalone;
|
|
898
|
+
const status = ez?.loadingStatus;
|
|
899
|
+
|
|
900
|
+
// After reload: once Ezoic reaches 'complete', re-call showAds for all mounted placeholders
|
|
901
|
+
if (_scriptReloaded && !_postReloadShown && status === 'complete') {
|
|
902
|
+
_postReloadShown = true;
|
|
903
|
+
for (const id of S.mountedIds) { try { enqueueShow(id); } catch (_) {} }
|
|
904
|
+
return;
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
// Normal exit: placeholders mounted, no reload triggered (healthy load)
|
|
908
|
+
if (S.mountedIds.size > 0 && !_scriptReloaded) return;
|
|
909
|
+
// Exit once reload is done and re-show has been triggered
|
|
910
|
+
if (_scriptReloaded && _postReloadShown) return;
|
|
911
|
+
|
|
912
|
+
if (!_scriptReloaded) {
|
|
913
|
+
// Case 1: sa.min.js never injected (Rocket Loader stripped it, etc.)
|
|
914
|
+
const neverInjected = !status && !document.querySelector('script[src*="sa.min.js"]') && _retries <= 3;
|
|
915
|
+
// Case 2: cold-start crash — loadingStatus stuck before 'complete' after enough wait.
|
|
916
|
+
// Do NOT reload when status==='complete' (post-defineScript-failure would re-trigger).
|
|
917
|
+
const anyFilled = !!document.querySelector(`.${WRAP_CLASS} ${FILL_SEL}`);
|
|
918
|
+
const crashed = _retries >= 8 && !anyFilled && status && status !== 'complete';
|
|
919
|
+
if (neverInjected || crashed) {
|
|
906
920
|
_scriptReloaded = true;
|
|
907
921
|
try {
|
|
922
|
+
if (crashed) {
|
|
923
|
+
// Remove the broken script before re-adding to avoid a duplicate
|
|
924
|
+
const old = document.querySelector('script[src*="sa.min.js"]');
|
|
925
|
+
if (old) old.remove();
|
|
926
|
+
// Reset ezstandalone to initial state, preserving queued cmd items
|
|
927
|
+
const savedCmd = Array.isArray(ez?.cmd) ? [...ez.cmd] : [];
|
|
928
|
+
window.ezstandalone = { cmd: savedCmd };
|
|
929
|
+
window.__nbbEzPatched = false;
|
|
930
|
+
}
|
|
908
931
|
const s = document.createElement('script');
|
|
909
932
|
s.setAttribute('data-cfasync', 'false');
|
|
910
933
|
s.src = '//www.ezojs.com/ezoic/sa.min.js';
|