blog.html 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437
  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 name="apple-mobile-web-app-capable" content="yes"/>
  12. <meta name="robots" content="index,follow"/>
  13. <meta
  14. name="description"
  15. content="{{ article.intro }}"
  16. />
  17. <meta name="keywords" content="{{ article.title }}"/>
  18. <meta name="author" content="CyberSicko"/>
  19. <meta name="theme-color" content="#ffffff"/>
  20. <title>{{ article.title }}-CyberSicko.net</title>
  21. <link rel="preconnect" href="https://fonts.googleapis.com">
  22. <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  23. <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@200;300;400;500;600;700;900&display=swap"
  24. rel="stylesheet">
  25. <link
  26. rel="stylesheet"
  27. href="{% static 'semantic.min.css' %}"
  28. type="text/css"
  29. />
  30. <link
  31. rel="stylesheet"
  32. href="{% static 'photoswipe/photoswipe.css' %}"
  33. type="text/css"
  34. />
  35. <link rel="stylesheet" href="{% static 'highlightjs/styles/androidstudio.min.css' %}">
  36. <link rel="stylesheet" href="{% static 'css/fonts.css' %}">
  37. <link rel="shortcut icon" href="{% static 'favicon.ico' %}">
  38. <style type="text/css">
  39. p > a > img {
  40. width: 100%;
  41. height: 100%;
  42. }
  43. blockquote {
  44. margin: 0;
  45. }
  46. blockquote {
  47. padding: 15px;
  48. background: #eee;
  49. }
  50. blockquote ::before {
  51. content: '\201C';
  52. }
  53. blockquote ::after {
  54. content: '\201D';
  55. }
  56. p {
  57. font-size: 1.2em;
  58. }
  59. body {
  60. padding-top: 54px;
  61. -webkit-font-smoothing: antialiased;
  62. -moz-font-smoothing: grayscale;
  63. }
  64. .ui.borderless.menu {
  65. background-color: #f8f8f8;
  66. {#box-shadow: none;#} flex-wrap: wrap;
  67. border: none;
  68. padding-left: 0;
  69. padding-right: 0;
  70. }
  71. .ui.borderless.menu .header.item {
  72. font-size: 18px;
  73. font-weight: 400;
  74. }
  75. .ui.mobile.only.grid .ui.menu .ui.vertical.menu {
  76. display: none;
  77. }
  78. .ui.mobile.only.grid .ui.vertical.menu .dropdown.icon {
  79. float: unset;
  80. }
  81. .ui.mobile.only.grid .ui.vertical.menu .dropdown.icon:before {
  82. content: "\f0d7";
  83. }
  84. .ui.mobile.only.grid .ui.vertical.menu .ui.dropdown.item .menu {
  85. position: static;
  86. width: 100%;
  87. background-color: unset;
  88. border: none;
  89. box-shadow: none;
  90. }
  91. .ui.mobile.only.grid .ui.vertical.menu .ui.dropdown.item .menu {
  92. margin-top: 6px;
  93. }
  94. .ui.container > .ui.message {
  95. background-color: rga(238, 238, 238);
  96. box-shadow: none;
  97. padding: 5rem 4rem;
  98. margin-top: 1rem;
  99. }
  100. .ui.message h1.ui.header {
  101. font-size: 4.5rem;
  102. }
  103. .ui.message p.lead {
  104. font-size: 1.3rem;
  105. color: #333333;
  106. line-height: 1.4;
  107. font-weight: 300;
  108. }
  109. .pre {
  110. background-color: antiquewhite;
  111. border-radius: 4px;
  112. }
  113. </style>
  114. </head>
  115. <body id="root">
  116. {% if is_login %}
  117. {% csrf_token %}
  118. {% endif %}
  119. <div class="ui tablet computer only padded grid">
  120. <div class="ui top fixed borderless fluid huge menu">
  121. <div class="ui container">
  122. <a href="/" class="header item"><img style="width: 7em;" src="{% static '/img.png' %}"/></a>
  123. <a href="/" class="item">主页</a>
  124. {% for item in category %}
  125. {# <li class="category_li"><a href="/category/{{ item.name }}?page=1">{{ item.name }}</a></li>#}
  126. <a class="{% if current_category != None and current_category == item.name %}
  127. active
  128. {% else %}
  129. {% endif %} item" href="/category/{{ item.name }}?page=1">{{ item.name }}</a>
  130. {% endfor %}
  131. <div class="right menu">
  132. <a href="/login" class="item"> <i class="icon share square"></i>
  133. Sign in</a>
  134. </div>
  135. </div>
  136. </div>
  137. </div>
  138. <div class="ui mobile only padded grid">
  139. <div class="ui top fixed borderless huge fluid menu">
  140. <a href="/" class="header item"><img style="width: 7em;" src="{% static '/img.png' %}"/></a>
  141. <div class="right menu">
  142. <div class="item">
  143. <button class="ui icon toggle basic button">
  144. <i class="content icon"></i>
  145. </button>
  146. </div>
  147. </div>
  148. <div class="ui vertical borderless fluid menu">
  149. <a href="/" class="item">主页</a>
  150. {% for item in category %}
  151. {# <li class="category_li"><a href="/category/{{ item.name }}?page=1">{{ item.name }}</a></li>#}
  152. <a class="{% if current_category != None and current_category == item.name %}
  153. active
  154. {% else %}
  155. {% endif %} item" href="/category/{{ item.name }}?page=1">{{ item.name }}</a>
  156. {% endfor %}
  157. <a href="/login" class="item"> <i class="icon share square"></i>
  158. Sign in</a>
  159. </div>
  160. </div>
  161. </div>
  162. <div class="ui grid stackable container">
  163. <div class="row" id="article">
  164. <div class="eleven wide column">
  165. <h1 class="ui large header">
  166. <div class="content">{{ article.title }}</div>
  167. </h1>
  168. <div class="ui comments" style="margin-top: 0">
  169. <div class="comment">
  170. <a class="avatar">
  171. <img src="/user_avatar/{{ article.user_id }}">
  172. </a>
  173. <div class="content">
  174. <a class="author">{{ article.user__first_name }}{{ article.user__last_name }}</a>
  175. <div class="metadata">
  176. <div class="date">发布于: {{ article.created_time|days_until }}</div>
  177. </div>
  178. <div class="text">hava a nice day.</div>
  179. </div>
  180. </div>
  181. </div>
  182. {% autoescape off %}
  183. {{ article.html_text }}
  184. {% endautoescape %}
  185. <h3 class="ui dividing header" style="margin-top: 10vh">评论</h3>
  186. <div class="ui comments">
  187. {% for comment in comments %}
  188. <div class="comment">
  189. <a class="avatar">
  190. <img src="{{ comment.avatar | get_avatar }}">
  191. </a>
  192. <div class="content">
  193. <a target="_blank" href="{{ comment.website }}" class="author">{{ comment.nick_name }}</a>
  194. <div class="text">{{ comment.comment }}</div>
  195. <div class="actions">
  196. <a href="mailto:{{ comment.email }}"> <i class="mail icon"></i>联系他</a>
  197. <a>
  198. <i class="time icon"></i>
  199. {{ comment.created_time }}
  200. </a>
  201. </div>
  202. </div>
  203. </div>
  204. {% endfor %}
  205. </div>
  206. <form onsubmit="save()" method="post" action="/comment/add" id="comment_form" style="margin-top: 10px"
  207. class="ui form">
  208. {% csrf_token %}
  209. <input hidden="hidden" name="article_id" value="{{ article.id }}">
  210. <h4 class="ui dividing header">发表评论</h4>
  211. <div class="field">
  212. <div class="two fields">
  213. <div class="field">
  214. <label>昵称<span style="color: red">*</span></label>
  215. <input id="nick_name" type="text" name="nick_name" placeholder="昵称">
  216. </div>
  217. <div class="field">
  218. <label>Email<span style="color: red">*</span></label>
  219. <input id="email" type="email" name="email" placeholder="Email">
  220. </div>
  221. </div>
  222. </div>
  223. <div class="field">
  224. <div class="two fields">
  225. <div class="twelve wide field">
  226. <label>网站(可不填)</label>
  227. <input id="website" type="url" name="website" placeholder="网站">
  228. </div>
  229. <div class="four wide field">
  230. <label>头像<span style="color: red">*</span></label>
  231. <div class="ui fluid selection dropdown">
  232. <input value="jenny" type="hidden" name="avatar">
  233. <i class="dropdown icon"></i>
  234. <div class="default text">
  235. Jenny Hess
  236. </div>
  237. <div class="menu">
  238. <div class="item" data-value="jenny">
  239. <img class="ui mini avatar image"
  240. src="https://semantic-ui.com/images/avatar/small/jenny.jpg">
  241. Jenny Hess
  242. </div>
  243. <div class="item" data-value="elliot">
  244. <img class="ui mini avatar image"
  245. src="https://semantic-ui.com/images/avatar/small/elliot.jpg">
  246. Elliot Fu
  247. </div>
  248. <div class="item" data-value="stevie">
  249. <img class="ui mini avatar image"
  250. src="https://semantic-ui.com/images/avatar/small/stevie.jpg">
  251. Stevie Feliciano
  252. </div>
  253. <div class="item" data-value="christian">
  254. <img class="ui mini avatar image"
  255. src="https://semantic-ui.com/images/avatar/small/christian.jpg">
  256. Christian
  257. </div>
  258. <div class="item" data-value="matt">
  259. <img class="ui mini avatar image"
  260. src="https://semantic-ui.com/images/avatar/small/matt.jpg">
  261. Matt
  262. </div>
  263. <div class="item" data-value="justen">
  264. <img class="ui mini avatar image"
  265. src="https://semantic-ui.com/images/avatar/small/justen.jpg">
  266. Justen Kitsune
  267. </div>
  268. </div>
  269. </div>
  270. </div>
  271. </div>
  272. </div>
  273. <div class="field">
  274. <textarea name="comment" placeholder="评论"></textarea>
  275. </div>
  276. <div style="color: red">{{ msg }}</div>
  277. <button class="ui blue labeled submit icon button">
  278. <i class="icon edit"></i> 提交
  279. </button>
  280. </form>
  281. <div class="ui hidden divider"></div>
  282. </div>
  283. <div class="four wide right floated column">
  284. <h4 class="ui header">搜索</h4>
  285. <div id="search" class="ui category search">
  286. <div class="ui icon input">
  287. <input class="prompt" type="text" placeholder="搜索">
  288. <i class="search icon"></i>
  289. </div>
  290. </div>
  291. <h4 class="ui header">归档</h4>
  292. <div class="ui list">
  293. {% for record in records %}
  294. <a class="item" href="/date/{{ record.datetime }}?page=1">{{ record.datetime }}
  295. ({{ record.count }})</a>
  296. {% endfor %}
  297. </div>
  298. <h4 class="ui header">Top</h4>
  299. <div class="ui list">
  300. {% for tag in tags %}
  301. <a class="item" href="/tag/{{ tag.name }}?page=1">{{ tag.name }} ({{ tag.count }})</a>
  302. {% endfor %}
  303. </div>
  304. </div>
  305. </div>
  306. </div>
  307. <footer style="margin-top: 50px" class="ui secondary segment">
  308. <div class="ui two column stackable grid">
  309. <div class="ten wide column">
  310. <img style="width: 8rem" src="{% static '/img.png' %}">
  311. <p> © 2023 - 2023 cybersicko.net - All Rights Reserved.</p>
  312. </div>
  313. <div class="six wide column">
  314. <div class="ui left aligned container" style="margin-top:10px">
  315. <a target="_blank" href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=50019002503732"
  316. style="display:inline-block;text-decoration:none;height:20px;line-height:20px;"><img
  317. src="{% static '/备案图标.png' %}" style="float:left;"/>
  318. <p style="float:left;height:20px;line-height:20px;margin: 0px 0px 0px 5px; color:#939393;"> 渝公网安备
  319. 50019002503732号</p></a>
  320. <a rel="nofollow"
  321. href="http://beian.miit.gov.cn/publish/query/indexFirst.action"
  322. target="_blank"><p>皖ICP备2023011943号</p></a>
  323. </div>
  324. </div>
  325. </div>
  326. </footer>
  327. <script type="application/javascript" src="{% static 'js/jquery.min.js' %}"></script>
  328. <script type="application/javascript" src="{% static 'semantic.js' %}"></script>
  329. <script src="{% static 'highlightjs/highlight.min.js' %}"></script>
  330. <script type="application/javascript" src="{% static 'photoswipe/photoswipe.umd.min.js' %}"></script>
  331. <script type="application/javascript" src="{% static 'photoswipe/photoswipe-lightbox.umd.min.js' %}"></script>
  332. <script>
  333. restoreComment()
  334. function restoreComment() {
  335. if (localStorage.getItem('nick_name') !== undefined && localStorage.getItem('nick_name') !== '') {
  336. $("#nick_name").val(localStorage.getItem('nick_name'))
  337. }
  338. if (localStorage.getItem('email') !== undefined && localStorage.getItem('email') !== '') {
  339. $("#email").val(localStorage.getItem('email'))
  340. }
  341. if (localStorage.getItem('website') !== undefined && localStorage.getItem('website') !== '') {
  342. $("#website").val(localStorage.getItem('website'))
  343. }
  344. }
  345. function save() {
  346. var data = $('#comment_form').serializeArray();
  347. localStorage.setItem('nick_name', $('#nick_name').val())
  348. localStorage.setItem('email', $('#email').val())
  349. localStorage.setItem('website', $('#website').val())
  350. return true
  351. }
  352. </script>
  353. <script>
  354. $(document).ready(function () {
  355. $(".ui.toggle.button").click(function () {
  356. $(".mobile.only.grid .ui.vertical.menu").toggle(100);
  357. });
  358. $(".ui.dropdown").dropdown();
  359. });
  360. let imgs = $('#article').find('p>img')
  361. function getClass(width) {
  362. if (width > 35 && width < 150) {
  363. return 'ui small rounded image'
  364. } else if (width > 150 && width < 800) {
  365. return 'ui medium rounded image'
  366. } else if (width > 800) {
  367. return 'ui fluid rounded image'
  368. }
  369. }
  370. for (let i = 0; i < imgs.length; i++) {
  371. if ($(imgs[i]).attr('alt')) {
  372. let alt = $(imgs[i]).attr('alt')
  373. let src = $(imgs[i]).attr('src')
  374. $(imgs[i]).parent().html(`<a data-pswp-width="${alt.split(',')[0]}" data-pswp-height="${alt.split(',')[1]}" href="${src}"><img style="display: inline-block;" 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>`)
  375. } else {
  376. let src = $(imgs[i]).attr('src')
  377. $(imgs[i]).parent().html(`<img style="display: inline-block;" class="ui fluid rounded image" src="${src}" />`)
  378. }
  379. }
  380. var lightbox = new PhotoSwipeLightbox({
  381. gallery: 'p',
  382. children: 'a[data-pswp-width]',
  383. // dynamic import is not supported in UMD version
  384. pswpModule: PhotoSwipe
  385. });
  386. lightbox.init();
  387. </script>
  388. <script>
  389. hljs.initHighlightingOnLoad();
  390. </script>
  391. </body>
  392. </html>