diff --git a/brutaldon/static/js/brutaldon-enhancements.js b/brutaldon/static/js/brutaldon-enhancements.js index 0064378..13fdaf6 100644 --- a/brutaldon/static/js/brutaldon-enhancements.js +++ b/brutaldon/static/js/brutaldon-enhancements.js @@ -151,3 +151,21 @@ function characterCount() return $("#id_status").val().length + $("#id_spoiler_text").val().length; } +function savePlace() +{ + sessionStorage.setItem("lastScrollPos", window.scrollY); + return true; +} + +function restorePlace(ev) +{ + var lastScrollPos = sessionStorage.getItem('lastScrollPos'); + Intercooler.ready(function (elt) + { + if (elt[0].id == 'main') + { + window.scrollTo(0, lastScrollPos); + } + }); + return false; +} diff --git a/brutaldon/templates/base.html b/brutaldon/templates/base.html index 2c5ecfe..b9a18be 100644 --- a/brutaldon/templates/base.html +++ b/brutaldon/templates/base.html @@ -75,17 +75,32 @@