posts.tx 6.5 KB

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