forked from e621ng/e621ng
[Pagination] Add a way to quickly travel to specific pages (#873)
This commit is contained in:
parent
654023250f
commit
d16361a926
@ -74,7 +74,7 @@ module PaginationHelper
|
||||
|
||||
html = "".html_safe
|
||||
if page == "..."
|
||||
html << tag.li(class: "more") { tag.i(class: "fa-solid fa-ellipsis") }
|
||||
html << tag.li(class: "more") { link_to(tag.i(class: "fa-solid fa-ellipsis"), nav_params_for(0)) }
|
||||
elsif page == records.current_page
|
||||
html << tag.li(class: "current-page") { tag.span(page) }
|
||||
else
|
||||
|
19
app/javascript/src/javascripts/paginator.js
Normal file
19
app/javascript/src/javascripts/paginator.js
Normal file
@ -0,0 +1,19 @@
|
||||
const Paginator = {};
|
||||
|
||||
Paginator.init_fasttravel = function (button) {
|
||||
button.on("click", (event) => {
|
||||
event.preventDefault();
|
||||
|
||||
const value = prompt("Navigate to page");
|
||||
if (!value) return;
|
||||
|
||||
window.location.replace(button.attr("href").replace("page=0", "page=" + value));
|
||||
});
|
||||
};
|
||||
|
||||
$(() => {
|
||||
for (const one of $(".paginator li.more a").get())
|
||||
Paginator.init_fasttravel($(one));
|
||||
});
|
||||
|
||||
export default Paginator;
|
Loading…
Reference in New Issue
Block a user