timeline-tweet.html 5.8 KB

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