blob: 9a7ed65321473c100aeb950494a36426b5a6691c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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}`);
}
}
}
|