匿名提问箱
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

150 lines
6.0 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
  6. <link rel="icon" type="image/png" href="/img/box.png"/>
  7. <meta property="og:title" content="{{disp}}的提问箱" />
  8. <meta property="og:description" content="欢迎向我提问!" />
  9. <meta property="og:site_name" content="闭社匿名提问箱" />
  10. <meta property="og:image" content="/img/box.png" />
  11. <link href="https://cdn.bootcss.com/twitter-bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet">
  12. <script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
  13. <script src="https://cdn.bootcss.com/twitter-bootstrap/4.3.1/js/bootstrap.min.js"></script>
  14. <script src="https://cdn.bootcdn.net/ajax/libs/jquery-timeago/1.6.7/jquery.timeago.min.js"></script>
  15. <script src="https://cdn.bootcdn.net/ajax/libs/jquery-timeago/1.6.7/locales/jquery.timeago.zh-CN.js"></script>
  16. <title>欢迎向我提问!- {{disp}}的提问箱</title>
  17. <style>
  18. .qbox {
  19. background:#e8e8e8;
  20. padding:5px;
  21. color:black;
  22. box-shadow: 2px 2px 10px 2px rgb(219 219 220);
  23. border-radius: .5rem;
  24. margin: 25px 0;
  25. }
  26. pre {
  27. margin: 15px 0 0 15px;
  28. white-space: pre-wrap;
  29. }
  30. .emoji {
  31. width: 24px;
  32. }
  33. .status-media {
  34. max-width: 100%;
  35. max-height: 550px;
  36. margin: 0 auto;
  37. }
  38. .timeago {
  39. font-size: 0.5em;
  40. text-align: right;
  41. }
  42. .display_name {
  43. margin: 0;
  44. }
  45. .card-body {
  46. padding: 0.75em;
  47. }
  48. </style>
  49. </head>
  50. <body style="background-color: #001a37;color:#e8e8e8">
  51. <div style="max-width:700px;" class="container">
  52. <div style="background-color:rgba(230,230,250,0.5);margin-bottom:80px">
  53. <div align='center' style='background-color:rgba(180,180,250,0.5);padding:10px;color:#ffffff;'>
  54. <div style="margin:20px">
  55. <span style='color:#555555;margin:0 10px;'> 闭社匿名提问箱</span>
  56. <a type="button" class="btn btn-dark btn-sm" href="/askMe">我也要创建</a>
  57. </div>
  58. <h2 align='center'>{{disp}}的提问箱</h2>
  59. <a rel="me" href="{{url}}">
  60. <div style="text-align:left; margin-bottom:10px;height:25px;font-size:20px" id="acct-info">
  61. <img src="{{avat}}" width="76">
  62. <span>@{{acct}}</span>
  63. </div>
  64. </a>
  65. </div>
  66. </div>
  67. <form action="new" method="post">
  68. <div class="form-group qbox">
  69. <label>向 {{disp}} 匿名提问</label>
  70. <textarea class="form-control" id="question" name="question" rows="5" maxlength="400" placeholder="在此处写下你想问的" required="required"></textarea>
  71. <button type="submit" class="btn btn-primary">发送提问</button>
  72. </div>
  73. </form>
  74. <hr/>
  75. <h3>对 {{disp}} 的提问({{qs|length}})</h3>
  76. {% for q in qs|reverse %}
  77. <div class="qbox">
  78. <pre>{{q.content}}</pre>
  79. <div style="text-align:right">
  80. <time class="timeago" datetime="{{q.time}}"></time>
  81. <a class="btn btn-link request-answer" data-toggle="collapse" href="#collapse-{{q.toot}}" role="button" aria-expanded="false" aria-controls="collapse-{{q.toot}}">
  82. 查看回复
  83. <span><svg fill="#007bff" viewBox="0 0 24 24" width="24" height="24" ><path d="M12 13L8.285 9.218a.758.758 0 0 0-1.064 0 .738.738 0 0 0 0 1.052l4.249 4.512a.758.758 0 0 0 1.064 0l4.246-4.512a.738.738 0 0 0 0-1.052.757.757 0 0 0-1.063 0L12.002 13z"></path></svg></span>
  84. </a>
  85. </div>
  86. <div class="collapse" id="collapse-{{q.toot}}">
  87. <div class="card card-body">
  88. 加载中...
  89. </div>
  90. </div>
  91. </div>
  92. {% endfor %}
  93. <script>
  94. $('.timeago').timeago();
  95. $('.collapse').on('show.bs.collapse', (e) => {
  96. let self = e.target;
  97. let toot = self.id.split('-')[1];
  98. $.ajax({
  99. type:'GET',
  100. url:toot,
  101. success:(result,status,xhr) => {
  102. console.log(result+' : '+status);
  103. if(result.replies.length) {
  104. $(self).empty();
  105. result.replies.forEach((rp) => {
  106. $(self).append(`
  107. <div class="card card-body">
  108. <p class="display_name">
  109. <a href="${rp.url}">${rp.disp}</a>:
  110. </p>
  111. <pre>
  112. ${rp.content}
  113. </pre>
  114. ${rp.images.map((url) => `<image class="status-media" src=${url}>`)}
  115. <time class="timeago" datetime="${rp.time}"></time>
  116. </div>
  117. `);
  118. });
  119. $(self).find('.timeago').timeago();
  120. }else {
  121. $(self).empty();
  122. $(self).append(`<div class="card card-body">(暂无回复)</div>`)
  123. }
  124. },
  125. error:(xhr,status,error) => {
  126. console.log(error, status, xhr.status, xhr.responseText);
  127. $(self).empty();
  128. $(self).append(`<div class="card card-body"><p style="color:red">${xhr.status} ${xhr.responseText}</p></div>`);
  129. if(xhr.status == 404)
  130. setTimeout(()=>{$(self).parent().remove()}, 3000);
  131. }
  132. });
  133. });
  134. </script>
  135. </div>
  136. <footer style="background-color:#000010;color:white;border-top: 1px solid white;margin-top:80px;padding-top:10px;">
  137. </footer>
  138. <script>
  139. $('footer').load('../../footer.html');
  140. </script>
  141. </body>
  142. </html>