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