nodebb-plugin-ezoic-infinite 0.6.8 → 0.6.9

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 +4 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-ezoic-infinite",
3
- "version": "0.6.8",
3
+ "version": "0.6.9",
4
4
  "description": "Ezoic ads with infinite scroll using a pool of placeholder IDs",
5
5
  "main": "library.js",
6
6
  "license": "MIT",
package/public/client.js CHANGED
@@ -189,6 +189,8 @@ function injectTopicMessageAds($posts, pool, interval) {
189
189
 
190
190
  $posts.each(function () {
191
191
  const $p = $(this);
192
+ // Never insert after the last real post: it can break NodeBB infinite scroll
193
+ if ($p.is($posts.last())) return;
192
194
  const postNo = getPostNumber($p);
193
195
  if (!Number.isFinite(postNo) || postNo <= 0) return;
194
196
 
@@ -226,6 +228,8 @@ function injectCategoryBetweenAds($items, pool, interval) {
226
228
 
227
229
  $items.each(function () {
228
230
  const $it = $(this);
231
+ // Never insert after the last real topic item (keeps NodeBB infinite scroll working)
232
+ if ($it.is($items.last())) return;
229
233
  const pos = getTopicPos($it);
230
234
  if (!Number.isFinite(pos) || pos <= 0) return;
231
235