From 347ccb4bbe158f8ec57e07d976558db2e2d1e6f4 Mon Sep 17 00:00:00 2001 From: Jason McBrayer Date: Tue, 6 Nov 2018 17:05:03 -0500 Subject: [PATCH] Restore all of the PJAX stuff because I figured out what was going wrong --- brutaldon/static/js/brutaldon-enhancements.js | 18 +++++ brutaldon/templates/base.html | 74 ++++++++++++++++--- brutaldon/templates/intercooler/notes.html | 2 + brutaldon/templates/main/toot_partial.html | 9 ++- brutaldon/views.py | 1 + 5 files changed, 92 insertions(+), 12 deletions(-) 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 @@