posts.tx 5.3 KB

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