From 3dee29f3efa1de47766ab5cdad0a79f70a5342ce Mon Sep 17 00:00:00 2001 From: Matthew Esposito Date: Tue, 2 Jan 2024 19:43:00 -0500 Subject: [PATCH] Add scrolling to highlighted comment (fix #13) --- src/main.rs | 3 +++ static/highlighted.js | 1 + templates/post.html | 3 +++ 3 files changed, 7 insertions(+) create mode 100644 static/highlighted.js diff --git a/src/main.rs b/src/main.rs index 09b7142..d605ad2 100644 --- a/src/main.rs +++ b/src/main.rs @@ -229,6 +229,9 @@ async fn main() { app .at("/hls.min.js") .get(|_| resource(include_str!("../static/hls.min.js"), "text/javascript", false).boxed()); + app + .at("/highlighted.js") + .get(|_| resource(include_str!("../static/highlighted.js"), "text/javascript", false).boxed()); // Proxy media through Redlib app.at("/vid/:id/:size").get(|r| proxy(r, "https://v.redd.it/{id}/DASH_{size}").boxed()); diff --git a/static/highlighted.js b/static/highlighted.js new file mode 100644 index 0000000..6c7079c --- /dev/null +++ b/static/highlighted.js @@ -0,0 +1 @@ +document.querySelector('#commentQueryForms').scrollIntoView(); \ No newline at end of file diff --git a/templates/post.html b/templates/post.html index 0902e03..17ad456 100644 --- a/templates/post.html +++ b/templates/post.html @@ -31,6 +31,9 @@ {% else %} + {% if single_thread %} + + {% endif %} {% endif %} {% endblock %}