pics/public/js/main.js

17 lines
477 B
JavaScript
Raw Normal View History

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)
}