diff --git a/public/css/fontello.css b/public/css/fontello.css index a486b4b..447e9bb 100644 --- a/public/css/fontello.css +++ b/public/css/fontello.css @@ -1,11 +1,11 @@ @font-face { font-family: 'fontello'; - src: url('/fonts/fontello.eot?6327398'); - src: url('/fonts/fontello.eot?6327398#iefix') format('embedded-opentype'), - url('/fonts/fontello.woff2?6327398') format('woff2'), - url('/fonts/fontello.woff?6327398') format('woff'), - url('/fonts/fontello.ttf?6327398') format('truetype'), - url('/fonts/fontello.svg?6327398#fontello') format('svg'); + src: url('/fonts/fontello.eot?63207931'); + src: url('/fonts/fontello.eot?63207931#iefix') format('embedded-opentype'), + url('/fonts/fontello.woff2?63207931') format('woff2'), + url('/fonts/fontello.woff?63207931') format('woff'), + url('/fonts/fontello.ttf?63207931') format('truetype'), + url('/fonts/fontello.svg?63207931#fontello') format('svg'); font-weight: normal; font-style: normal; } @@ -49,6 +49,7 @@ .icon-retweet:before { content: '\e80d'; } /* '' */ .icon-search:before { content: '\e80e'; } /* '' */ .icon-pin:before { content: '\e80f'; } /* '' */ +.icon-user:before { content: '\e810'; } /* '' */ .icon-heart:before { content: '\e811'; } /* '' */ .icon-cog:before { content: '\e812'; } /* '' */ .icon-rss-feed:before { content: '\e813'; } /* '' */ diff --git a/public/fonts/fontello.eot b/public/fonts/fontello.eot index 0192b84..377b209 100644 Binary files a/public/fonts/fontello.eot and b/public/fonts/fontello.eot differ diff --git a/public/fonts/fontello.svg b/public/fonts/fontello.svg index e0f8e43..4ec01c2 100644 --- a/public/fonts/fontello.svg +++ b/public/fonts/fontello.svg @@ -38,19 +38,15 @@ - + - + - - - - - + \ No newline at end of file diff --git a/public/fonts/fontello.ttf b/public/fonts/fontello.ttf index 0aebada..b13e72b 100644 Binary files a/public/fonts/fontello.ttf and b/public/fonts/fontello.ttf differ diff --git a/public/fonts/fontello.woff b/public/fonts/fontello.woff index bb95c64..06ab146 100644 Binary files a/public/fonts/fontello.woff and b/public/fonts/fontello.woff differ diff --git a/public/fonts/fontello.woff2 b/public/fonts/fontello.woff2 index 9f23ca1..e09a239 100644 Binary files a/public/fonts/fontello.woff2 and b/public/fonts/fontello.woff2 differ diff --git a/src/parser.nim b/src/parser.nim index b5e1660..4e4b2a5 100644 --- a/src/parser.nim +++ b/src/parser.nim @@ -107,6 +107,7 @@ proc parseTweet*(node: XmlNode): Tweet = profile: parseTweetProfile(tweet), stats: parseTweetStats(tweet), reply: parseTweetReply(tweet), + mediaTags: getMediaTags(tweet), hasThread: tweet.select(".content > .self-thread-context") != nil, pinned: "pinned" in tweet.attr("class"), available: true diff --git a/src/parserutils.nim b/src/parserutils.nim index 09116ad..b009295 100644 --- a/src/parserutils.nim +++ b/src/parserutils.nim @@ -1,4 +1,4 @@ -import xmltree, strtabs, strformat, strutils, times, uri, options +import xmltree, strtabs, strformat, strutils, times, uri, options, json import regex import types, formatters @@ -276,3 +276,12 @@ proc getMoreReplies*(node: XmlNode): int64 = result = parseBiggestInt(text.split(" ")[0]) except: result = -1 + +proc getMediaTags*(node: XmlNode): seq[Profile] = + let usernames = node.attr("data-tagged") + if usernames.len == 0: return + let users = parseJson(node.attr("data-reply-to-users-json")) + for user in users: + let un = user["screen_name"].getStr + if un notin usernames: continue + result.add Profile(username: un, fullname: user["name"].getStr) diff --git a/src/sass/tweet/_base.scss b/src/sass/tweet/_base.scss index 905a0c3..d7fe469 100644 --- a/src/sass/tweet/_base.scss +++ b/src/sass/tweet/_base.scss @@ -110,6 +110,24 @@ } } +.media-tag-block { + padding-top: 5px; + pointer-events: all; + color: var(--fg_faded); + + .icon-container { + padding-right: 2px; + } + + .media-tag, .icon-container { + color: var(--fg_faded); + } +} + +.timeline-container .media-tag-block { + font-size: 13px; +} + .replying-to { color: var(--fg_faded); margin: -2px 0 4px; diff --git a/src/types.nim b/src/types.nim index 00c383f..971be22 100644 --- a/src/types.nim +++ b/src/types.nim @@ -150,6 +150,7 @@ type stats*: TweetStats retweet*: Option[Retweet] attribution*: Option[Profile] + mediaTags*: seq[Profile] quote*: Option[Quote] card*: Option[Card] gif*: Option[Gif] diff --git a/src/views/tweet.nim b/src/views/tweet.nim index fc15d60..f60c38b 100644 --- a/src/views/tweet.nim +++ b/src/views/tweet.nim @@ -195,6 +195,15 @@ proc renderAttribution(profile: Profile): VNode = img(class="avatar", width="20", height="20", src=avatarUrl) strong: text profile.fullname +proc renderMediaTags(tags: seq[Profile]): VNode = + buildHtml(tdiv(class="media-tag-block")): + icon "user" + for i, p in tags: + a(class="media-tag", href=("/" & p.username), title=p.username): + text p.fullname + if i < tags.high: + text ", " + proc renderQuoteMedia(quote: Quote): VNode = buildHtml(tdiv(class="quote-media-container")): if quote.thumb.len > 0: @@ -286,6 +295,9 @@ proc renderTweet*(tweet: Tweet; prefs: Prefs; path: string; class=""; if mainTweet: p(class="tweet-published"): text getTweetTime(tweet) + if tweet.mediaTags.len > 0: + renderMediaTags(tweet.mediaTags) + if not prefs.hideTweetStats: renderStats(tweet.stats, views)