read.html 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <link href="/static/plugins/highlight/styles/solarized-light.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.pack.js"></script>
  58. <!-- <script src="/static/plugins/md/js/marked.js"></script> -->
  59. <script src="/static/plugins/lib/ueditor/1.4.3/third-party/SyntaxHighlighter/shCore.js"></script>
  60. <script type="text/javascript">
  61. $(document).ready(function() {
  62. $('pre').each(function(i, block) {
  63. hljs.highlightBlock(block);
  64. });
  65. });
  66. // hljs.initHighlightingOnLoad();
  67. // hljs.highlightAll();
  68. // SyntaxHighlighter.all();
  69. // marked.setOptions({
  70. // renderer: new marked.Renderer(),
  71. // gfm: true,
  72. // tables: true,
  73. // breaks: false,
  74. // pedantic: false,
  75. // sanitize: false,
  76. // smartLists: true,
  77. // smartypants: false,
  78. // highlight: function (code) {
  79. // return hljs.highlightAuto(code).value;
  80. // }
  81. // });
  82. // $("#preview").html(marked($("#content_md").html()));
  83. function getLike(id) {
  84. var num = parseInt($('#diggnum').text());
  85. $.post('/dolike', {
  86. 'id': id
  87. }, function (res) {
  88. if (res.code==0) {
  89. $('#diggnum').text(num+1);
  90. } else {
  91. console.log(res.msg);
  92. }
  93. }, 'json');
  94. }
  95. </script>