nodebb-plugin-ezoic-infinite 1.0.6 → 1.0.7
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 +31 -10
package/package.json
CHANGED
package/public/client.js
CHANGED
|
@@ -246,14 +246,35 @@
|
|
|
246
246
|
debounceTimer = setTimeout(run, 150);
|
|
247
247
|
}
|
|
248
248
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
249
|
+
function bindNodeBBEvents() {
|
|
250
|
+
// NodeBB triggers these events through jQuery on window
|
|
251
|
+
if (window.jQuery) {
|
|
252
|
+
const $w = window.jQuery(window);
|
|
253
|
+
$w.off('.ezoicInfinite');
|
|
254
|
+
$w.on('action:ajaxify.end.ezoicInfinite', scheduleRun);
|
|
255
|
+
$w.on('action:posts.loaded.ezoicInfinite', scheduleRun);
|
|
256
|
+
$w.on('action:topic.loaded.ezoicInfinite', scheduleRun);
|
|
257
|
+
$w.on('action:topics.loaded.ezoicInfinite', scheduleRun);
|
|
258
|
+
$w.on('action:category.loaded.ezoicInfinite', scheduleRun);
|
|
259
|
+
$w.on('action:ajaxify.start.ezoicInfinite', function () {
|
|
260
|
+
pageKey = null;
|
|
261
|
+
cleanupForNewPage();
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
bindNodeBBEvents();
|
|
267
|
+
|
|
268
|
+
// Run immediately, so it works on first ajaxify navigation too
|
|
269
|
+
run();
|
|
270
|
+
setTimeout(run, 1200);
|
|
271
|
+
|
|
272
|
+
// Also run on hard-refresh initial load
|
|
273
|
+
if (document.readyState === 'loading') {
|
|
274
|
+
document.addEventListener('DOMContentLoaded', function () {
|
|
275
|
+
bindNodeBBEvents();
|
|
276
|
+
run();
|
|
277
|
+
setTimeout(run, 1200);
|
|
278
|
+
});
|
|
279
|
+
}
|
|
259
280
|
})();
|