posts.tx 6.6 KB

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