read.html 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <link href="/static/plugins/highlight/styles/monokai-sublime.min.css" rel="stylesheet">
  2. <div class="box">
  3. <div class="blank"></div>
  4. <div class="infosbox">
  5. <div class="newsview">
  6. <h3 class="news_title">{$data.title}</h3>
  7. <div class="bloginfo">
  8. <ul>
  9. <li class="author"><a href="/{$data.category_url}"> {$data.category_name} </a></li>
  10. <li class="timer">{$data.create_time}</li>
  11. <li class="view">{$data.hits} 已阅读</li>
  12. <li class="like">{$data.likes}</li>
  13. </ul>
  14. </div>
  15. <div class="tags">
  16. {php}$tags = explode(',',$data->keywords);{/php}
  17. {foreach $tags as $value}
  18. <a href="/tags/{$value}" rel="tag" data-wpel-link="internal">{$value}</a> &nbsp;
  19. {/foreach}
  20. </div>
  21. <div class="news_about"><strong>简介</strong>{$data.summary}</div>
  22. <div class="news_con" id="preview">
  23. {$data.content|raw}
  24. </div>
  25. <p id="content_md" style="display: none;"></p>
  26. <p class="diggit"><a href="JavaScript:getLike({$data.id});"> 很赞哦! </a>(<b id="diggnum"> {$data.likes} </b>)</p>
  27. </div>
  28. <div class="nextinfo">
  29. {empty name="prev_next.prev"}
  30. <p>上一篇:<a >没有了</a></p>
  31. {else}
  32. <p>上一篇:<a href="/read/{$prev_next['prev']['id']}" title="{$prev_next.prev.title}">{$prev_next.prev.title}</a></p>
  33. {/empty}
  34. {empty name="prev_next.next"}
  35. <p>下一篇:<a href="/{$data.category_url}">返回列表</a></p>
  36. {else}
  37. <p>下一篇:<a
  38. href="/read/{$prev_next['next']['id']}"
  39. title="{$prev_next.next.title}">{$prev_next.next.title}</a></p>
  40. {/empty}
  41. </div>
  42. <!-- <div class="otherlink">
  43. <h2>相关文章</h2>
  44. <ul>
  45. <li><a href="#" title="##">###</a></li>
  46. </ul>
  47. </div> -->
  48. <!-- <div class="news_pl">
  49. <h2>文章评论</h2>
  50. <ul>
  51. <div class="gbko"> </div>
  52. </ul>
  53. </div> -->
  54. </div>
  55. {include file="aside"}
  56. </div>
  57. <script src="/static/plugins/highlight/highlight.min.js"></script>
  58. <!-- <script src="/static/plugins/md/js/marked.js"></script> -->
  59. <script type="text/javascript">
  60. // hljs.initHighlightingOnLoad();
  61. hljs.highlightAll();
  62. // marked.setOptions({
  63. // renderer: new marked.Renderer(),
  64. // gfm: true,
  65. // tables: true,
  66. // breaks: false,
  67. // pedantic: false,
  68. // sanitize: false,
  69. // smartLists: true,
  70. // smartypants: false,
  71. // highlight: function (code) {
  72. // return hljs.highlightAuto(code).value;
  73. // }
  74. // });
  75. // $("#preview").html(marked($("#content_md").html()));
  76. function getLike(id) {
  77. var num = parseInt($('#diggnum').text());
  78. $.post('/dolike', {
  79. 'id': id
  80. }, function (res) {
  81. if (res.code==0) {
  82. $('#diggnum').text(num+1);
  83. } else {
  84. console.log(res.msg);
  85. }
  86. }, 'json');
  87. }
  88. </script>