From 4100fc683c30a6908f1a461b00d365dbe70e105e Mon Sep 17 00:00:00 2001 From: f0x Date: Mon, 3 Oct 2022 17:03:18 +0000 Subject: [PATCH] scroll to highlighted toot, improve highlight --- web/source/css/_colors.css | 2 +- web/source/frontend/index.js | 8 ++++++++ web/template/thread.tmpl | 6 +++--- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/web/source/css/_colors.css b/web/source/css/_colors.css index fb07758aa..026d41450 100644 --- a/web/source/css/_colors.css +++ b/web/source/css/_colors.css @@ -71,7 +71,7 @@ $button-danger-fg: $gray1; $button-danger-hover-bg: $orange2; $toot-focus-bg: $gray5; -$toot-unfocus-bg: $gray3; +$toot-unfocus-bg: $gray2; $toot-info-bg: $gray4; diff --git a/web/source/frontend/index.js b/web/source/frontend/index.js index 2a54d52b6..b1187f515 100644 --- a/web/source/frontend/index.js +++ b/web/source/frontend/index.js @@ -22,6 +22,14 @@ const Photoswipe = require("photoswipe/dist/umd/photoswipe.umd.min.js"); const PhotoswipeLightbox = require("photoswipe/dist/umd/photoswipe-lightbox.umd.min.js"); const PhotoswipeCaptionPlugin = require("photoswipe-dynamic-caption-plugin").default; +let [_, _user, type, id] = window.location.pathname.split("/"); +if (type == "statuses") { + let firstStatus = document.getElementsByClassName("thread")[0].children[0]; + if (firstStatus.id != id) { + document.getElementById(id).scrollIntoView(); + } +} + const lightbox = new PhotoswipeLightbox({ gallery: '.photoswipe-gallery', children: 'a', diff --git a/web/template/thread.tmpl b/web/template/thread.tmpl index 334bd8a9f..09f3e06c7 100644 --- a/web/template/thread.tmpl +++ b/web/template/thread.tmpl @@ -2,15 +2,15 @@
{{range .context.Ancestors}} -
+
{{ template "status.tmpl" .}}
{{end}} -
+
{{ template "status.tmpl" .status}}
{{range .context.Descendants}} -
+
{{ template "status.tmpl" .}}
{{end}}