Added timestamp to retweets
This commit is contained in:
parent
b31e43419c
commit
ac41c7af69
@ -66,12 +66,21 @@ final class TwitterStatus: Codable {
|
||||
return renderAsOriginalHTML(topLevel: topLevel)
|
||||
}
|
||||
|
||||
func renderAsTweetHTML(_ status: TwitterStatus) -> String {
|
||||
return status.displayText ?? ""
|
||||
func renderAsTweetHTML(_ status: TwitterStatus, topLevel: Bool) -> String {
|
||||
var html = "<div>\(status.displayText ?? "")</div>"
|
||||
|
||||
if !topLevel, let createdAt = status.createdAt {
|
||||
let dateFormatter = DateFormatter()
|
||||
dateFormatter.dateStyle = .medium
|
||||
dateFormatter.timeStyle = .short
|
||||
html += "<div class=\"twitterTimestamp\">\(dateFormatter.string(from: createdAt))</div>"
|
||||
}
|
||||
|
||||
return html
|
||||
}
|
||||
|
||||
func renderAsOriginalHTML(topLevel: Bool) -> String {
|
||||
var html = renderAsTweetHTML(self)
|
||||
var html = renderAsTweetHTML(self, topLevel: topLevel)
|
||||
if topLevel {
|
||||
html += extendedEntities?.renderAsHTML() ?? ""
|
||||
}
|
||||
@ -93,7 +102,7 @@ final class TwitterStatus: Codable {
|
||||
|
||||
func renderAsQuoteHTML(_ quotedStatus: TwitterStatus, topLevel: Bool) -> String {
|
||||
var html = String()
|
||||
html += renderAsTweetHTML(self)
|
||||
html += renderAsTweetHTML(self, topLevel: topLevel)
|
||||
html += "<blockquote>"
|
||||
if let userHTML = quotedStatus.user?.renderAsHTML() {
|
||||
html += userHTML
|
||||
|
@ -258,6 +258,10 @@ blockquote {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.twitterTimestamp {
|
||||
font-size: 66%;
|
||||
}
|
||||
|
||||
/*Block ads and junk*/
|
||||
|
||||
iframe[src*="feedads"],
|
||||
|
@ -287,6 +287,10 @@ blockquote {
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.twitterTimestamp {
|
||||
font-size: 66%;
|
||||
}
|
||||
|
||||
/*Block ads and junk*/
|
||||
|
||||
iframe[src*="feedads"],
|
||||
|
Loading…
x
Reference in New Issue
Block a user