posts.tx 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <span class="title">
  2. : if ( $rss ) {
  3. <a title="RSS" class="rss" href="<: $route :>?format=rss"></a>
  4. <: $category :>:
  5. : }
  6. </span>
  7. : if ( $about_header ) {
  8. <: $about_header | mark_raw :>
  9. : }
  10. <hr class="divider" />
  11. : for $posts -> $post {
  12. :if ( $tiled ) {
  13. <a href="<: $route :>/<: $post.id :>" class="tile">
  14. <div class="responsive preview" style="background-image:url(<: $post.preview :>)"></div>
  15. <p class="midtitle"><: $post.title :></p>
  16. </a>
  17. : } else {
  18. <div class="post">
  19. <h3 class='blogtitles'>
  20. <a href='/posts/<: $post.id :>'><: $post.title :></a>
  21. <a class="undecorated" href='<: $post.href :>'>🔗</a>
  22. <span id="<: $post.id :>-time" style="float:right;"><: $post.created :></span>
  23. <a class='usericon <: $post.user :>' title='Posted by <: $post.user :>'></a>
  24. </h3>
  25. : if ( !$post.video_href && !$post.is_image && $post.preview ) {
  26. <div style="background-image:url(<: $post.preview :>);" class="responsive preview"></div>
  27. : }
  28. : if ( $post.video_href ) {
  29. <video class="responsive" controls poster="<: $post.preview :>" >
  30. <source src="<: $post.video_href :>" type="<: $post.video_content_type :>" />
  31. Your browser does not support the video tag.
  32. </video>
  33. : }
  34. : if ( $post.audio_href ) {
  35. <audio controls>
  36. <source src="<: $post.audio_href :>" type="<: $post.audio_content_type :>" />
  37. Your browser does not support the audio tag.
  38. </audio>
  39. : }
  40. : if ( $post.is_video ) {
  41. <video class="responsive" controls poster="<: $post.preview :>" >
  42. <source src="<: $post.href :>" type="<: $post.content_type :>" />
  43. Your browser does not support the video tag.
  44. </video>
  45. : }
  46. : if ( $post.is_audio ) {
  47. <audio controls>
  48. <source src="<: $post.href :>" type="<: $post.content_type :>" />
  49. Your browser does not support the audio tag.
  50. </audio>
  51. : }
  52. : if ( $post.is_image ) {
  53. <div style="background-image:url(<: $post.href :>);" class="responsive preview"></div>
  54. : }
  55. : $post.data | mark_raw;
  56. : if ( $can_edit ) {
  57. <br />
  58. <a style="display: inline-block;" onclick="switchMenu('<: $post.id :>');">[Edit]</a>
  59. <div id="<: $post.id :>" style="display:none;">
  60. : include $post.type ~ ".tx" { post => $post};
  61. <form class="Submissions" action="/post/delete" method="POST" class="inline">
  62. <input type="hidden" name="id" value="<: $post.id :>"></input>
  63. <input type="hidden" name="to" value="<: $route :>"></input>
  64. <input class="coolbutton" type="submit" value="Delete"></input>
  65. </form>
  66. </div>
  67. : }
  68. <script type="text/javascript">
  69. // Fix post dates to be localized
  70. document.addEventListener("DOMContentLoaded", function(event) {
  71. var e = document.getElementById("<: $post.id :>-time");
  72. var d = new Date(Date(e.innerText));
  73. e.innerHTML = "&nbsp;" + d.toDateString();
  74. });
  75. </script>
  76. </div>
  77. <hr class="divider" />
  78. : }
  79. : }
  80. : if ( $rss ) {
  81. : include "paginator.tx";
  82. : }
  83. : if ( $about_footer ) {
  84. <: $about_footer | mark_raw :>
  85. : }