Add bookmark script.
Add a script that saves the position on read pages to localstorage, and restores the page position when the page is reloaded.
This commit is contained in:
parent
fdf0b67f3a
commit
fd87cf95ee
|
@ -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)
|
||||
})
|
|
@ -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
|
||||
|
|
|
@ -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 = {
|
||||
'<script src="/_js/bookmark.js"></script>'
|
||||
}
|
||||
}
|
||||
local err
|
||||
--Get our story id
|
||||
|
|
Loading…
Reference in New Issue