blog.html 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. {% load static %}{% load day_util %}
  2. <!DOCTYPE html>
  3. <html>
  4. <head>
  5. <meta charset="utf-8"/>
  6. <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible"/>
  7. <meta
  8. name="viewport"
  9. content="width=device-width, initial-scale=1, maximum-scale=2, user-scalable=no"
  10. />
  11. <meta
  12. name="description"
  13. content="{{ article.intro }}"
  14. />
  15. <meta name="keywords" content="{{ article.title }}"/>
  16. <meta name="author" content="CyberSicko"/>
  17. <meta name="theme-color" content="#ffffff"/>
  18. <title>{{ article.title }}-CyberSicko.net</title>
  19. <link
  20. rel="stylesheet"
  21. href="{% static 'semantic.min.css' %}"
  22. type="text/css"
  23. />
  24. <link
  25. rel="stylesheet"
  26. href="{% static 'photoswipe/photoswipe.css' %}"
  27. type="text/css"
  28. />
  29. <link rel="stylesheet" href="{% static 'highlightjs/styles/androidstudio.min.css' %}">
  30. <link rel="shortcut icon" href="{% static 'favicon.ico' %}">
  31. <style type="text/css">
  32. blockquote {
  33. margin: 0;
  34. }
  35. blockquote {
  36. padding: 15px;
  37. background: #eee;
  38. }
  39. blockquote ::before {
  40. content: '\201C';
  41. }
  42. blockquote ::after {
  43. content: '\201D';
  44. }
  45. p {
  46. font-size: 1.2em;
  47. }
  48. body {
  49. padding-top: 54px;
  50. -webkit-font-smoothing: antialiased;
  51. -moz-font-smoothing: grayscale;
  52. }
  53. .ui.borderless.menu {
  54. background-color: #f8f8f8;
  55. {#box-shadow: none;#} flex-wrap: wrap;
  56. border: none;
  57. padding-left: 0;
  58. padding-right: 0;
  59. }
  60. .ui.borderless.menu .header.item {
  61. font-size: 18px;
  62. font-weight: 400;
  63. }
  64. .ui.mobile.only.grid .ui.menu .ui.vertical.menu {
  65. display: none;
  66. }
  67. .ui.mobile.only.grid .ui.vertical.menu .dropdown.icon {
  68. float: unset;
  69. }
  70. .ui.mobile.only.grid .ui.vertical.menu .dropdown.icon:before {
  71. content: "\f0d7";
  72. }
  73. .ui.mobile.only.grid .ui.vertical.menu .ui.dropdown.item .menu {
  74. position: static;
  75. width: 100%;
  76. background-color: unset;
  77. border: none;
  78. box-shadow: none;
  79. }
  80. .ui.mobile.only.grid .ui.vertical.menu .ui.dropdown.item .menu {
  81. margin-top: 6px;
  82. }
  83. .ui.container > .ui.message {
  84. background-color: rga(238, 238, 238);
  85. box-shadow: none;
  86. padding: 5rem 4rem;
  87. margin-top: 1rem;
  88. }
  89. .ui.message h1.ui.header {
  90. font-size: 4.5rem;
  91. }
  92. .ui.message p.lead {
  93. font-size: 1.3rem;
  94. color: #333333;
  95. line-height: 1.4;
  96. font-weight: 300;
  97. }
  98. .pre {
  99. background-color: antiquewhite;
  100. border-radius: 4px;
  101. }
  102. </style>
  103. </head>
  104. <body id="root">
  105. {% if is_login %}
  106. {% csrf_token %}
  107. {% endif %}
  108. <div class="ui tablet computer only padded grid">
  109. <div class="ui top fixed borderless fluid huge menu">
  110. <div class="ui container">
  111. <a href="/" class="header item"><img style="width: 7em;" src="{% static '/img.png' %}"/></a>
  112. <a href="/" class="item">主页</a>
  113. {% for item in category %}
  114. {# <li class="category_li"><a href="/category/{{ item.name }}?page=1">{{ item.name }}</a></li>#}
  115. <a class="{% if current_category != None and current_category == item.name %}
  116. active
  117. {% else %}
  118. {% endif %} item" href="/category/{{ item.name }}?page=1">{{ item.name }}</a>
  119. {% endfor %}
  120. <div class="right menu">
  121. <a href="/login" class="item"> <i class="icon share square"></i>
  122. Sign in</a>
  123. </div>
  124. </div>
  125. </div>
  126. </div>
  127. <div class="ui mobile only padded grid">
  128. <div class="ui top fixed borderless huge fluid menu">
  129. <a href="/" class="header item"><img style="width: 7em;" src="{% static '/img.png' %}"/></a>
  130. <div class="right menu">
  131. <div class="item">
  132. <button class="ui icon toggle basic button">
  133. <i class="content icon"></i>
  134. </button>
  135. </div>
  136. </div>
  137. <div class="ui vertical borderless fluid menu">
  138. <a href="/" class="item">主页</a>
  139. {% for item in category %}
  140. {# <li class="category_li"><a href="/category/{{ item.name }}?page=1">{{ item.name }}</a></li>#}
  141. <a class="{% if current_category != None and current_category == item.name %}
  142. active
  143. {% else %}
  144. {% endif %} item" href="/category/{{ item.name }}?page=1">{{ item.name }}</a>
  145. {% endfor %}
  146. <a href="/login" class="item"> <i class="icon share square"></i>
  147. Sign in</a>
  148. </div>
  149. </div>
  150. </div>
  151. <div class="ui grid stackable container">
  152. <div class="row" id="article">
  153. <div class="eleven wide column">
  154. <h1 class="ui large header">
  155. <div class="content">{{ article.title }}</div>
  156. </h1>
  157. <div class="ui comments" style="margin-top: 0">
  158. <div class="comment">
  159. <a class="avatar">
  160. <img src="/user_avatar/{{ article.user_id }}">
  161. </a>
  162. <div class="content">
  163. <a class="author">{{ article.user__first_name }}{{ article.user__last_name }}</a>
  164. <div class="metadata">
  165. <div class="date">发布于: {{ article.created_time|days_until }}</div>
  166. </div>
  167. <div class="text">hava a nice day.</div>
  168. </div>
  169. </div>
  170. </div>
  171. {% autoescape off %}
  172. {{ article.html_text }}
  173. {% endautoescape %}
  174. <div class="ui hidden divider"></div>
  175. </div>
  176. <div class="four wide right floated column">
  177. <h4 class="ui header">搜索</h4>
  178. <div id="search" class="ui category search">
  179. <div class="ui icon input">
  180. <input class="prompt" type="text" placeholder="搜索">
  181. <i class="search icon"></i>
  182. </div>
  183. </div>
  184. <h4 class="ui header">归档</h4>
  185. <div class="ui list">
  186. {% for record in records %}
  187. <a class="item" href="/date/{{ record.datetime }}?page=1">{{ record.datetime }}
  188. ({{ record.count }})</a>
  189. {% endfor %}
  190. </div>
  191. <h4 class="ui header">Top</h4>
  192. <div class="ui list">
  193. {% for tag in tags %}
  194. <a class="item" href="/tag/{{ tag.name }}?page=1">{{ tag.name }} ({{ tag.count }})</a>
  195. {% endfor %}
  196. </div>
  197. </div>
  198. </div>
  199. </div>
  200. <div class="ui divider"></div>
  201. <footer>
  202. <div style="text-align: center;height: 40px"><p>@2024 C.J</p></div>
  203. </footer>
  204. <script type="application/javascript" src="{% static 'js/jquery.min.js' %}"></script>
  205. <script type="application/javascript" src="{% static 'semantic.js' %}"></script>
  206. <script src="{% static 'highlightjs/highlight.min.js' %}"></script>
  207. <script type="application/javascript" src="{% static 'photoswipe/photoswipe.umd.min.js' %}"></script>
  208. <script type="application/javascript" src="{% static 'photoswipe/photoswipe-lightbox.umd.min.js' %}"></script>
  209. <script>
  210. $(document).ready(function () {
  211. $(".ui.toggle.button").click(function () {
  212. $(".mobile.only.grid .ui.vertical.menu").toggle(100);
  213. });
  214. $(".ui.dropdown").dropdown();
  215. });
  216. let imgs = $('#article').find('p>img')
  217. function getClass(width) {
  218. if (width > 35 && width < 150) {
  219. return 'ui small rounded image'
  220. } else if (width > 150 && width < 600) {
  221. return 'ui medium rounded image'
  222. } else if (width > 600) {
  223. return 'ui fluid rounded image'
  224. }
  225. }
  226. for (let i = 0; i < imgs.length; i++) {
  227. if ($(imgs[i]).attr('alt')) {
  228. let alt = $(imgs[i]).attr('alt')
  229. let src = $(imgs[i]).attr('src')
  230. $(imgs[i]).parent().html(`<a data-pswp-width="${alt.split(',')[0]}" data-pswp-height="${alt.split(',')[1]}" href="${src}"><img class="${getClass(alt.split(',')[0])}" width="${alt.split(',')[0]}" height="${alt.split(',')[1]}" data-magnify="gallery" data-src="${src}" src="${src}" data-href="${src}" "/></a>`)
  231. } else {
  232. let src = $(imgs[i]).attr('src')
  233. $(imgs[i]).parent().html(`<img class="ui fluid rounded image" src="${src}" />`)
  234. }
  235. }
  236. var lightbox = new PhotoSwipeLightbox({
  237. gallery: 'p',
  238. children: 'a',
  239. // dynamic import is not supported in UMD version
  240. pswpModule: PhotoSwipe
  241. });
  242. lightbox.init();
  243. </script>
  244. <script>
  245. hljs.initHighlightingOnLoad();
  246. </script>
  247. </body>
  248. </html>