posts.tx 6.3 KB

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