nodebb-plugin-ezoic-infinite 1.5.1 → 1.5.2
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 +9 -16
package/package.json
CHANGED
package/public/client.js
CHANGED
|
@@ -9,13 +9,11 @@
|
|
|
9
9
|
|
|
10
10
|
(function () {
|
|
11
11
|
|
|
12
|
-
// --- Safety stubs: prevent crashes
|
|
12
|
+
// --- Safety stubs: prevent `_ezaq` crashes even when ads are disabled/excluded ---
|
|
13
|
+
// IMPORTANT: do NOT create a fake `showAds` function, it can confuse Ezoic's loader.
|
|
13
14
|
window._ezaq = window._ezaq || [];
|
|
14
15
|
window.ezstandalone = window.ezstandalone || {};
|
|
15
16
|
window.ezstandalone.cmd = window.ezstandalone.cmd || [];
|
|
16
|
-
if (typeof window.ezstandalone.showAds !== 'function') {
|
|
17
|
-
window.ezstandalone.showAds = function () {};
|
|
18
|
-
}
|
|
19
17
|
|
|
20
18
|
const CFG_URL = '/api/plugins/ezoic-infinite/config';
|
|
21
19
|
|
|
@@ -99,18 +97,13 @@ if (typeof window.ezstandalone.showAds !== 'function') {
|
|
|
99
97
|
Pool.ensurePlaceholder(id);
|
|
100
98
|
|
|
101
99
|
const el = document.getElementById(id);
|
|
102
|
-
if (
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
try {
|
|
110
|
-
// Call one-by-one to avoid batch logging on missing nodes
|
|
111
|
-
original.call(window.ezstandalone, id);
|
|
112
|
-
} catch (e) {
|
|
113
|
-
// swallow: Ezoic can throw if called during transitions
|
|
100
|
+
if (el && document.body.contains(el)) {
|
|
101
|
+
try {
|
|
102
|
+
// Call one-by-one to avoid batch logging on missing nodes
|
|
103
|
+
original.call(window.ezstandalone, id);
|
|
104
|
+
} catch (e) {
|
|
105
|
+
// swallow: Ezoic can throw if called during transitions
|
|
106
|
+
}
|
|
114
107
|
}
|
|
115
108
|
}
|
|
116
109
|
};
|