nodebb-plugin-ezoic-infinite 1.1.4 → 1.1.5
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 +16 -6
package/package.json
CHANGED
package/public/client.js
CHANGED
|
@@ -433,6 +433,15 @@
|
|
|
433
433
|
}
|
|
434
434
|
}
|
|
435
435
|
|
|
436
|
+
function runAfterPaint() {
|
|
437
|
+
// Ensure we run after the browser has painted the newly inserted DOM (Harmony/category topics list can be late)
|
|
438
|
+
requestAnimationFrame(() => {
|
|
439
|
+
requestAnimationFrame(() => {
|
|
440
|
+
run();
|
|
441
|
+
});
|
|
442
|
+
});
|
|
443
|
+
}
|
|
444
|
+
|
|
436
445
|
async function run() {
|
|
437
446
|
try {
|
|
438
447
|
const cfg = await fetchConfig();
|
|
@@ -479,14 +488,15 @@
|
|
|
479
488
|
|
|
480
489
|
$w.on('action:ajaxify.end.ezoicInfinite', () => {
|
|
481
490
|
patchShowAds();
|
|
482
|
-
|
|
483
|
-
setTimeout(run,
|
|
484
|
-
setTimeout(run,
|
|
491
|
+
runAfterPaint();
|
|
492
|
+
setTimeout(run, 250);
|
|
493
|
+
setTimeout(run, 900);
|
|
485
494
|
});
|
|
486
495
|
|
|
487
496
|
$w.on('action:category.loaded.ezoicInfinite', () => {
|
|
488
|
-
|
|
489
|
-
setTimeout(run,
|
|
497
|
+
runAfterPaint();
|
|
498
|
+
setTimeout(run, 200);
|
|
499
|
+
setTimeout(run, 700);
|
|
490
500
|
});
|
|
491
501
|
|
|
492
502
|
$w.on('action:topic.loaded.ezoicInfinite', () => {
|
|
@@ -495,7 +505,7 @@
|
|
|
495
505
|
});
|
|
496
506
|
|
|
497
507
|
// Infinite scroll events (varies by route)
|
|
498
|
-
$w.on('action:topics.loaded.ezoicInfinite', run);
|
|
508
|
+
$w.on('action:topics.loaded.ezoicInfinite', () => { runAfterPaint(); setTimeout(run, 150); setTimeout(run, 600); });
|
|
499
509
|
$w.on('action:posts.loaded.ezoicInfinite', run);
|
|
500
510
|
}
|
|
501
511
|
|