Add scrolling to highlighted comment (fix #13)

This commit is contained in:
Matthew Esposito 2024-01-02 19:43:00 -05:00
parent dea805936c
commit 3dee29f3ef
No known key found for this signature in database
3 changed files with 7 additions and 0 deletions

View File

@ -229,6 +229,9 @@ async fn main() {
app app
.at("/hls.min.js") .at("/hls.min.js")
.get(|_| resource(include_str!("../static/hls.min.js"), "text/javascript", false).boxed()); .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 // Proxy media through Redlib
app.at("/vid/:id/:size").get(|r| proxy(r, "https://v.redd.it/{id}/DASH_{size}").boxed()); app.at("/vid/:id/:size").get(|r| proxy(r, "https://v.redd.it/{id}/DASH_{size}").boxed());

1
static/highlighted.js Normal file
View File

@ -0,0 +1 @@
document.querySelector('#commentQueryForms').scrollIntoView();

View File

@ -31,6 +31,9 @@
<meta property="og:video:type" content="video/mp4"> <meta property="og:video:type" content="video/mp4">
{% else %} {% else %}
<meta property="og:type" content="website"> <meta property="og:type" content="website">
{% if single_thread %}
<script src="/highlighted.js" defer></script>
{% endif %}
{% endif %} {% endif %}
{% endblock %} {% endblock %}