posts.tx 5.6 KB

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