From 8d7661cf9e1f5493e878ae1ddd4056d10da1adf6 Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Mon, 20 Nov 2017 10:21:16 +0100 Subject: [PATCH] Disable button at end of infinite scrolling --- scripts/Actions/InfiniteScroller.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/Actions/InfiniteScroller.ts b/scripts/Actions/InfiniteScroller.ts index 213ced6e..591f630a 100644 --- a/scripts/Actions/InfiniteScroller.ts +++ b/scripts/Actions/InfiniteScroller.ts @@ -12,18 +12,19 @@ export function loadMore(arn: AnimeNotifier, button: HTMLButtonElement) { let target = arn.app.find("load-more-target") let index = button.dataset.index - + fetch("/_" + arn.app.currentPath + "/from/" + index) .then(response => { let newIndex = response.headers.get("X-LoadMore-Index") // End of data? if(newIndex === "-1") { + button.disabled = true button.classList.add("hidden") } else { button.dataset.index = newIndex } - + return response }) .then(response => response.text())