posts.tx 2.6 KB

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