1
0
mirror of https://git.sr.ht/~cadence/bibliogram synced 2026-01-04 05:01:13 +00:00

Add request quota system

This commit is contained in:
Cadence Ember
2020-07-23 00:58:21 +12:00
parent 2095be2742
commit 112d9cc90e
17 changed files with 253 additions and 38 deletions

View File

@@ -1,4 +1,5 @@
import {ElemJS, q} from "./elemjs/elemjs.js"
import {quota} from "./quota.js"
class FreezeWidth extends ElemJS {
freeze(text) {
@@ -79,6 +80,7 @@ class NextPage extends FreezeWidth {
const type = this.element.getAttribute("data-type")
return fetch(`/fragment/user/${this.element.getAttribute("data-username")}/${this.nextPageNumber}?type=${type}`).then(res => res.text()).then(text => {
quota.change(-1)
q("#next-page-container").remove()
this.observer.disconnect()
q("#timeline").insertAdjacentHTML("beforeend", text)