nodebb-plugin-ezoic-infinite 1.8.94 → 1.8.95

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/library.js CHANGED
@@ -108,10 +108,15 @@ async function isUserExcluded(uid, excludedGroups) {
108
108
  return value;
109
109
  }
110
110
 
111
+ let _inlineCfgNormal = null;
112
+ let _inlineCfgExcluded = null;
113
+
111
114
  function clearCaches() {
112
115
  _settingsCache = null;
113
116
  _settingsCacheAt = 0;
114
117
  _excludeCache.clear();
118
+ _inlineCfgNormal = null;
119
+ _inlineCfgExcluded = null;
115
120
  }
116
121
 
117
122
  // ── Client config ────────────────────────────────────────────────────────────
@@ -176,8 +181,12 @@ plugin.injectEzoicHead = async (data) => {
176
181
  const uid = data.req?.uid ?? 0;
177
182
  const excluded = await isUserExcluded(uid, settings.excludedGroups);
178
183
 
184
+ if (!_inlineCfgNormal) {
185
+ _inlineCfgNormal = serializeInlineConfig(buildClientConfig(settings, false));
186
+ _inlineCfgExcluded = serializeInlineConfig(buildClientConfig(settings, true));
187
+ }
188
+
179
189
  if (excluded) {
180
- const cfg = buildClientConfig(settings, true);
181
190
  const stub = '<script data-cfasync="false">'
182
191
  + 'window._ezaq=window._ezaq||{};'
183
192
  + 'window.ezstandalone=window.ezstandalone||{};'
@@ -185,14 +194,13 @@ plugin.injectEzoicHead = async (data) => {
185
194
  + '</script>';
186
195
  data.templateData.customHTML =
187
196
  stub + '\n' +
188
- serializeInlineConfig(cfg) +
197
+ _inlineCfgExcluded +
189
198
  (data.templateData.customHTML || '');
190
199
  } else {
191
- const cfg = buildClientConfig(settings, false);
192
200
  data.templateData.customHTML =
193
201
  HEAD_PRECONNECTS + '\n' +
194
202
  EZOIC_SCRIPTS + '\n' +
195
- serializeInlineConfig(cfg) +
203
+ _inlineCfgNormal +
196
204
  (data.templateData.customHTML || '');
197
205
  }
198
206
  } catch (err) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-ezoic-infinite",
3
- "version": "1.8.94",
3
+ "version": "1.8.95",
4
4
  "description": "Production-ready Ezoic infinite ads integration for NodeBB 4.x",
5
5
  "main": "library.js",
6
6
  "license": "MIT",
package/public/client.js CHANGED
@@ -1,11 +1,12 @@
1
1
  /**
2
- * NodeBB Ezoic Infinite Ads — client.js v2.5.1
2
+ * NodeBB Ezoic Infinite Ads — client.js v2.5.2
3
3
  *
4
4
  * Architecture: proven v50 core + targeted improvements.
5
5
  * Ezoic API: showAds() + destroyPlaceholders() per official docs.
6
6
  * Key features: O(1) recycle via wrapsByClass, MutationObserver fill detect,
7
7
  * conservative empty check, aria-hidden + TCF protection, retry boot for
8
8
  * Cloudflare/async timing.
9
+ * v2.5.2: removed redundant warmNetwork() — preconnects are server-injected.
9
10
  */
10
11
  (function nbbEzoicInfinite() {
11
12
  'use strict';
@@ -798,30 +799,6 @@
798
799
  try { window.__nbbAriaObs.observe(document.body, { attributes: true, attributeFilter: ['aria-hidden'] }); } catch (_) {}
799
800
  }
800
801
 
801
- // ── Network warmup ─────────────────────────────────────────────────────────
802
-
803
- let _warmed = false;
804
- function warmNetwork() {
805
- if (_warmed) return;
806
- _warmed = true;
807
- const head = document.head;
808
- if (!head) return;
809
- for (const [rel, href, cors] of [
810
- ['preconnect', 'https://g.ezoic.net', true ],
811
- ['preconnect', 'https://go.ezoic.net', true ],
812
- ['preconnect', 'https://securepubads.g.doubleclick.net', true ],
813
- ['preconnect', 'https://pagead2.googlesyndication.com', true ],
814
- ['dns-prefetch', 'https://g.ezoic.net', false],
815
- ['dns-prefetch', 'https://securepubads.g.doubleclick.net', false],
816
- ]) {
817
- if (head.querySelector(`link[rel="${rel}"][href="${href}"]`)) continue;
818
- const l = document.createElement('link');
819
- l.rel = rel; l.href = href;
820
- if (cors) l.crossOrigin = 'anonymous';
821
- head.appendChild(l);
822
- }
823
- }
824
-
825
802
  // ── Bindings ───────────────────────────────────────────────────────────────
826
803
 
827
804
  function bindNodeBB() {
@@ -832,7 +809,7 @@
832
809
  $(window).on('action:ajaxify.end.nbbEzoic', () => {
833
810
  S.pageKey = pageKey(); S.kind = null; S.blockedUntil = 0;
834
811
  ensureTcfLocator(); protectAriaHidden();
835
- warmNetwork(); patchShowAds(); getIO(); ensureDomObserver();
812
+ patchShowAds(); getIO(); ensureDomObserver();
836
813
  requestBurst();
837
814
  });
838
815
  // action:ajaxify.contentLoaded et action:category.loaded ne passent pas par hooks → jQuery uniquement
@@ -863,7 +840,6 @@
863
840
  S.pageKey = pageKey();
864
841
  ensureTcfLocator();
865
842
  protectAriaHidden();
866
- warmNetwork();
867
843
  patchShowAds();
868
844
  getIO();
869
845
  ensureDomObserver();