posts.tx 7.0 KB

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