nodebb-plugin-ezoic-infinite 1.8.85 → 1.8.87
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 -0
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,8 @@
|
|
|
691
713
|
S.wrapByKey.clear();
|
|
692
714
|
S.wrapsByClass.clear();
|
|
693
715
|
S.kind = null;
|
|
716
|
+
// S.ezEnabled intentionally NOT reset: ez.define()+ez.enable() must be called
|
|
717
|
+
// only once per full page load, not on every SPA navigation.
|
|
694
718
|
S.inflight = 0;
|
|
695
719
|
S.pending.clear();
|
|
696
720
|
S.burstActive = false;
|