nodebb-plugin-ezoic-infinite 1.5.95 → 1.5.97

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 +50 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nodebb-plugin-ezoic-infinite",
3
- "version": "1.5.95",
3
+ "version": "1.5.97",
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
@@ -1341,3 +1341,53 @@ function buildOrdinalMap(items) {
1341
1341
  insertHeroAdEarly().catch(() => {});
1342
1342
  requestBurst();
1343
1343
  })();
1344
+
1345
+
1346
+
1347
+ // ===== V7 up-scroll purge for ezoic-ad-between =====
1348
+ (function () {
1349
+ var lastY = window.pageYOffset || document.documentElement.scrollTop || 0;
1350
+ var ticking = false;
1351
+
1352
+ function purgeBetweenWraps() {
1353
+ try {
1354
+ document.querySelectorAll('.nodebb-ezoic-wrap.ezoic-ad-between').forEach(function (w) {
1355
+ try { w.remove(); } catch (e) {}
1356
+ });
1357
+ } catch (e) {}
1358
+ }
1359
+
1360
+ function onScroll() {
1361
+ if (ticking) return;
1362
+ ticking = true;
1363
+ requestAnimationFrame(function () {
1364
+ var y = window.pageYOffset || document.documentElement.scrollTop || 0;
1365
+ var dy = y - lastY;
1366
+ if (dy < -10) {
1367
+ purgeBetweenWraps();
1368
+ }
1369
+ lastY = y;
1370
+ ticking = false;
1371
+ });
1372
+ }
1373
+
1374
+ window.addEventListener('scroll', onScroll, { passive: true });
1375
+
1376
+ function purgeNearTop() {
1377
+ try {
1378
+ var y = window.pageYOffset || document.documentElement.scrollTop || 0;
1379
+ if (y < 500) purgeBetweenWraps();
1380
+ } catch (e) {}
1381
+ }
1382
+
1383
+ if (window.jQuery) {
1384
+ window.jQuery(window).on('action:ajaxify.end action:infiniteScroll.loaded', function () {
1385
+ setTimeout(purgeNearTop, 0);
1386
+ setTimeout(purgeNearTop, 250);
1387
+ });
1388
+ }
1389
+
1390
+ setTimeout(purgeNearTop, 0);
1391
+ })();
1392
+ // ===== /V7 =====
1393
+