posts.tx 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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 ( $post.aclname && $in_series ) {
  13. : next;
  14. : }
  15. :if ( $tiled ) {
  16. <a href="<: $route :>/<: $post.id :>" class="tile">
  17. : if ($post.is_video) {
  18. <video class="responsive" controls poster="<: $post.preview :>" >
  19. <source src="<: $post.href :>" type="<: $post.content_type :>" />
  20. Your browser does not support the video tag.
  21. </video>
  22. : } else {
  23. <div class="responsive preview" style="background-image:url(<: $post.preview :>)"></div>
  24. : }
  25. <p class="midtitle"><: $post.title :></p>
  26. </a>
  27. : } else {
  28. <div class="post">
  29. <h3 class='blogtitles'>
  30. <a href='/posts/<: $post.id :>'><: $post.title :></a>
  31. <a class="undecorated" href='<: $post.href :>'>🔗</a>
  32. : if ( $post.version_max ) {
  33. <form method="GET" action="/posts/<: $post.id :>" style="float:right;">
  34. <select id="<: $post.id :>-<: $post.version :>-version" name="version" class="coolbutton">
  35. : for [0..$post.version_max] -> $version {
  36. <option value="<: $version :>" <: if ($post.version == $version ) { :>selected<: } :> >v<: $version :></option>
  37. : }
  38. </select>
  39. </form>
  40. : }
  41. <span id="<: $post.id :>-<: $post.version :>-time" style="float:right;"><: $post.created :></span>
  42. <a class='usericon <: $post.user :>' title='Posted by <: $post.user :>'></a>
  43. </h3>
  44. : if ( !$post.video_href && !$post.is_image && !$post.is_video && !$post.wallpaper && $post.preview ) {
  45. <div style="background-image:url(<: $post.preview :>);" class="responsive preview"></div>
  46. : }
  47. : if ( $post.video_href ) {
  48. <video class="responsive" controls poster="<: $post.preview :>" >
  49. <source src="<: $post.video_href :>" type="<: $post.video_content_type :>" />
  50. Your browser does not support the video tag.
  51. </video>
  52. : }
  53. : if ( $post.audio_href ) {
  54. <audio controls>
  55. <source src="<: $post.audio_href :>" type="<: $post.audio_content_type :>" />
  56. Your browser does not support the audio tag.
  57. </audio>
  58. : }
  59. : if ( $post.is_video ) {
  60. <video class="responsive" controls poster="<: $post.preview :>" >
  61. <source src="<: $post.href :>" type="<: $post.content_type :>" />
  62. Your browser does not support the video tag.
  63. </video>
  64. : }
  65. : if ( $post.is_audio ) {
  66. <audio controls>
  67. <source src="<: $post.href :>" type="<: $post.content_type :>" />
  68. Your browser does not support the audio tag.
  69. </audio>
  70. : }
  71. : if ( $post.is_image ) {
  72. <div style="background-image:url(<: $post.href :>);" class="responsive preview"></div>
  73. : }
  74. : if ( $post.wallpaper ) {
  75. <div style="background-image:url(<: $post.wallpaper :>);">
  76. <div style="background-image:url(<: $post.preview :>);" class="responsive preview usericon"></div>
  77. </div>
  78. : }
  79. : $post.data | mark_raw;
  80. : if ( $can_edit ) {
  81. <br />
  82. <a style="display: inline-block;" onclick="switchMenu('<: $post.id :>-<: $post.version :>');">[Edit]</a>
  83. <div id="<: $post.id :>-<: $post.version :>" style="display:none;">
  84. : include $post.type ~ ".tx" { post => $post };
  85. <form class="Submissions" action="/post/delete" method="POST" class="inline">
  86. <input type="hidden" name="id" value="<: $post.id :>"></input>
  87. <input type="hidden" name="to" value="<: $route :>"></input>
  88. <input class="coolbutton" type="submit" value="Delete"></input>
  89. </form>
  90. </div>
  91. : }
  92. <script type="text/javascript">
  93. document.addEventListener("DOMContentLoaded", function(event) {
  94. // Fix post dates to be localized
  95. var e = document.getElementById("<: $post.id :>-<: $post.version :>-time");
  96. var d = new Date(Date(e.innerText));
  97. e.innerHTML = "&nbsp;" + d.toDateString();
  98. //Make the version switcher do things
  99. var swit = document.getElementById("<: $post.id :>-<: $post.version :>-version"); // I am an elder scrolls fan
  100. swit.onchange = function (evt) {
  101. this.form.submit();
  102. };
  103. });
  104. </script>
  105. </div>
  106. <hr class="divider" />
  107. : }
  108. : }
  109. : if ( $rss ) {
  110. : include "paginator.tx";
  111. : }
  112. : if ( $about_footer ) {
  113. <: $about_footer | mark_raw :>
  114. : }