summaryrefslogtreecommitdiff
path: root/static/js/paginator.js
diff options
context:
space:
mode:
authorHombreLaser <sebastian-440@live.com>2024-02-26 15:40:55 -0600
committerHombreLaser <sebastian-440@live.com>2024-02-26 15:40:55 -0600
commit9e38502edec81c47a54641186d888f191ed999f0 (patch)
treeca24af8b32148d1792250fff1b9d41b5ceb78c7b /static/js/paginator.js
parentadb6f7e9e73716e58529d96540f204e5e0825179 (diff)
Add pagination handling
Diffstat (limited to 'static/js/paginator.js')
-rw-r--r--static/js/paginator.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/static/js/paginator.js b/static/js/paginator.js
new file mode 100644
index 0000000..9a7ed65
--- /dev/null
+++ b/static/js/paginator.js
@@ -0,0 +1,15 @@
+export class Paginator {
+ constructor(host, context, path) {
+ this.endpoint = `${host}${context}?path=${path}`;
+ }
+
+ populatePageAnchors() {
+ const pagination_widget = document.querySelector(".pagination");
+ var anchors = pagination_widget.querySelectorAll('a');
+
+ for(let anchor of anchors) {
+ var page = /\d/.exec(anchor.id)[0];
+ anchor.setAttribute("href", `${this.endpoint}&page=${page}`);
+ }
+ }
+} \ No newline at end of file