posts.tx 5.5 KB

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