scroll to highlighted toot, improve highlight

This commit is contained in:
f0x 2022-10-03 17:03:18 +00:00
parent fe238f8595
commit 4100fc683c
3 changed files with 12 additions and 4 deletions

View File

@ -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;

View File

@ -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',

View File

@ -2,15 +2,15 @@
<main>
<div data-nosnippet class="thread">
{{range .context.Ancestors}}
<div class="toot">
<div class="toot" id="{{.ID}}">
{{ template "status.tmpl" .}}
</div>
{{end}}
<div class="toot expanded">
<div class="toot expanded" id="{{.status.ID}}">
{{ template "status.tmpl" .status}}
</div>
{{range .context.Descendants}}
<div class="toot">
<div class="toot" id="{{.ID}}">
{{ template "status.tmpl" .}}
</div>
{{end}}