mirror of
https://github.com/pldubouilh/gossa.git
synced 2026-09-05 16:47:39 -04:00
really fix history
This commit is contained in:
+5
-9
@@ -51,7 +51,7 @@ function browseTo (href) {
|
|||||||
if (document.head.querySelectorAll('title')[0].innerText !== title) {
|
if (document.head.querySelectorAll('title')[0].innerText !== title) {
|
||||||
document.head.querySelectorAll('title')[0].innerText = title
|
document.head.querySelectorAll('title')[0].innerText = title
|
||||||
document.body.querySelectorAll('h1')[0].innerText = '.' + title
|
document.body.querySelectorAll('h1')[0].innerText = '.' + title
|
||||||
history.pushState({}, '', encodeURI(title))
|
history.replaceState({}, '', encodeURI(title))
|
||||||
}
|
}
|
||||||
|
|
||||||
init()
|
init()
|
||||||
@@ -70,8 +70,8 @@ window.onClickLink = e => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const refresh = () => browseTo(location.href) || okBageFlicker()
|
const refresh = () => browseTo(location.href) || okBageFlicker()
|
||||||
const prevPage = () => picsOff() || browseTo(location.href + '../')
|
const prevPage = (url) => picsOff() || browseTo(url || (location.href + '../'))
|
||||||
window.onpopstate = prevPage
|
window.onpopstate = () => prevPage(location.href)
|
||||||
|
|
||||||
// RPC
|
// RPC
|
||||||
function rpcFs (call, args, cb) {
|
function rpcFs (call, args, cb) {
|
||||||
@@ -326,17 +326,13 @@ const isPic = src => src && picTypes.find(type => src.toLocaleLowerCase().includ
|
|||||||
const isPicMode = () => pics.style.display === 'flex'
|
const isPicMode = () => pics.style.display === 'flex'
|
||||||
window.picsNav = () => picsNav(true)
|
window.picsNav = () => picsNav(true)
|
||||||
|
|
||||||
function setImage (first) {
|
function setImage () {
|
||||||
const src = allImgs[imgsIndex]
|
const src = allImgs[imgsIndex]
|
||||||
picsHolder.src = src
|
picsHolder.src = src
|
||||||
storeLastArrowSrc(src)
|
storeLastArrowSrc(src)
|
||||||
restoreCursorPos()
|
restoreCursorPos()
|
||||||
if (first) {
|
|
||||||
history.pushState({}, '', encodeURI(src.split('/').pop()))
|
|
||||||
} else {
|
|
||||||
history.replaceState({}, '', encodeURI(src.split('/').pop()))
|
history.replaceState({}, '', encodeURI(src.split('/').pop()))
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function picsOn (ifImgSelected, href) {
|
function picsOn (ifImgSelected, href) {
|
||||||
href = href || getASelected().href
|
href = href || getASelected().href
|
||||||
@@ -349,7 +345,7 @@ function picsOn (ifImgSelected, href) {
|
|||||||
imgsIndex = allImgs.findIndex(el => el.includes(href))
|
imgsIndex = allImgs.findIndex(el => el.includes(href))
|
||||||
}
|
}
|
||||||
|
|
||||||
setImage(true)
|
setImage()
|
||||||
pics.style.display = 'flex'
|
pics.style.display = 'flex'
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user