timeline-tweet.html 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. <div class="dtc w-10">
  2. <img loading="lazy" src="{{ tweet.avi_icon_url }}" alt="Avi">
  3. {% if True or enable_select_tweets %}
  4. <br>
  5. <input type="checkbox" name="select_tweet" value="{{ tweet.id }}">
  6. {% endif %}
  7. </div>
  8. <div class="dtc w-90 v-top">
  9. {% if tweet.title %}
  10. <h2 class="w-100 mt0">
  11. <a href="{{ tweet.url }}">
  12. {{ tweet.title }}
  13. </a>
  14. </h2>
  15. {% endif %}
  16. <p class="w-100 mt0 pt0">
  17. <strong><a href="{{ tweet.author_url }}" class="w-100">{{ tweet.display_name }}</a></strong>
  18. {% if tweet.author_is_verified %}
  19. <small class="verified">[verified]</small>
  20. {% endif %}
  21. <a href="{{ tweet.author_url }}" class="silver">@{{ tweet.handle }}</a>
  22. <a href="{{ tweet.url }}">{{ tweet.created_at }}</a> [<a href="{{ tweet.source_url }}" target="tweet_{{ tweet.id }}">source</a>]
  23. {% if tweet.is_viewed %}
  24. [viewed]
  25. {% endif %}
  26. </p>
  27. <p class="w-100">
  28. {% if tweet.html %}
  29. {{ tweet.html | safe }}
  30. {% else %}
  31. {{ tweet.text | replace('<', '&lt;') | replace('\n', '<br>') | safe }}
  32. {% endif %}
  33. </p>
  34. {% if tweet.quoted_tweet %}
  35. <div class="dt qt-box">
  36. <div class="dt-row">
  37. {% with tweet = tweet.quoted_tweet %}
  38. {% include "partial/timeline-tweet.html" %}
  39. {% endwith %}
  40. </div>
  41. </div>
  42. {% endif %}
  43. {% if not skip_embed_replies %}
  44. {% if tweet.replied_tweet %}
  45. <p style="color: silver">
  46. Replying to:
  47. </p>
  48. <div class="reply_to w-100" style="border: 1px solid silver; padding: 6px">
  49. <div class="dt reply-box">
  50. <div class="dt-row">
  51. {% with tweet = tweet.replied_tweet %}
  52. {% include "partial/timeline-tweet.html" %}
  53. {% endwith %}
  54. </div>
  55. </div>
  56. </div>
  57. {% elif tweet.replied_tweet_id %}
  58. <p style="color: silver">
  59. Replying to:
  60. </p>
  61. {% if tweet.actions.view_replied_tweet %}
  62. <p class="reply_to w-100" style="border: 1px solid silver; padding: 6px">
  63. <a href="{{ url_for(tweet.actions.view_replied_tweet.route, **tweet.actions.view_replies.route_params) }}">View in Thread</a>.
  64. </p>
  65. {% endif %}
  66. {% endif %}
  67. {% endif %}
  68. {% if tweet.note %}
  69. <p class="note w-100" style="border: 1px solid black; background-color: yellow; padding: 6px">
  70. {{ tweet.note.replace('\n', '<br>') | safe }}
  71. </p>
  72. {% endif %}
  73. {% if tweet.photos %}
  74. <p class="w-100">
  75. <ul>
  76. {% for photo in tweet.photos %}
  77. <li><img loading="lazy" class="w-100" src="{{ photo.preview_image_url }}"
  78. referrerpolicy="no-referrer" onclick="this.src='{{ photo.url }}'" style="max-height: {{ photo.height }};""></li>
  79. {% endfor %}
  80. </ul>
  81. </p>
  82. {% endif %}
  83. {% if tweet.videos %}
  84. <p class="w-100">
  85. <p>VIDEOS</p>
  86. <ul>
  87. {% for video in tweet.videos %}
  88. <li><img loading="lazy" class="w-100"
  89. src="{{ video.preview_image_url }}" referrerpolicy="no-referrer"
  90. {% if video.image_url %}
  91. onclick="this.src='{{ video.image_url }}'; this.onclick = undefined"
  92. {% endif %}
  93. {% if video.url %}
  94. ondblclick="swapVideoPlayer(this, '{{ video.url }}', '{{ video.content_type }}')"
  95. {% endif %}
  96. style="max-height: {{ video.height }};"
  97. >
  98. <dl>
  99. {% if video.duration_str %}
  100. <dt>Duration</dt>
  101. <dd>{{ video.duration_str }}</dt>
  102. {% elif video.duration_ms %}
  103. <dt>Duration</dt>
  104. <dd>{{ video.duration_ms / 1000 / 60 }} minutes</dt>
  105. {% endif %}
  106. </dl>
  107. {% if video.public_metrics and video.public_metrics.view_count %}
  108. <p class="w-100">
  109. view count: {{ video.public_metrics.view_count }}
  110. </p>
  111. {% endif %}
  112. </li>
  113. {% endfor %}
  114. </ul>
  115. </p>
  116. {% endif %}
  117. {% if tweet.card %}
  118. <div class="card-box w-100">
  119. <div style="display: flex; flex-direction: row;">
  120. {% if tweet.card.preview_image_url %}
  121. <img style="margin-right: 4px; max-height: 150px; max-width: 150px;" src="{{ tweet.card.preview_image_url }}">
  122. {% endif %}
  123. <div style="display: flex; flex-direction: column">
  124. <span><a href="{{ tweet.card.source_url }}">{{ tweet.card.display_url }}</a></span>
  125. <span><strong>{{ tweet.card.title }}</strong></span>
  126. <p>{{ tweet.card.content }}</p>
  127. </div>
  128. </div>
  129. </div>
  130. {% endif %}
  131. {% if False and tweet.replied_tweet %}
  132. <a href="{{ tweet.replied_tweet.url }}">View Parent</a>
  133. <a href="{{ url_for('.get_tweet_html', tweet_id=tweet.replied_tweet.conversation_id) }}">View Conversation</a>
  134. {% endif %}
  135. {% if tweet.public_metrics %}
  136. <p class="w-100">
  137. {% for k, v in tweet.public_metrics.items() %}
  138. {% if v != None %}
  139. {{ k.replace('_count', 's').replace('ys', 'ies').replace('_', ' ') }}: {{ v }},
  140. {% endif %}
  141. {% endfor %}
  142. </p>
  143. {% endif %}
  144. {% if tweet.non_public_metrics %}
  145. <p class="w-100">
  146. {% for k, v in tweet.non_public_metrics.items() %}
  147. {% if v != None %}
  148. {{ k.replace('_count', 's').replace('ys', 'ies').replace('_', ' ') }}: {{ v }},
  149. {% endif %}
  150. {% endfor %}
  151. </p>
  152. {% endif %}
  153. {% if tweet.attachments %}
  154. <ul>
  155. {% for a in tweet.attachments %}
  156. {% if a.content_type == 'application/vnd-hogumathi.livestream-details+json' %}
  157. <li class="livestream-details">
  158. <dl>
  159. {% if a.content.scheduled_start_time %}
  160. <dt>Scheduled Start Time</dt>
  161. <dd>{{ a.content.scheduled_start_time }}</dd>
  162. {% endif %}
  163. {% if a.content.start_time %}
  164. <dt>Start Time</dt>
  165. <dd>{{ a.content.start_time }}</dd>
  166. {% endif %}
  167. {% if a.content.chat_embed_url %}
  168. <dt>Chat</dt>
  169. <dd>
  170. <iframe class="w-100" height="400" src="{{ a.content.chat_embed_url }}" referrerpolicy="origin"></iframe>
  171. </dd>
  172. {% endif %}
  173. </dl>
  174. </li>
  175. {% else %}
  176. <li><a href="{{ a.url }}">{{ a.name }}</a> {{ a.content_type }} ({{ a.size }})
  177. {% endif %}
  178. </li>
  179. {% endfor %}
  180. </ul>
  181. {% endif %}
  182. {% if show_conversation_id %}
  183. <p class="w-100">
  184. Conversation: {{ tweet.conversation_id }}
  185. </p>
  186. {% endif %}
  187. </div>