summaryrefslogtreecommitdiff
path: root/static/js/paginator.js
diff options
context:
space:
mode:
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