forked from Public/pics
Allow jumping to random pages through pagination fillers.
This commit is contained in:
16
public/js/main.js
Normal file
16
public/js/main.js
Normal file
@@ -0,0 +1,16 @@
|
||||
function promptGoToPage(index_no) {
|
||||
var page_no = prompt('Go to which page?');
|
||||
if (page_no === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
var index = window['page_index_' + index_no];
|
||||
page_no = parseInt(page_no);
|
||||
|
||||
if (isNaN(page_no) || page_no < 1 || page_no > index.num_pages) {
|
||||
return alert('Invalid page number.');
|
||||
}
|
||||
|
||||
var offset = index.wildcard_url.indexOf('start=') !== -1 ? (page_no - 1) * index.per_page : page_no;
|
||||
window.location.href = index.wildcard_url.replace('%d', offset)
|
||||
}
|
||||
Reference in New Issue
Block a user