mirror of
https://github.com/neon-mmd/websurfx.git
synced 2024-11-22 14:08:23 -05:00
27 lines
723 B
JavaScript
27 lines
723 B
JavaScript
function navigate_forward() {
|
|
const url = new URL(window.location)
|
|
const searchParams = url.searchParams
|
|
|
|
let q = searchParams.get('q')
|
|
let page = searchParams.get('page')
|
|
|
|
if (page === null) {
|
|
page = 2
|
|
window.location = `${url.origin}${url.pathname}?q=${q}&page=${page}`
|
|
} else {
|
|
window.location = `${url.origin}${url.pathname}?q=${q}&page=${++page}`
|
|
}
|
|
}
|
|
|
|
function navigate_backward() {
|
|
const url = new URL(window.location)
|
|
const searchParams = url.searchParams
|
|
|
|
let q = searchParams.get('q')
|
|
let page = searchParams.get('page')
|
|
|
|
if (page !== null && page > 1) {
|
|
window.location = `${url.origin}${url.pathname}?q=${q}&page=${--page}`
|
|
}
|
|
}
|