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)
|
return renderAsOriginalHTML(topLevel: topLevel)
|
||||||
}
|
}
|
||||||
|
|
||||||
func renderAsTweetHTML(_ status: TwitterStatus) -> String {
|
func renderAsTweetHTML(_ status: TwitterStatus, topLevel: Bool) -> String {
|
||||||
return status.displayText ?? ""
|
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 {
|
func renderAsOriginalHTML(topLevel: Bool) -> String {
|
||||||
var html = renderAsTweetHTML(self)
|
var html = renderAsTweetHTML(self, topLevel: topLevel)
|
||||||
if topLevel {
|
if topLevel {
|
||||||
html += extendedEntities?.renderAsHTML() ?? ""
|
html += extendedEntities?.renderAsHTML() ?? ""
|
||||||
}
|
}
|
||||||
@ -93,7 +102,7 @@ final class TwitterStatus: Codable {
|
|||||||
|
|
||||||
func renderAsQuoteHTML(_ quotedStatus: TwitterStatus, topLevel: Bool) -> String {
|
func renderAsQuoteHTML(_ quotedStatus: TwitterStatus, topLevel: Bool) -> String {
|
||||||
var html = String()
|
var html = String()
|
||||||
html += renderAsTweetHTML(self)
|
html += renderAsTweetHTML(self, topLevel: topLevel)
|
||||||
html += "<blockquote>"
|
html += "<blockquote>"
|
||||||
if let userHTML = quotedStatus.user?.renderAsHTML() {
|
if let userHTML = quotedStatus.user?.renderAsHTML() {
|
||||||
html += userHTML
|
html += userHTML
|
||||||
|
@ -258,6 +258,10 @@ blockquote {
|
|||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.twitterTimestamp {
|
||||||
|
font-size: 66%;
|
||||||
|
}
|
||||||
|
|
||||||
/*Block ads and junk*/
|
/*Block ads and junk*/
|
||||||
|
|
||||||
iframe[src*="feedads"],
|
iframe[src*="feedads"],
|
||||||
|
@ -287,6 +287,10 @@ blockquote {
|
|||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.twitterTimestamp {
|
||||||
|
font-size: 66%;
|
||||||
|
}
|
||||||
|
|
||||||
/*Block ads and junk*/
|
/*Block ads and junk*/
|
||||||
|
|
||||||
iframe[src*="feedads"],
|
iframe[src*="feedads"],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user