posts.tx 7.2 KB

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