diff --git a/assets/bookmark.js b/assets/bookmark.js new file mode 100644 index 0000000..8362005 --- /dev/null +++ b/assets/bookmark.js @@ -0,0 +1,9 @@ + +window.onbeforeunload = function(e) { + localStorage.setItem(window.location.pathname,window.scrollY) +} +document.addEventListener("DOMContentLoaded", function(e) { + var scrollpos = localStorage.getItem(window.location.pathname) + if(scrollpos) + window.scrollTo(0,scrollpos) +}) diff --git a/conf/smr.conf.in b/conf/smr.conf.in index 3f36dab..9de3ed0 100644 --- a/conf/smr.conf.in +++ b/conf/smr.conf.in @@ -45,6 +45,7 @@ domain * { route /_css/milligram.min.css.map asset_serve_milligram_min_css_map route /_faq asset_serve_faq_html route /_js/suggest_tags.js asset_serve_suggest_tags_js + route /_js/bookmark.js asset_serve_bookmark_js route /favicon.ico asset_serve_favicon_ico route /_paste post_story route /_edit edit_story diff --git a/src/lua/endpoints/read_get.lua b/src/lua/endpoints/read_get.lua index 17fb549..354f094 100644 --- a/src/lua/endpoints/read_get.lua +++ b/src/lua/endpoints/read_get.lua @@ -97,6 +97,9 @@ local function read_get(req) host = http_request_get_host(req), path = http_request_get_path(req), method = http_method_text(req), + extra_load = { + '' + } } local err --Get our story id