tweets-carousel.html 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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">
  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 hx-post="{{ url_for('.post_tweet_retweet', tweet_id=tweet.id) }}">retweet</a>
  37. |
  38. <a hx-get="/twitter/data/thread/{{ tweet.conversation_id }}?me={{ me }}" hx-target="#tweets" hx-swap="outerHTML">view author thread</a>
  39. |
  40. <a hx-get="/twitter/data/conversation/{{ tweet.conversation_id }}?me={{ me }}" hx-target="#tweets" hx-swap="outerHTML">view full convo</a>
  41. |
  42. <a class="tweet-action bookmark" href="#">bookmark</a>
  43. |
  44. <a class="tweet-action copy-formatted" href="javascript:copyTweetToClipboard('{{ tweet.id }}')">copy formatted</a>
  45. {% if notes_app_url %}
  46. |
  47. <a class="tweet-action swipe-to-note" href="javascript:swipeTweetToNotesApp('{{ tweet.id }}')">swipe to note</a>
  48. {% endif %}
  49. </p>
  50. </div>
  51. </div>
  52. </li>
  53. {% endfor %}
  54. {% if query.next_data_url %}
  55. <li style="height: 50px; vertical-align: middle"
  56. hx-get="{{ query.next_data_url }}"
  57. hx-trigger="revealed"
  58. hx-swap="outerHTML"
  59. hx-select="ul#tweets > li"
  60. >
  61. <center style="height: 100%">
  62. <span class="js-only">
  63. Loading more tweets...
  64. </span>
  65. {% if query.next_page_url %}
  66. <a href="{{ query.next_page_url }}">
  67. Go to Next Page
  68. </a>
  69. {% endif %}
  70. <script>
  71. var profileDataEl = document.querySelector('#profile-data');
  72. if (window['dataset'] && profileDataEl) {
  73. profileDataEl.innerHTML = dataset.items.filter(i => 'public_metrics' in i).map(i => i.public_metrics.like_count).join(', ');
  74. }
  75. </script>
  76. </center>
  77. </li>
  78. {% endif %}
  79. </ul>