posts.tx 1.9 KB

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