tweets-timeline.html 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <script src="{{ url_for('.static', filename='tweets-ui.js') }}"></script>
  2. <script>
  3. {% if notes_app_url %}
  4. var notesAppUrl = {{ notes_app_url | tojson }}
  5. {% endif %}
  6. if (!window['dataset']) {
  7. window.dataset = {
  8. items: [],
  9. update: function (items) {
  10. dataset.items = dataset.items.concat(items);
  11. }
  12. }
  13. }
  14. </script>
  15. <ul id="tweets" class="tweets w-75 center z-0">
  16. {% for tweet in tweets %}
  17. <li class="tweet w-100 dt {% if tweet.is_marked %}marked{% endif %}">
  18. <script>
  19. dataset.update([
  20. {{ tweet | tojson }}
  21. ]);
  22. </script>
  23. {% if tweet.retweeted_by %}
  24. <div class="dt-row moon-gray">
  25. <p class="dtc w-10 tr pa1">RT</p>
  26. <p class="dtc w-90"><a class="moon-gray" href="{{ tweet.retweeted_by_url }}">{{ tweet.retweeted_by }} Retweeted</a></p>
  27. </div>
  28. {% endif %}
  29. <div class="dt-row">
  30. {% include "partial/timeline-tweet.html" %}
  31. </div>
  32. <div class="dt-row">
  33. <div class="dtc"></div>
  34. <div class="dtc ">
  35. <p class="tweet-actions-box">
  36. <a href="{{ url_for('.get_tweet_html', tweet_id=tweet.id, view='replies') }}">replies</a>
  37. |
  38. {% if show_thread_controls %}
  39. <a href="{{ url_for('.get_tweet_html', tweet_id=tweet.conversation_id, view='thread') }}">author thread</a>
  40. |
  41. <a href="{{ url_for('.get_tweet_html', tweet_id=tweet.conversation_id, view='conversation') }}">full convo</a>
  42. |
  43. {% endif %}
  44. {% if twitter_user %}
  45. <a hx-post="{{ url_for('.post_tweet_retweet', tweet_id=tweet.id) }}">retweet</a>
  46. |
  47. {% endif %}
  48. {% if twitter_user or mastodon_user %}
  49. <a hx-post="{{ url_for('.post_tweet_bookmark', tweet_id=tweet.id, me=me) }}">bookmark</a>
  50. [
  51. <a hx-delete="{{url_for('.delete_tweet_bookmark', tweet_id=tweet.id, me=me)}}">-</a>
  52. ]
  53. |
  54. {% endif %}
  55. <a class="tweet-action copy-formatted" href="javascript:copyTweetToClipboard('{{ tweet.id }}')">copy formatted</a>
  56. {% if notes_app_url %}
  57. |
  58. <a class="tweet-action swipe-to-note" href="javascript:swipeTweetToNotesApp('{{ tweet.id }}')">swipe to note</a>
  59. {% endif %}
  60. </p>
  61. </div>
  62. </div>
  63. </li>
  64. {% endfor %}
  65. {% if query.next_data_url %}
  66. <li style="height: 50px; vertical-align: middle"
  67. hx-get="{{ query.next_data_url }}"
  68. hx-trigger="revealed"
  69. hx-swap="outerHTML"
  70. hx-select="ul#tweets > li"
  71. >
  72. <center style="height: 100%">
  73. <span class="js-only">
  74. Loading more tweets...
  75. </span>
  76. <script>
  77. var profileDataEl = document.querySelector('#profile-data');
  78. if (window['dataset'] && profileDataEl) {
  79. profileDataEl.innerHTML = dataset.items.filter(i => 'public_metrics' in i).map(i => i.public_metrics.like_count).join(', ');
  80. }
  81. </script>
  82. </center>
  83. </li>
  84. {% elif query.next_page_url %}
  85. <li style="height: 50px; vertical-align: middle"
  86. >
  87. <center style="height: 100%">
  88. <a href="{{ query.next_page_url }}">
  89. Go to Next Page
  90. </a>
  91. <script>
  92. var profileDataEl = document.querySelector('#profile-data');
  93. if (window['dataset'] && profileDataEl) {
  94. profileDataEl.innerHTML = dataset.items.filter(i => 'public_metrics' in i).map(i => i.public_metrics.like_count).join(', ');
  95. }
  96. </script>
  97. </center>
  98. </li>
  99. {% endif %}
  100. </ul>