nodebb-plugin-ezoic-infinite 1.5.0 → 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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/public/client.js +19 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-ezoic-infinite",
3
- "version": "1.5.0",
3
+ "version": "1.5.2",
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
@@ -8,6 +8,13 @@
8
8
  */
9
9
 
10
10
  (function () {
11
+
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.
14
+ window._ezaq = window._ezaq || [];
15
+ window.ezstandalone = window.ezstandalone || {};
16
+ window.ezstandalone.cmd = window.ezstandalone.cmd || [];
17
+
11
18
  const CFG_URL = '/api/plugins/ezoic-infinite/config';
12
19
 
13
20
  // -------------------------
@@ -240,14 +247,25 @@
240
247
 
241
248
  // NodeBB topic list injection (between li rows)
242
249
  injectBetweenTopics(c) {
250
+ // NodeBB 4.x (Harmony) uses: <ul component="category" class="topics-list ...">
251
+ // Older themes may use .topic-list
243
252
  const container =
253
+ document.querySelector('ul[component="category"].topics-list') ||
254
+ document.querySelector('ul[component="category"].topic-list') ||
255
+ document.querySelector('ul.topics-list[component="category"]') ||
256
+ document.querySelector('ul.topics-list') ||
257
+ document.querySelector('.category ul.topics-list') ||
244
258
  document.querySelector('.category .topic-list') ||
245
259
  document.querySelector('.topics .topic-list') ||
246
260
  document.querySelector('.topic-list');
247
261
 
248
262
  if (!container) return;
249
263
 
250
- const rows = Array.from(container.querySelectorAll('li, .topic-row, .topic-item'));
264
+ let rows = Array.from(container.querySelectorAll(':scope > li')).filter(el => el && el.nodeType === 1);
265
+ if (!rows.length) {
266
+ // Fallback for older markups
267
+ rows = Array.from(container.querySelectorAll('li, .topic-row, .topic-item')).filter(el => el && el.nodeType === 1);
268
+ }
251
269
  if (!rows.length) return;
252
270
 
253
271
  const ids = parsePlaceholderIds(c.placeholderIds);