mirror of
1
Fork 0

[frontend] Profiles with fields & more (#1764)

* redesign status template

* separate index page styling

* redesign profile template

* fix header styling/wrapping

* remove old spoiler js

* fix status cw button wrapping

* fix status info variables

* profile responsiveness, accessibility tweaks

* fix variable use, mobile

* remove duplicate id's

* rss icon, fix indent

* fix toot border-radius

* fix toot spacing

* emojify and html profile fields

* refactor (sensitive) media rendering

* plaintext profile fields

* bundle plyr icon svg

* only pause video when switching photoswipe slides

* yarn upgrade

* profile fields formatting

* replace uglifyify with @browserify updated fork

* fix profile field templating (yet again)

* fix React classes

* testrig: add testing profile field for admin user

* fix sensitive media interactions

* Revert "testrig: add testing profile field for admin user"

This reverts commit 80490c183e.

* settings interface wrapping

* fix reported toot styling

* add role to profile sr-only text

* comment fallback rule

* remove currently unused image description lacking indicator
This commit is contained in:
f0x52 2023-05-11 17:46:32 +02:00 committed by GitHub
parent 6392e00653
commit 9cc9ffc5a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 1754 additions and 1382 deletions

View File

@ -22,6 +22,7 @@ import (
"html/template"
"os"
"path/filepath"
"strings"
"time"
"github.com/gin-gonic/gin"
@ -158,6 +159,15 @@ func emojify(emojis []apimodel.Emoji, inputText template.HTML) template.HTML {
return template.HTML(out)
}
func acctInstance(acct string) string {
parts := strings.Split(acct, "@")
if len(parts) > 1 {
return "@" + parts[1]
}
return ""
}
func LoadTemplateFunctions(engine *gin.Engine) {
engine.SetFuncMap(template.FuncMap{
"escape": escape,
@ -169,5 +179,6 @@ func LoadTemplateFunctions(engine *gin.Engine) {
"timestampVague": timestampVague,
"timestampPrecise": timestampPrecise,
"emojify": emojify,
"acctInstance": acctInstance,
})
}

View File

@ -43,5 +43,8 @@ func (m *Module) baseHandler(c *gin.Context) {
c.HTML(http.StatusOK, "index.tmpl", gin.H{
"instance": instance,
"ogMeta": ogBase(instance),
"stylesheets": []string{
distPathPrefix + "/index.css",
},
})
}

View File

@ -5,3 +5,5 @@ The following files and subdirectories in this directory are licensed under the
- ./default_avatars/* (all default avatars)
To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/4.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
The plyr.svg file is MIT licensed, and can be found at https://github.com/sampotts/plyr

1
web/assets/plyr.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 5.6 KiB

View File

@ -69,8 +69,10 @@ $border-accent: $orange2;
$link-fg: $fg-accent;
$role-moderator: $orange1;
$role-admin: $blue2;
$role-admin: $orange2;
$role-mod: $blue2;
$profile-bg: $gray4;
$button-bg: $blue2;
$button-fg: $gray1;
@ -80,10 +82,11 @@ $button-danger-bg: $error3;
$button-danger-fg: $white1;
$button-danger-hover-bg: $error2;
$toot-focus-bg: $gray5;
$toot-unfocus-bg: $gray2;
$toot-bg: $gray3;
$toot-info-bg: $gray2;
$toot-info-bg: $gray4;
$toot-focus-bg: $gray5;
$toot-focus-info-bg: $gray4;
$no-img-desc-bg: $orange1;
$no-img-desc-fg: $gray1;
@ -117,3 +120,12 @@ $error-bg: $error2;
$list-entry-bg: $gray2;
$list-entry-alternate-bg: $gray3;
$list-entry-hover-bg: $gray4;
/* Plyr video player */
$plyr-color-main: $orange2;
$plyr-video-background: $bg-accent;
$plyr-badge-background: $bg-accent;
$plyr-video-controls-background: $bg-accent;
$plyr-badge-text-color: $fg;
$plyr-badge-border-radius: $br;
$plyr-video-progress-buffered-background: $gray8;

View File

@ -44,6 +44,11 @@ $br: 0.4rem;
inside something with $br, eg avatar, header img */
$br-inner: 0.2rem;
/* Fork-Awesome 'fa-fw' fixed icon width
keep in sync with https://github.com/ForkAwesome/Fork-Awesome/blob/a99579ae3e735ee70e51ed62dfcee3172b5b2db7/css/fork-awesome.css#L50
*/
$fa-fw: 1.28571429em;
html, body {
padding: 0;
margin: 0;
@ -95,27 +100,26 @@ header {
}
header a {
margin: 2rem;
display: flex;
flex-wrap: wrap;
gap: 2rem;
margin: 1.5rem;
gap: 1rem;
justify-content: center;
img {
align-self: center;
height: 6rem;
height: 3rem;
}
div {
flex-grow: 1;
align-self: center;
display: flex;
h1 {
word-wrap: anywhere;
flex-grow: 1;
align-self: center;
text-align: center;
font-size: 1.5rem;
word-wrap: anywhere;
color: $fg;
}
}
}
.excerpt-top {
@ -132,15 +136,6 @@ header a {
}
main {
section {
background: $bg-accent;
box-shadow: $boxshadow;
border: $boxshadow-border;
border-radius: $br;
padding: 2rem;
margin-bottom: 2rem;
}
p:first-child {
margin-top: 0;
}

41
web/source/css/index.css Normal file
View File

@ -0,0 +1,41 @@
/*
GoToSocial
Copyright (C) 2021-2023 GoToSocial Authors admin@gotosocial.org
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
header a {
margin: 2rem;
gap: 2rem;
img {
height: 6rem;
}
h1 {
font-size: 2rem;
}
}
main {
section {
background: $bg-accent;
box-shadow: $boxshadow;
border: $boxshadow-border;
border-radius: $br;
padding: 2rem;
margin-bottom: 2rem;
}
}

View File

@ -16,269 +16,187 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
header {
a img {
height: 5rem;
}
}
main {
background: transparent;
padding-top: 0;
.page {
grid-template-columns: 1fr minmax(auto, 60rem) 1fr; /* fallback for lack of min() support */
grid-template-columns: 1fr min(92%, 65rem) 1fr;
}
.profile {
background: $bg-accent;
display: grid;
grid-template-columns: 100%;
gap: 0.5rem;
margin-bottom: 0.2rem;
overflow-x: hidden;
position: relative;
padding: 0.5rem;
border-radius: $br;
box-shadow: $boxshadow;
border: $boxshadow-border;
.headerimage {
width: 100%;
aspect-ratio: 3 / 1;
max-height: 16rem;
.column-split {
display: flex;
flex-wrap: wrap;
gap: 1rem;
}
}
.profile .header {
background: $profile-bg;
border-radius: $br;
overflow: hidden;
box-shadow: $boxshadow;
margin-bottom: 1rem;
.header-image {
position: relative;
padding-top: 33.33%; /* aspect-ratio 1/3 */
img {
position: absolute;
top: 0;
left: 0;
right: 0;
width: 100%;
height: 100%;
object-fit: cover;
border-radius: $br-inner $br-inner 0 0;
}
}
.basic {
height: 8.5rem;
margin-top: -6.5rem;
/*
Basic info container has the user's avatar, display- and username, and role
It's partially overlapped over the header image, by a negative margin-top
*/
$avatar-size: 8.5rem;
$name-size: 3rem;
$username-size: 2rem;
$overlap: calc($avatar-size - $name-size - $username-size);
.basic-info {
position: relative;
display: grid;
grid-template-columns: 1rem 8.5rem 1fr;
grid-template-rows: 3rem 3rem 2.5rem;
box-sizing: border-box;
grid-template-columns: $avatar-size auto 1fr;
grid-template-rows: $overlap $name-size auto;
grid-template-areas:
". avatar ."
"filler2 avatar displayname"
". avatar username";
"avatar . ."
"avatar displayname displayname"
"avatar username role";
#profile-basic-filler2 {
grid-area: filler2;
background: $bg-trans;
}
margin: 1rem;
margin-top: calc(-1 * $overlap);
gap: 0 1rem;
.avatar {
align-self: end;
box-sizing: border-box;
height: 8.5rem;
width: 8.5rem;
grid-area: avatar;
background: $bg;
height: $avatar-size;
width: $avatar-size;
border: 0.2rem solid $avatar-border;
padding: 0;
border-radius: $br;
position: relative;
overflow: hidden; /* prevents image extending beyond rounded borders */
box-shadow: $boxshadow;
img {
object-fit: cover;
border-radius: $br-inner;
width: 100%;
height: 100%;
width: 100%;
object-fit: cover;
}
}
a, div {
color: inherit;
text-decoration: none;
}
.displayname {
grid-area: displayname;
line-height: $name-size;
font-size: 1.5rem;
font-weight: bold;
font-size: 2rem;
line-height: 3rem;
background: $bg-trans;
word-break: break-all;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
max-height: 6rem;
padding: 0 0.5rem;
}
.usernamecontainer {
height: 2.5rem;
display: grid;
grid-template-columns: auto 1fr;
grid-area: username;
/* justify-content: space-between; */
padding: 0;
gap: 0.5rem;
position: relative;
color: $fg-accent;
font-weight: bold;
.username {
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
user-select: all;
min-width: 0;
grid-area: username;
line-height: $username-size;
line-height: 2.5rem;
padding-left: 0;
margin-left: 0.5rem;
font-size: 1rem;
font-weight: bold;
color: $fg-accent;
user-select: all;
}
.role {
justify-self: start;
background: $bg;
color: $fg;
border: 0.13rem solid $bg;
grid-area: role;
align-self: center;
justify-self: start;
border-radius: $br;
padding: 0.3rem;
line-height: 1.1rem;
font-size: 0.9rem;
margin-right: 0.2rem;
padding: 0.2rem;
margin-top: 0.1rem;
padding-top: 0.1rem;
border: 0.1rem solid $gray1;
border-radius: $br;
font-variant: small-caps;
font-weight: bold;
&.admin {
color: $role-admin;
border-color: $role-admin;
}
.role.admin {
background: $gray1;
color: $orange2;
border-color: $orange2;
&.moderator {
color: $role-mod;
border-color: $role-mod;
}
}
}
}
.role.moderator {
background: $gray1;
color: $blue2;
border-color: $blue1;
}
}
}
@media screen and (max-width: 600px) {
& {
gap: 0.1rem;
}
.basic {
margin-top: calc(-22vw + 1rem);
height: initial;
display: flex;
flex-direction: column;
#profile-basic-filler2 {
display: none;
}
.avatar {
align-self: flex-start;
margin-left: 1rem;
height: 22vw;
width: 22vw;
}
@media screen and (max-width: 750px) {
.profile .header {
.basic-info {
grid-template-columns: auto 1fr;
grid-template-rows: $avatar-size $name-size auto;
grid-template-areas:
"avatar avatar"
"displayname displayname"
"username role";
.displayname {
padding-left: 1rem;
font-size: 1.5rem;
line-height: 2rem;
margin-top: 0.5rem;
align-self: stretch;
font-size: 1.4rem;
}
}
}
}
.usernamecontainer {
padding-left: 1rem;
.profile .col-header {
display: flex;
justify-content: start;
gap: 2rem;
align-items: center;
.username {
margin-left: 0;
}
}
}
}
margin: 0;
background: $profile-bg;
border-top-left-radius: $br;
border-top-right-radius: $br;
padding: 0.75rem;
.detailed {
h3 {
font-size: 1.2rem;
line-height: 1.3rem;
margin: 0;
}
}
.profile .toots {
flex: 65 25rem;
display: flex;
flex-direction: column;
flex: 1 1 25em;
gap: 0.4rem;
h2 {
margin-top: 0;
}
.bio {
margin-top: 0;
margin-bottom: 0.5rem;
margin-left: 1rem;
margin-right: 1rem;
word-break: break-word;
.col-header {
display: grid;
grid-template-columns: auto 1fr;
gap: 1rem;
a {
color: $acc1;
text-decoration: underline;
}
}
}
}
.accountstats {
display: flex;
flex-wrap: wrap;
border-radius: 0 0 $br $br;
border-top: 0.1rem solid $bg;
.entry-group {
flex: 1 1 auto;
min-width: 50%;
display: flex;
justify-self: end;
}
.entry {
white-space: nowrap;
width: 50%;
margin: 1.2rem 0.5rem;
text-align: center;
}
}
.nothinghere {
margin-left: 1rem;
}
.backnextlinks {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
a {
padding: 1rem;
}
.next {
margin-left: auto;
}
}
.toot, .toot:last-child {
box-shadow: $boxshadow;
}
#recent, #pinned {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
margin: 1rem;
.rss-icon {
font-size: 1.45em;
display: block;
margin: -0.25rem 0;
.fa {
font-size: 2rem;
object-fit: contain;
vertical-align: middle;
color: $orange2;
@ -286,4 +204,64 @@ main {
background: linear-gradient(to right, $white1 100%, transparent 0) no-repeat center center;
background-size: 1.2rem 1.4rem;
}
}
}
.toot {
border-radius: 0;
.info {
padding: 0.3rem 0.75rem;
}
&:last-child {
border-bottom-left-radius: $br;
border-bottom-right-radius: $br;
}
}
}
.profile .about-user {
flex: 35 14rem;
border-radius: $br;
overflow: hidden;
.col-header {
margin-bottom: -0.25rem;
}
.fields {
background: $profile-bg;
display: flex;
flex-direction: column;
padding: 0 0.5rem;
padding-top: 0.25rem;
.field {
padding: 0.25rem;
display: flex;
flex-direction: column;
border-bottom: 0.1rem solid $gray2;
word-break: break-all;
&:first-child {
border-top: 0.1rem solid $gray2;
}
}
}
.bio {
background: $profile-bg;
padding: 1rem 0.75rem;
padding-bottom: 1.25rem;
}
.accountstats {
background: $bg-accent;
padding: 0.75rem;
display: grid;
grid-template-columns: auto 1fr;
gap: 0.25rem 1rem;
}
}

View File

@ -18,6 +18,7 @@
@import "photoswipe/dist/photoswipe.css";
@import "photoswipe-dynamic-caption-plugin/photoswipe-dynamic-caption-plugin.css";
@import "plyr/dist/plyr.css";
main {
background: transparent;
@ -31,13 +32,13 @@ main {
}
.toot {
background: $toot-unfocus-bg;
background: $toot-bg;
box-shadow: $boxshadow;
border: $boxshadow-border;
border-radius: $br;
position: relative;
margin-bottom: $br;
padding-top: 1.5rem;
padding-bottom: 0.7rem;
padding-top: 0.75rem;
a {
position: relative;
@ -46,26 +47,24 @@ main {
text-decoration: none;
}
.contentgrid {
padding: 0 1.5rem;
.author > a {
padding: 0 0.75rem;
display: grid;
grid-template-columns: 4rem 1fr auto;
grid-template-rows: 1.5rem auto auto auto;
column-gap: 0.5rem;
}
.not-expanded {
color: $fg-reduced;
grid-column: 3;
grid-row: 1;
}
grid-template-columns: 3.5rem 1fr auto;
grid-template-rows: auto auto;
grid-template-areas:
"avatar display date"
"avatar user .";
gap: 0 0.5rem;
.avatar {
grid-row: span 3;
aspect-ratio: 1/1;
display: flex;
border: 0.2rem solid $avatar-border;
border-radius: 0.4rem;
grid-area: avatar;
height: 3.5rem;
width: 3.5rem;
object-fit: cover;
border: 0.15rem solid $avatar-border;
border-radius: $br;
overflow: hidden; /* hides corners from img overflowing */
img {
@ -87,46 +86,49 @@ main {
}
.displayname {
grid-area: display;
font-weight: bold;
font-size: 1.5rem;
line-height: 2rem;
margin-top: -0.5rem;
font-size: 1rem;
line-height: 1.3rem;
/* margin-top: -0.5rem; */
}
.username {
grid-area: user;
color: $link-fg;
font-size: 1rem;
line-height: 1.3rem;
}
input.spoiler:checked ~ .content {
display: none;
.timestamp {
grid-area: date;
color: $fg-reduced;
}
}
.spoiler {
padding-bottom: 0.5rem;
.body {
padding: 0.5rem 0.75rem;
display: flex;
align-items: center;
flex-wrap: wrap;
gap: 0.4rem;
.spoiler-text {
word-break: break-word;
flex-direction: column;
gap: 0.5rem;
}
label {
padding: 0.2rem 0.3rem;
details > summary {
display: inline-block;
list-style: none;
&::-webkit-details-marker {
display: none; /* Safari */
}
.button {
white-space: nowrap;
cursor: pointer;
font-size: 1rem;
}
label:hover {
}
}
.text {
margin: 0;
padding-top: 0.5rem;
grid-row: span 1;
grid-column: 1 / span 3;
@ -135,14 +137,21 @@ main {
width: 100%;
details > summary {
padding-bottom: 0.5rem;
.button {
padding: 0.2rem 0.3rem;
font-size: 1rem;
}
}
a {
color: $link-fg;
text-decoration: underline;
}
.content {
padding-bottom: 0.5rem;
word-break: break-word;
blockquote {
@ -202,17 +211,104 @@ main {
}
.media {
margin-top: 0.5rem;
border-radius: $br;
grid-column: span 3;
display: grid;
grid-template-columns: 50% 50%;
grid-auto-rows: 10rem;
overflow: hidden;
gap: 0.3rem;
.media-wrapper {
height: 100%;
width: 100%;
box-sizing: border-box;
border: 0.15rem solid $gray1;
border-radius: $br;
position: relative;
overflow: hidden;
z-index: 2;
details {
position: absolute;
height: 100%;
width: 100%;
&[open] summary {
height: auto;
width: auto;
margin: 1rem;
padding: 0;
.show, video, img {
display: none;
}
.eye.button .hide {
display: inline-block;
grid-column: 1 / span 3;
grid-row: 1 / span 2;
}
}
summary {
position: absolute;
height: 100%;
width: 100%;
z-index: 3;
overflow: hidden;
display: grid;
padding: 1rem;
grid-template-columns: 1fr auto 1fr;
grid-template-rows: 1fr 1fr;
grid-template-areas:
"eye sensitive ."
". sensitive .";
.eye.button {
grid-area: eye;
align-self: start;
justify-self: start;
margin: 0;
padding: 0.4rem;
.fa-fw {
line-height: $fa-fw;
}
.hide {
display: none;
}
}
.show.sensitive {
grid-area: sensitive;
align-self: center;
.button {
cursor: pointer;
align-self: center;
}
}
video, img {
z-index: -1;
position: absolute;
height: calc(100% + 1.2rem);
width: calc(100% + 1.2rem);
top: -0.6rem;
left: -0.6rem;
filter: blur(1.2rem);
}
}
video.plyr-video, .plyr {
position: absolute;
height: 100%;
width: 100%;
object-fit: contain;
background: $gray1;
}
}
}
&.single .media-wrapper {
@ -223,133 +319,6 @@ main {
grid-row: span 2;
}
.open, .open .button {
display: none;
}
.closed {
z-index: 2;
}
input.sensitive-checkbox:checked { /* Media is shown */
& ~ .video-play {
display: flex;
}
& ~ .sensitive {
.closed {
transition: 0.8s;
pointer-events: none;
opacity: 0;
& > * {
display: none;
}
}
.open {
display: flex;
justify-content: flex-start;
.button {
align-self: flex-start;
display: initial;
z-index: 4;
}
}
}
}
.video-play {
.icon-span {
align-self: center;
display: initial;
z-index: 4;
.icon {
color: $white1;
}
.icon-bg {
color: $gray1;
font-size: 1.1em;
}
}
display: none;
position: absolute;
height: 100%;
width: 100%;
justify-content: center;
align-items: center;
font-size: 7em;
pointer-events: none;
}
.sensitive {
position: absolute;
height: 100%;
width: 100%;
.open, .closed {
display: flex;
position: absolute;
height: 100%;
width: 100%;
justify-content: center;
padding: 1rem;
label {
z-index: 3;
}
}
.closed {
transition: 0.3s;
background: $bg-sensitive;
@supports (backdrop-filter: blur(2rem)) {
background: transparent;
backdrop-filter: blur(2rem);
}
.button {
align-self: center;
justify-self: center;
}
}
}
.no-image-desc {
color: $no-img-desc-fg;
background: $no-img-desc-bg;
display: flex;
position: absolute;
bottom: 0.1rem;
right: 0.4rem;
margin-bottom: 0.4rem;
margin-right: 0.4rem;
padding: 0.1rem 0.45rem;
border-radius: 100%;
border: 0.2rem solid $button-fg;
z-index: 3;
i.fa {
display: block;
line-height: 1.6rem;
}
span {
margin-left: 0.3rem;
display: none;
}
&:hover {
span {
display: block;
}
border-radius: 0.2rem;
}
}
img {
width: 100%;
height: 100%;
@ -358,14 +327,14 @@ main {
}
.info {
display: flex;
background: $toot-info-bg;
color: $fg-reduced;
display: none;
border-top: 0.15rem solid $toot-info-border;
padding: 0.5rem 1.5rem;
padding: 0.5rem 0.75rem;
div {
padding-right: 1.3rem;
div, time {
padding-right: 1rem;
}
.stats {
@ -406,39 +375,39 @@ main {
background: $toot-focus-bg;
padding-bottom: 0;
.contentgrid {
.displayname {
grid-column: span 2;
}
.not-expanded {
display: none;
}
}
.info {
display: flex;
}
.media {
margin-bottom: 0.5rem;
background: $toot-focus-info-bg;
}
}
}
footer + div { /* something weird from the devstack.. */
display: none;
}
.plyr--video {
flex-direction: column-reverse;
@media screen and (max-width: 89ch) {
.toot {
.contentgrid {
grid-template-rows: 1.5rem 1.3rem 1.3rem auto;
.plyr__video-wrapper {
position: relative;
}
.username, .not-expanded {
grid-column: 2;
grid-row: auto;
.plyr__controls {
align-self: stretch;
position: initial;
padding: 0.1rem;
padding-top: 0.2rem;
}
.plyr__control {
box-shadow: none;
}
.plyr__control--overlaid {
top: calc(50% - 18px);
}
}
.pswp__content {
padding: 2rem;
.plyr {
max-height: 100%;
}
}

View File

@ -22,7 +22,7 @@
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;
const PhotoswipeVideoPlugin = require("photoswipe-video-plugin").default;
const Plyr = require("plyr");
let [_, _user, type, id] = window.location.pathname.split("/");
if (type == "statuses") {
@ -34,29 +34,128 @@ if (type == "statuses") {
const lightbox = new PhotoswipeLightbox({
gallery: '.photoswipe-gallery',
children: 'a',
children: '.photoswipe-slide',
pswpModule: Photoswipe,
});
new PhotoswipeCaptionPlugin(lightbox, {
type: 'auto',
captionContent(slide) {
return slide.data.alt;
}
});
lightbox.addFilter('itemData', (item) => {
const el = item.element;
if (el && el.classList.contains("plyr-video")) {
const parentNode = el._plyrContainer.parentNode;
return {
alt: el.getAttribute("alt"),
_video: {
open(c) {
c.appendChild(el._plyrContainer);
},
close() {
parentNode.appendChild(el._plyrContainer);
},
pause() {
el._player.pause();
}
},
width: parseInt(el.dataset.pswpWidth),
height: parseInt(el.dataset.pswpHeight)
};
}
return item;
});
lightbox.on("contentActivate", (e) => {
const { content } = e;
if (content.data._video != undefined) {
content.data._video.open(content.element);
}
});
lightbox.on("contentDeactivate", (e) => {
const { content } = e;
if (content.data._video != undefined) {
content.data._video.pause();
content.data._video.close();
}
});
lightbox.on("close", function () {
if (lightbox.pswp.currSlide.data._video != undefined) {
lightbox.pswp.currSlide.data._video.close();
}
});
new PhotoswipeVideoPlugin(lightbox, {});
lightbox.init();
Array.from(document.getElementsByClassName("spoiler-label")).forEach((label) => {
let checkbox = document.getElementById(label.htmlFor);
if (checkbox != undefined) {
function update() {
if (checkbox.checked) {
label.innerHTML = "Show more";
} else {
label.innerHTML = "Show less";
}
}
function dynamicSpoiler(className, updateFunc) {
Array.from(document.getElementsByClassName(className)).forEach((spoiler) => {
const update = updateFunc(spoiler);
if (update) {
update();
spoiler.addEventListener("toggle", update);
}
});
}
label.addEventListener("click", () => { setTimeout(update, 1); });
dynamicSpoiler("text-spoiler", (spoiler) => {
const button = spoiler.querySelector("button");
if (button != undefined) {
return () => {
button.textContent = spoiler.open
? "Show less"
: "Show more";
};
}
});
dynamicSpoiler("video-spoiler", (spoiler) => {
const video = spoiler.querySelector(".plyr-video");
const eye = spoiler.querySelector(".eye.button");
if (video != undefined) {
return () => {
if (spoiler.open) {
eye.setAttribute("aria-label", "Hide media");
} else {
eye.setAttribute("aria-label", "Show media");
video.pause();
}
};
}
});
Array.from(document.getElementsByClassName("plyr-video")).forEach((video) => {
let player = new Plyr(video, {
title: video.title,
settings: ["loop"],
disableContextMenu: false,
hideControls: false,
tooltips: { contrors: true, seek: true },
iconUrl: "/assets/plyr.svg",
listeners: {
fullscreen: () => {
if (player.playing) {
setTimeout(() => {
player.play();
}, 1);
}
lightbox.loadAndOpen(parseInt(video.dataset.pswpIndex), {
gallery: video.closest(".photoswipe-gallery")
});
return false;
}
}
});
player.elements.container.title = video.title;
video._player = player;
video._plyrContainer = player.elements.container;
});

View File

@ -29,7 +29,7 @@ let cssEntryFiles = fs.readdirSync(path.join(__dirname, "./css")).map((file) =>
const prodCfg = {
transform: [
["uglifyify", {
["@browserify/uglifyify", {
global: true,
exts: ".js"
}],

View File

@ -24,7 +24,7 @@
"papaparse": "^5.3.2",
"photoswipe": "^5.3.3",
"photoswipe-dynamic-caption-plugin": "^1.2.7",
"photoswipe-video-plugin": "^1.0.2",
"plyr": "^3.7.8",
"psl": "^1.9.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
@ -42,6 +42,7 @@
"@babel/preset-env": "^7.19.4",
"@babel/preset-react": "^7.18.6",
"@browserify/envify": "^6.0.0",
"@browserify/uglifyify": "^6.0.0",
"@joepie91/eslint-config": "^1.1.1",
"autoprefixer": "^10.4.13",
"babelify": "^10.0.0",
@ -55,7 +56,6 @@
"postcss": "^8.4.18",
"postcss-custom-prop-vars": "^0.0.5",
"postcss-import": "^15.0.0",
"postcss-nested": "^6.0.0",
"uglifyify": "^5.0.2"
"postcss-nested": "^6.0.0"
}
}

View File

@ -140,13 +140,18 @@ function ReportedToot({ toot }) {
const account = toot.account;
return (
<div className="toot expanded">
<div className="contentgrid">
<span className="avatar">
<img src={account.avatar} alt="" />
<article className="toot expanded">
<section className="author">
<a>
<img className="avatar" src={account.avatar} alt="" />
<span className="displayname">
{account.display_name.trim().length > 0 ? account.display_name : account.username}
<span className="sr-only">.</span>
</span>
<span className="displayname">{account.display_name.trim().length > 0 ? account.display_name : account.username}</span>
<span className="username">@{account.username}</span>
</a>
</section>
<section className="body">
<div className="text">
<div className="content">
{toot.spoiler_text?.length > 0
@ -158,15 +163,11 @@ function ReportedToot({ toot }) {
{toot.media_attachments?.length > 0 &&
<TootMedia media={toot.media_attachments} sensitive={toot.sensitive} />
}
</div>
<div className="toot-info">
<a
href={toot.url}
target="_blank"
rel="noreferrer"
>{new Date(toot.created_at).toLocaleString()}</a>
</div>
</div>
</section>
<aside className="info">
<time datetime={toot.created_at}>{new Date(toot.created_at).toLocaleString()}</time>
</aside>
</article>
);
}

View File

@ -24,17 +24,23 @@ const React = require("react");
module.exports = function FakeProfile({ avatar, header, display_name, username, role }) {
return ( // Keep in sync with web/template/profile.tmpl
<div className="profile">
<div className="headerimage">
<img className="headerpreview" src={header} alt={header ? `header image for ${username}` : "None set"} />
<div className="header">
<div className="header-image">
<img src={header} alt={header ? `header image for ${username}` : "None set"} />
</div>
<div className="basic">
<div id="profile-basic-filler2"></div>
<span className="avatar"><img className="avatarpreview" src={avatar} alt={avatar ? `avatar image for ${username}` : "None set"} /></span>
<div className="displayname">{display_name.trim().length > 0 ? display_name : username}</div>
<div className="usernamecontainer">
<div className="username"><span>@{username}</span></div>
<div className="basic-info" aria-hidden="true">
<a className="avatar" href="{{.account.Avatar}}">
<img src={avatar} alt={avatar ? `avatar image for ${username}` : "None set"} />
</a>
<span className="displayname text-cutoff">
{display_name.trim().length > 0 ? display_name : username}
<span className="sr-only">.</span>
</span>
<span className="username text-cutoff">@{username}</span>
{(role && role != "user") &&
<div className={`role ${role}`}>{role}</div>
<div className={`role ${role}`}>
<span className="sr-only">Role: </span>{role}
</div>
}
</div>
</div>

View File

@ -31,19 +31,22 @@ module.exports = function FakeToot({ children }) {
} } = query.useVerifyCredentialsQuery();
return (
<div className="toot expanded">
<div className="contentgrid">
<span className="avatar">
<img src={account.avatar} alt="" />
<article className="toot expanded">
<section className="author">
<a>
<img className="avatar" src={account.avatar} alt="" />
<span className="displayname">
{account.display_name.trim().length > 0 ? account.display_name : account.username}
<span className="sr-only">.</span>
</span>
<span className="displayname">{account.display_name.trim().length > 0 ? account.display_name : account.username}</span>
<span className="username">@{account.username}</span>
</a>
</section>
<section className="body">
<div className="text">
<div className="content">
{children}
</div>
</div>
</div>
</div>
</section>
</article>
);
};

View File

@ -16,11 +16,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* Fork-Awesome 'fa-fw' fixed icon width
keep in sync with https://github.com/ForkAwesome/Fork-Awesome/blob/a99579ae3e735ee70e51ed62dfcee3172b5b2db7/css/fork-awesome.css#L50
*/
$fa-fw: 1.28571429em;
body {
grid-template-rows: auto 1fr;
}
@ -30,10 +25,6 @@ body {
width: 100%;
}
section {
grid-column: 2;
}
header {
justify-content: start;
@ -51,19 +42,26 @@ header {
}
}
main section {
box-shadow: none;
border-radius: none;
border: none;
}
#root {
display: grid;
grid-template-columns: 1fr minmax(auto, 60rem) 1fr;
grid-template-columns: 1fr min(92%, 60rem) 1fr;
box-sizing: border-box;
display: flex;
justify-content: center;
flex-wrap: wrap;
margin: 0 1rem;
gap: 1rem;
section.oauth {
max-width: 92%;
width: 60rem;
}
section.with-sidebar {
flex-grow: 100;
flex-basis: 40rem;
background: $bg-accent;
padding: 2rem;
border-radius: $br;
& > div, & > form {
border-left: 0.2rem solid $border-accent;
padding-left: 0.4rem;
@ -97,13 +95,13 @@ main section {
}
.sidebar {
margin: 0 1rem;
flex-grow: 1;
flex-basis: 20rem;
align-self: start;
justify-self: end;
background: $bg;
display: flex;
flex-direction: column;
min-width: 12rem;
.account-card {
grid-template-columns: auto 1fr auto;
@ -240,10 +238,6 @@ nav.menu-tree {
text-transform: capitalize;
}
section {
margin-bottom: 1rem;
}
input, select, textarea {
box-sizing: border-box;
}
@ -406,9 +400,10 @@ section.with-sidebar > div, section.with-sidebar > form {
gap: 1rem;
.profile {
.basic {
margin-bottom: 0.5rem;
/* margin-top: 0; */
padding: 0;
.header {
border: 0.1rem solid $gray1;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -21,46 +21,61 @@
<!-- header.tmpl -->
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="robots" content="{{ if .robotsMeta }}{{ .robotsMeta }}{{ else }}noindex, nofollow{{ end }}">
{{ if .ogMeta }}{{ if .ogMeta.Locale }}<meta name="og:locale" content="{{ .ogMeta.Locale }}">
{{ end }}<meta property="og:type" content="{{ .ogMeta.Type }}">
{{ if .ogMeta }}{{ if .ogMeta.Locale }}
<meta name="og:locale" content="{{ .ogMeta.Locale }}">
{{ end }}
<meta property="og:type" content="{{ .ogMeta.Type }}">
<meta property="og:title" content="{{ .ogMeta.Title }}">
<meta property="og:url" content="{{ .ogMeta.URL }}">
<meta property="og:site_name" content="{{ .ogMeta.SiteName }}">
<meta property="og:description" {{ .ogMeta.Description | noescapeAttr }}>
{{ if .ogMeta.ArticlePublisher }}<meta property="og:article:publisher" content="{{ .ogMeta.ArticlePublisher }}">
{{ if .ogMeta.ArticlePublisher }}
<meta property="og:article:publisher" content="{{ .ogMeta.ArticlePublisher }}">
<meta property="og:article:author" content="{{ .ogMeta.ArticleAuthor }}">
<meta property="og:article:modified_time" content="{{ .ogMeta.ArticleModifiedTime }}">
<meta property="og:article:published_time" content="{{ .ogMeta.ArticlePublishedTime }}">
{{ end }}{{ if .ogMeta.ProfileUsername }}<meta property="og:profile:username" content="{{ .ogMeta.ProfileUsername }}">
{{ end }}<meta property="og:image" content="{{ .ogMeta.Image }}">
{{ if .ogMeta.ImageAlt }}<meta property="og:image:alt" content="{{ .ogMeta.ImageAlt }}">
{{ end }}{{ if .ogMeta.ImageWidth }}<meta property="og:image:width" content="{{ .ogMeta.ImageWidth }}">
{{ end }}{{ if .ogMeta.ProfileUsername }}
<meta property="og:profile:username" content="{{ .ogMeta.ProfileUsername }}">
{{ end }}
<meta property="og:image" content="{{ .ogMeta.Image }}">
{{ if .ogMeta.ImageAlt }}
<meta property="og:image:alt" content="{{ .ogMeta.ImageAlt }}">
{{ end }}{{ if .ogMeta.ImageWidth }}
<meta property="og:image:width" content="{{ .ogMeta.ImageWidth }}">
<meta property="og:image:height" content="{{ .ogMeta.ImageHeight }}">
{{ end }}{{ end }}<link rel="shortcut icon" href="{{ .instance.Thumbnail }}" type="{{ if .instance.ThumbnailType }}{{ .instance.ThumbnailType }}{{ else }}image/png{{ end }}">
{{ if .rssFeed }}<link rel="alternate" type="application/rss+xml" href="{{ .rssFeed }}" title="{{ if .ogMeta }}{{ .ogMeta.Title }}{{ else }}{{.instance.Title}}{{ end }}">{{ end }}
{{ end }}{{ end }}
<link rel="shortcut icon" href="{{ .instance.Thumbnail }}"
type="{{ if .instance.ThumbnailType }}{{ .instance.ThumbnailType }}{{ else }}image/png{{ end }}">
{{ if .rssFeed }}
<link rel="alternate" type="application/rss+xml" href="{{ .rssFeed }}"
title="{{ if .ogMeta }}{{ .ogMeta.Title }}{{ else }}{{.instance.Title}}{{ end }}">{{ end }}
<link rel="preload" href="/assets/dist/_colors.css" as="style">
<link rel="preload" href="/assets/dist/base.css" as="style">
{{range .stylesheets}}<link rel="preload" href="{{.}}" as="style">
{{end}}<link rel="stylesheet" href="/assets/dist/_colors.css">
{{range .stylesheets}}
<link rel="preload" href="{{.}}" as="style">
{{end}}
<link rel="stylesheet" href="/assets/dist/_colors.css">
<link rel="stylesheet" href="/assets/dist/base.css">
{{range .stylesheets}}<link rel="stylesheet" href="{{.}}">
{{range .stylesheets}}
<link rel="stylesheet" href="{{.}}">
{{end}}<title>{{ if .ogMeta }}{{ .ogMeta.Title }}{{ else }}{{.instance.Title}} - GoToSocial{{ end }}</title>
</head>
<body>
<div class="page">
<header>
<a aria-label="instance homepage" href="/" class="nounderline header">
<img src="{{ .instance.Thumbnail }}" alt="{{ if .instance.ThumbnailDescription }}{{ .instance.ThumbnailDescription }}{{ else }}Instance Logo{{ end }}"/>
<div>
<a aria-label="{{.instance.Title}}. Go to instance homepage" href="/" class="nounderline header">
<img src="{{ .instance.Thumbnail }}"
alt="{{ if .instance.ThumbnailDescription }}{{ .instance.ThumbnailDescription }}{{ else }}Instance Logo{{ end }}" />
<h1>
{{.instance.Title}}
</h1>
</div>
</a>
</header>
<div class="content">

View File

@ -18,73 +18,120 @@
*/ -}}
{{ template "header.tmpl" .}}
<main>
<div class="profile">
<div class="headerimage">
<main class="profile">
<div class="header">
<div class="header-image">
{{ if .account.Header }}
<img
src="{{.account.Header}}"
alt="{{if .account.DisplayName}}{{.account.DisplayName}}{{else}}{{.account.Username}}{{end}}'s header"
/>
<img src="{{.account.Header}}" alt="" />
{{ end }}
</div>
<div class="basic">
<div id="profile-basic-filler2"></div>
<a href="{{.account.Avatar}}" class="avatar"><img src="{{.account.Avatar}}" alt="{{if .account.DisplayName}}{{.account.DisplayName}}{{else}}{{.account.Username}}{{end}}'s avatar"></a>
<div class="displayname">{{if .account.DisplayName}}{{emojify .account.Emojis (escape .account.DisplayName)}}{{else}}{{.account.Username}}{{end}}</div>
<div class="usernamecontainer">
<div class="username">@{{ .account.Username }}@{{ .instance.AccountDomain }}</div>
<div class="basic-info" aria-hidden="true">
<a class="avatar" href="{{.account.Avatar}}">
<img src="{{.account.Avatar}}" alt="">
</a>
<span class="displayname text-cutoff">
{{if .account.DisplayName}}
{{emojify .account.Emojis (escape .account.DisplayName)}}
{{else}}
{{.account.Username}}
{{end}}
<span class="sr-only">.</span>
</span>
<span class="username text-cutoff">@{{.account.Username}}<span class="sr-only">,
</span>{{acctInstance .account.Acct}}</span>
{{- /* Only render account role if 1. it's present and 2. it's not equal to the standard 'user' role */ -}}
{{ if and (.account.Role) (ne .account.Role.Name "user") }}<div class="role {{ .account.Role.Name }}">{{ .account.Role.Name }}</div>{{ end }}
{{ if and (.account.Role) (ne .account.Role.Name "user") }}
<div class="role {{ .account.Role.Name }}">
{{ .account.Role.Name }}
</div>
{{ end }}
</div>
<div class="sr-only">
Profile for
{{if .account.DisplayName}}{{.account.DisplayName}}{{else}}{{.account.Username}}{{end}}.
Username @{{.account.Username}}, {{acctInstance .account.Acct}}.
{{ if and (.account.Role) (ne .account.Role.Name "user") }}
Role: {{ .account.Role.Name }}
{{ end }}
</div>
</div>
<div class="detailed">
<div class="column-split">
<section class="about-user">
<div class="col-header">
<h3>About</h3>
</div>
<div class="fields">
{{ range .account.Fields }}
<div class="field">
<b>{{emojify $.account.Emojis (noescape .Name)}}</b>
<span>{{emojify $.account.Emojis (noescape .Value)}}</span>
</div>
{{ end }}
</div>
<div class="bio">
{{ if .account.Note }}{{emojify .account.Emojis (noescape .account.Note)}}{{else}}This GoToSocial user hasn't written a bio yet!{{end}}
</div>
</div>
<div class="accountstats">
<div class="entry-group">
<div class="entry">Joined <b>{{.account.CreatedAt | timestampVague}}</b></div>
<div class="entry">Followed by <b>{{.account.FollowersCount}}</b></div>
</div>
<div class="entry-group">
<div class="entry">Following <b>{{.account.FollowingCount}}</b></div>
<div class="entry">Posted <b>{{.account.StatusesCount}}</b></div>
{{ if .account.Note }}
{{emojify .account.Emojis (noescape .account.Note)}}
{{else}}
This GoToSocial user hasn't written a bio yet!
{{end}}
</div>
<div class="sr-only" role="group">
<span>Joined on {{.account.CreatedAt | timestampVague}}.</span>
<span>{{.account.StatusesCount}} post{{if .account.StatusesCount | eq 1 | not}}s{{end}}.</span>
<span>Followed by {{.account.FollowersCount}}.</span>
<span>Following {{.account.FollowingCount}}.</span>
</div>
<div class="accountstats" aria-hidden="true">
<b>Joined</b><time datetime="{{.account.CreatedAt}}">{{.account.CreatedAt | timestampVague}}</time>
<b>Posts</b><span>{{.account.StatusesCount}}</span>
<b>Followed by</b><span>{{.account.FollowersCount}}</span>
<b>Following</b><span>{{.account.FollowingCount}}</span>
</div>
</section>
<section class="toots">
{{ if .pinned_statuses }}
<h2 id="pinned">
<span>Pinned toots</span>
</h2>
<div class="thread">
<div class="col-header">
<h3>Pinned posts</h3>
<a href="#recent">jump to recent</a>
</div>
<section class="thread">
{{ range .pinned_statuses }}
<div class="toot expanded">
<article class="toot expanded" id="{{.ID}}">
{{ template "status.tmpl" .}}
</div>
</article>
{{ end }}
</div>
</section>
{{ end }}
<h2 id="recent">
<span>Latest public toots</span>
<div class="col-header">
<h3 id="recent" tabindex="-1">Recent posts</h3>
{{ if .rssFeed }}
<a href="{{ .rssFeed }}" aria-label="RSS feed">
<i class="rss-icon fa fa-rss-square" aria-hidden="true"></i>
<a href="{{ .rssFeed }}" class="rss-icon" aria-label="RSS feed">
<i class="fa fa-rss-square" aria-hidden="true"></i>
</a>
{{ end }}
</h2>
</div>
<section class="thread">
{{ if not .statuses }}
<div data-nosnippet class="nothinghere">Nothing here!</div>
{{ else }}
<div class="thread">
{{ range .statuses }}
<div class="toot expanded">
<article class="toot expanded" id="{{.ID}}">
{{ template "status.tmpl" .}}
</div>
</article>
{{ end }}
</div>
{{ end }}
</section>
<div class="backnextlinks">
{{ if .show_back_to_top }}
<a href="/@{{ .account.Username }}">Back to top</a>
@ -93,5 +140,8 @@
<a href="{{ .statuses_next }}" class="next">Show older</a>
{{ end }}
</div>
</section>
</div>
</main>
{{ template "footer.tmpl" .}}

View File

@ -17,71 +17,110 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ -}}
<div data-nosnippet class="contentgrid">
<a href="{{.Account.URL}}" class="avatar"><img src="{{.Account.Avatar}}" alt=""></a>
<a href="{{.Account.URL}}" class="displayname">{{if .Account.DisplayName}}{{emojify .Account.Emojis (escape .Account.DisplayName)}}{{else}}{{.Account.Username}}{{end}}</a>
<a href="{{.Account.URL}}" class="username">@{{.Account.Acct}}</a>
<div class="not-expanded">
<span class="date">{{.CreatedAt | timestamp}}</span>
</div>
<section class="author">
<a href="{{.Account.URL}}">
<img class="avatar" src="{{.Account.Avatar}}" alt="">
<span class="displayname">
{{if .Account.DisplayName}}
{{emojify .Account.Emojis (escape .Account.DisplayName)}}
{{else}}
{{.Account.Username}}
{{end}}
<span class="sr-only">.</span>
</span>
<span class="username">@{{.Account.Username}}<span class="sr-only">, </span>{{acctInstance .Account.Acct}}</span>
</a>
</section>
<section class="body">
<div class="text">
{{if .SpoilerText}}
<input class="spoiler" id="hideSpoiler-{{.ID}}" type="checkbox" style="display: none" aria-hidden="true" checked="true" />
<div class="spoiler">
<details class="text-spoiler">
<summary>
<span class="spoiler-text">{{emojify .Emojis (escape .SpoilerText)}}</span>
<label class="button spoiler-label" for="hideSpoiler-{{.ID}}" tabindex="0">Toggle visibility</label>
</div>
{{end}}
<span class="button" role="button" tabindex="0">Toggle visibility</span>
</summary>
<div class="content">
{{emojify .Emojis (noescape .Content)}}
</div>
</details>
{{else}}
<div class="content">
{{emojify .Emojis (noescape .Content)}}
</div>
{{end}}
</div>
{{with .MediaAttachments}}
<div class="media photoswipe-gallery {{(len .) | oddOrEven }}{{if eq (len .) 1}} single{{end}}{{if eq (len .) 2}} double{{end}}">
{{range .}}
<div
class="media photoswipe-gallery {{(len .) | oddOrEven }}{{if eq (len .) 1}} single{{end}}{{if eq (len .) 2}} double{{end}}">
{{range $index, $media := .}}
{{with $media}}
<div class="media-wrapper">
{{if not .Description}}
<div class="no-image-desc" aria-hidden="true" ><i class="fa fa-info-circle"></i><span>Missing media description</span></div>
{{end}}
<input type="checkbox" id="sensitiveMedia-{{.ID}}" class="sensitive-checkbox hidden" {{if not $.Sensitive}}checked{{end}}/>
<div class="sensitive">
<div class="open">
<label for="sensitiveMedia-{{.ID}}" class="button" role="button" tabindex="0">
<i class="fa fa-eye-slash" title="Hide sensitive media"></i>
</label>
<details class="{{.Type}}-spoiler" {{if not $.Sensitive}}open{{end}}>
<summary>
<div class="show sensitive button" aria-hidden="true">
Show sensitive media
</div>
<div class="closed" {{if .Description}}title="{{.Description}}"{{end}}>
<label for="sensitiveMedia-{{.ID}}" class="button" role="button" tabindex="0">Show sensitive media</label>
</div>
</div>
{{ if eq .Type "video" }}
<div class="video-play">
<span class="icon-span fa-stack" aria-hidden="true">
<i class="icon-bg fa fa-fw fa-circle fa-stack-1x"></i>
<i class="icon fa fa-fw fa-play-circle fa-stack-1x"></i>
<span class="eye button" role="button" tabindex="0" aria-label="Toggle media">
<i class="hide fa fa-fw fa-eye-slash" aria-hidden="true"></i>
<i class="show fa fa-fw fa-eye" aria-hidden="true"></i>
</span>
</div>
{{ end }}
<a href="{{.URL}}"
target="_blank"
{{if .Description}}title="{{.Description}}"{{end}}
data-pswp-width="{{.Meta.Original.Width}}px"
data-pswp-height="{{.Meta.Original.Height}}px"
{{if eq .Type "video"}}data-pswp-type="video"{{end}}
{{if eq .Type "video"}}
<video {{if .Description}} title="{{.Description}}" {{end}}>
<source type="video/mp4" src="{{.URL}}" />
</video>
{{else}}
<img {{if .Description}} title="{{.Description}}" {{end}} src="{{.PreviewURL}}" />
{{end}}
</summary>
{{if eq .Type "video"}}
<video class="plyr-video photoswipe-slide" controls {{if .Description}}alt="{{.Description}}"
title="{{.Description}}" {{end}} data-pswp-index="{{$index}}" data-pswp-width="{{.Meta.Original.Width}}px"
data-pswp-height="{{.Meta.Original.Height}}px">
<source type="video/mp4" src="{{.URL}}" />
</video>
{{else}}
<a class="photoswipe-slide" href="{{.URL}}" target="_blank" {{if .Description}}title="{{.Description}}" {{end}}
data-pswp-width="{{.Meta.Original.Width}}px" data-pswp-height="{{.Meta.Original.Height}}px"
data-cropped="true">
<img src="{{.PreviewURL}}" {{if .Description}}alt="{{.Description}}"{{end}} data-blurhash="{{.Blurhash}}"/>
<img src="{{.PreviewURL}}" {{if .Description}}alt="{{.Description}}" {{end}} />
</a>
{{end}}
</details>
</div>
{{end}}
{{end}}
</div>
{{end}}
</div>
<div class="info">
<div id="date">{{.CreatedAt | timestampPrecise}}</div>
<div class="stats">
<div id="replies"><i aria-label="Replies" class="fa fa-reply-all"></i> {{.RepliesCount}}</div>
<div id="boosts"><i aria-label="Boosts" class="fa fa-retweet"></i> {{.ReblogsCount}}</div>
<div id="favorites"><i aria-label="Favorites" class="fa fa-star"></i> {{.FavouritesCount}}</div>
</section>
<aside class="info">
<time datetime="{{.CreatedAt}}">{{.CreatedAt | timestampPrecise}}</time>
<div class="stats" role="group">
<div>
<span aria-hidden="true">
<i class="fa fa-reply-all"></i> {{.RepliesCount}}
</span>
<span class="sr-only">{{.RepliesCount}} {{if .RepliesCount | eq 1}}reply{{else}}replies{{end}}</span>
</div>
</div>
<a data-nosnippet href="{{.URL}}" class="toot-link">View toot</a>
<div>
<span aria-hidden="true">
<i class="fa fa-star"></i> {{.FavouritesCount}}
</span>
<span class="sr-only">{{.FavouritesCount}} favourite{{if .FavouritesCount | eq 1 | not}}s{{end}}</span>
</div>
<div>
<span aria-hidden="true">
<i class="fa fa-retweet"></i> {{.ReblogsCount}}
</span>
<span class="sr-only">{{.ReblogsCount}} boost{{if .ReblogsCount | eq 1 | not}}s{{end}}</span>
</div>
{{if .Pinned}}
<div>
<i class="fa fa-thumb-tack" aria-hidden="true"></i>
<span class="sr-only">pinned</span>
</div>
{{end}}
</div>
</aside>
<a data-nosnippet href="{{.URL}}" class="toot-link">Open
thread</a>

View File

@ -19,20 +19,20 @@
{{ template "header.tmpl" .}}
<main>
<div data-nosnippet class="thread">
<section data-nosnippet class="thread">
{{range .context.Ancestors}}
<div class="toot" id="{{.ID}}">
<article class="toot" id="{{.ID}}">
{{ template "status.tmpl" .}}
</div>
</article>
{{end}}
<div class="toot expanded" id="{{.status.ID}}">
<article class="toot expanded" id="{{.status.ID}}">
{{ template "status.tmpl" .status}}
</div>
</article>
{{range .context.Descendants}}
<div class="toot" id="{{.ID}}">
<article class="toot" id="{{.ID}}">
{{ template "status.tmpl" .}}
</div>
</article>
{{end}}
</div>
</section>
</main>
{{ template "footer.tmpl" .}}