Keep scroll between reloads
This commit is contained in:
@ -18,10 +18,24 @@ async function fetch_build_id()
|
|||||||
return json.build_id;
|
return json.build_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function refresh_page()
|
||||||
|
{
|
||||||
|
let scroll = localStorage.setItem("scroll", window.scrollY);
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
|
||||||
|
window.onload = function()
|
||||||
|
{
|
||||||
setInterval(async function() {
|
setInterval(async function() {
|
||||||
let new_build_id = await fetch_build_id();
|
let new_build_id = await fetch_build_id();
|
||||||
if (build_id !== new_build_id) {
|
if (build_id !== new_build_id) {
|
||||||
location.reload(true);
|
refresh_page();
|
||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
let scroll = localStorage.getItem("scroll");
|
||||||
|
if (scroll) {
|
||||||
|
window.scrollTo(0, scroll);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user