diff --git a/src/lib/structures/TimelineEntry.js b/src/lib/structures/TimelineEntry.js index 99f5736..eeb8024 100644 --- a/src/lib/structures/TimelineEntry.js +++ b/src/lib/structures/TimelineEntry.js @@ -27,6 +27,7 @@ class TimelineEntry extends TimelineBaseMethods { this.ownerPfpCacheP = null /** @type {import("./TimelineChild")[]} Not available until fetchChildren is called */ this.children = null + this.date = null } async update() { @@ -80,6 +81,21 @@ class TimelineEntry extends TimelineBaseMethods { * All mutations should act exactly once and have no effect on already mutated data. */ fixData() { + this.date = new Date(this.data.taken_at_timestamp*1000) + } + + getDisplayDate() { + function pad(number) { + return String(number).padStart(2, "0") + } + return ( + `${this.date.getUTCFullYear()}` + + `-${pad(this.date.getUTCMonth()+1)}` + + `-${pad(this.date.getUTCDay()+1)}` + + ` ${pad(this.date.getUTCHours())}` + + `:${pad(this.date.getUTCMinutes())}` + + ` UTC` + ) } getCaption() { diff --git a/src/lib/types.js b/src/lib/types.js index 255b85f..68eb0de 100644 --- a/src/lib/types.js +++ b/src/lib/types.js @@ -105,7 +105,6 @@ * @property {boolean} [has_ranked_comments] * @property {boolean} [comments_disabled] * @property {boolean} [commenting_disabled_for_viewer] - * @property {number} [taken_at_timestamp] * @property {boolean} [is_ad] * @property {any} [edge_web_media_to_related_media] todo: discover * Image diff --git a/src/site/pug/includes/post.pug b/src/site/pug/includes/post.pug index 0677538..961b49b 100644 --- a/src/site/pug/includes/post.pug +++ b/src/site/pug/includes/post.pug @@ -25,15 +25,18 @@ mixin post(post, headerWithNavigation) div.relative-box div.scrolling-box - if post.getCaption() - p.structured-text.description - +display_structured(post.getStructuredCaption()) + div + if post.getCaption() + p.structured-text.description + +display_structured(post.getStructuredCaption()) - if willDisplayAltInDescription - each child in post.children - - let caption = child.data.accessibility_caption - if caption - p.description= caption + footer + if willDisplayAltInDescription + - let caption = post.children[0].data.accessibility_caption + if caption + p.description= caption + p.description + span Posted on #[time(datetime=post.date.toISOString() data-local-date)= post.getDisplayDate()]. section.images-gallery for entry in post.children diff --git a/src/site/sass/includes/_main.sass b/src/site/sass/includes/_main.sass index 4a52623..440220f 100644 --- a/src/site/sass/includes/_main.sass +++ b/src/site/sass/includes/_main.sass @@ -362,8 +362,7 @@ body background-color: map-get($theme, "background-post-caption") color: map-get($theme, "foreground-primary") - @media screen and (min-width: $layout-b-min) - .relative-box + @media screen and (min-width: $layout-b-min) position: relative box-shadow: map-get($theme, "shadow-down-inset")