aboutsummaryrefslogtreecommitdiff
path: root/static
diff options
context:
space:
mode:
authortdro <tdro@noreply.example.com>2023-12-12 19:42:00 -0500
committertdro <tdro@noreply.example.com>2023-12-12 19:42:00 -0500
commit75f2366a7dd8f91cc6e959519455c431e316a0ee (patch)
treefcfe98ff152bcc8714fb002cd7b521a2c63ae2a2 /static
parent3bbd0fd3fafd7ec3f1600f8dfe5416246c31c23a (diff)
downloadcanory-75f2366a7dd8f91cc6e959519455c431e316a0ee.tar.gz
canory-75f2366a7dd8f91cc6e959519455c431e316a0ee.tar.bz2
canory-75f2366a7dd8f91cc6e959519455c431e316a0ee.zip
static/js/infinitescroll: Wider fallback
Diffstat (limited to 'static')
-rw-r--r--static/js/infinitescroll.ts10
1 files changed, 5 insertions, 5 deletions
diff --git a/static/js/infinitescroll.ts b/static/js/infinitescroll.ts
index 8d6a57f..bef477b 100644
--- a/static/js/infinitescroll.ts
+++ b/static/js/infinitescroll.ts
@@ -12,11 +12,11 @@
function fetch(url, method, callback, fallback) {
const http = new XMLHttpRequest();
http.onreadystatechange = function () {
- if (callback && http.readyState === 4 && http.status === 200) {
- callback(http);
+ if (callback && http.readyState === 4) {
+ if (http.status === 200) callback(http);
+ else fallback(http);
}
};
- http.addEventListener("error", fallback);
http.open(method, url);
http.send();
return http;
@@ -66,8 +66,8 @@
console.log("INFO: Fetch", next.href, items);
- }, function (event) {
- console.warn("WARNING: Switching to native pagination", event);
+ }, function (http) {
+ console.warn("WARNING: Switching to native pagination", http);
main.insertAdjacentElement("afterend", pagination);
abort = true;
});