+5
models.js
+5
models.js
+29
post_component.js
+29
post_component.js
···
162
162
if (this.post.embed) {
163
163
let embed = new EmbedComponent(this.post, this.post.embed).buildElement();
164
164
wrapper.appendChild(embed);
165
+
166
+
if (this.post.originalFediURL) {
167
+
if (this.post.embed instanceof InlineLinkEmbed && this.post.embed.title.startsWith('Original post on ')) {
168
+
embed.remove();
169
+
}
170
+
}
171
+
}
172
+
173
+
if (this.post.originalFediURL) {
174
+
wrapper.appendChild(this.buildFediSourceLink());
165
175
}
166
176
167
177
if (this.post.likeCount !== undefined && this.post.repostCount !== undefined) {
···
474
484
loadHiddenReplies(loadMoreButton) {
475
485
loadMoreButton.innerHTML = `<img class="loader" src="icons/sunny.png">`;
476
486
this.loadHiddenSubtree(this.post, this.rootElement);
487
+
}
488
+
489
+
/** @returns {HTMLElement | undefined} */
490
+
491
+
buildFediSourceLink() {
492
+
let url = this.post.originalFediURL;
493
+
let hostname;
494
+
495
+
try {
496
+
hostname = new URL(url).hostname;
497
+
} catch (error) {
498
+
console.log("Invalid Fedi URL:" + error);
499
+
return undefined;
500
+
}
501
+
502
+
let a = $tag('a.fedi-link', { href: url, target: '_blank' });
503
+
let box = $tag('div', { html: `<i class="fa-solid fa-arrow-up-right-from-square fa-sm"></i> View on ${hostname}` });
504
+
a.append(box);
505
+
return a;
477
506
}
478
507
479
508
/** @param {HTMLLinkElement} authorLink */
+27
style.css
+27
style.css
···
647
647
color: #aaa;
648
648
}
649
649
650
+
.post a.fedi-link {
651
+
display: inline-block;
652
+
margin-bottom: 6px;
653
+
margin-top: 2px;
654
+
}
655
+
656
+
.post a.fedi-link:hover {
657
+
text-decoration: none;
658
+
}
659
+
660
+
.post a.fedi-link > div {
661
+
border: 1px solid #d8d8d8;
662
+
border-radius: 8px;
663
+
padding: 5px 9px;
664
+
color: #666;
665
+
font-size: 10pt;
666
+
}
667
+
668
+
.post a.fedi-link i {
669
+
margin-right: 2px;
670
+
}
671
+
672
+
.post a.fedi-link:hover > div {
673
+
background-color: #f6f7f8;
674
+
border: 1px solid #c8c8c8;
675
+
}
676
+
650
677
.post div.gif img {
651
678
user-select: none;
652
679
-webkit-user-select: none;