nodebb-plugin-ezoic-infinite 1.8.84 → 1.8.86
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 +24 -2
package/package.json
CHANGED
package/public/client.js
CHANGED
|
@@ -81,6 +81,7 @@
|
|
|
81
81
|
kind: null,
|
|
82
82
|
cfg: null,
|
|
83
83
|
poolsReady: false,
|
|
84
|
+
ezEnabled: false,
|
|
84
85
|
pools: { topics: [], posts: [], categories: [] },
|
|
85
86
|
cursors: { topics: 0, posts: 0, categories: 0 },
|
|
86
87
|
mountedIds: new Set(),
|
|
@@ -134,6 +135,22 @@
|
|
|
134
135
|
S.poolsReady = true;
|
|
135
136
|
}
|
|
136
137
|
|
|
138
|
+
function enableEzoic(cfg) {
|
|
139
|
+
if (S.ezEnabled) return;
|
|
140
|
+
const ids = [
|
|
141
|
+
...parseIds(cfg.placeholderIds),
|
|
142
|
+
...parseIds(cfg.messagePlaceholderIds),
|
|
143
|
+
...parseIds(cfg.categoryPlaceholderIds),
|
|
144
|
+
];
|
|
145
|
+
if (!ids.length) return;
|
|
146
|
+
window.ezstandalone = window.ezstandalone || {};
|
|
147
|
+
const ez = window.ezstandalone;
|
|
148
|
+
const doEnable = () => {
|
|
149
|
+
try { ez.define(...ids); ez.enable(); S.ezEnabled = true; } catch (_) {}
|
|
150
|
+
};
|
|
151
|
+
typeof ez.cmd?.push === 'function' ? ez.cmd.push(doEnable) : doEnable();
|
|
152
|
+
}
|
|
153
|
+
|
|
137
154
|
// ── Page identity ──────────────────────────────────────────────────────────
|
|
138
155
|
|
|
139
156
|
function pageKey() {
|
|
@@ -616,6 +633,7 @@
|
|
|
616
633
|
const cfg = await fetchConfig();
|
|
617
634
|
if (!cfg || cfg.excluded) return 0;
|
|
618
635
|
initPools(cfg);
|
|
636
|
+
enableEzoic(cfg);
|
|
619
637
|
|
|
620
638
|
const kind = getKind();
|
|
621
639
|
if (kind === 'other') return 0;
|
|
@@ -675,6 +693,10 @@
|
|
|
675
693
|
|
|
676
694
|
function cleanup() {
|
|
677
695
|
S.blockedUntil = now() + TIMING.BLOCK_DURATION_MS;
|
|
696
|
+
try {
|
|
697
|
+
const ez = window.ezstandalone;
|
|
698
|
+
if (typeof ez?.destroyPlaceholders === 'function') ez.destroyPlaceholders();
|
|
699
|
+
} catch (_) {}
|
|
678
700
|
mutate(() => {
|
|
679
701
|
for (const w of document.querySelectorAll(`.${WRAP_CLASS}`)) dropWrap(w);
|
|
680
702
|
});
|
|
@@ -691,6 +713,7 @@
|
|
|
691
713
|
S.wrapByKey.clear();
|
|
692
714
|
S.wrapsByClass.clear();
|
|
693
715
|
S.kind = null;
|
|
716
|
+
S.ezEnabled = false;
|
|
694
717
|
S.inflight = 0;
|
|
695
718
|
S.pending.clear();
|
|
696
719
|
S.burstActive = false;
|
|
@@ -827,7 +850,7 @@
|
|
|
827
850
|
$(window).on('action:ajaxify.start.nbbEzoic', cleanup);
|
|
828
851
|
$(window).on('action:ajaxify.end.nbbEzoic', () => {
|
|
829
852
|
S.pageKey = pageKey(); S.kind = null; S.blockedUntil = 0;
|
|
830
|
-
|
|
853
|
+
ensureTcfLocator(); protectAriaHidden();
|
|
831
854
|
warmNetwork(); patchShowAds(); getIO(); ensureDomObserver();
|
|
832
855
|
requestBurst();
|
|
833
856
|
});
|
|
@@ -857,7 +880,6 @@
|
|
|
857
880
|
// ── Boot ───────────────────────────────────────────────────────────────────
|
|
858
881
|
|
|
859
882
|
S.pageKey = pageKey();
|
|
860
|
-
muteConsole();
|
|
861
883
|
ensureTcfLocator();
|
|
862
884
|
protectAriaHidden();
|
|
863
885
|
warmNetwork();
|