Mayx's Home Page https://mabbs.github.io
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.

129 lines
4.5 KiB

  1. ---
  2. layout: default
  3. ---
  4. <small>{{ page.date | date: "%-d %B %Y" }} - 字数统计:{% if page.layout == "encrypt" %}God Knows {% else %}{{ page.content | strip_html | strip_newlines | remove: " " | size }} - 阅读大约需要{{ page.content | strip_html | strip_newlines | remove: "" | size | divided_by: 350 | plus: 1 }}分钟{% endif %} - Hits: <span id="{{ page.url }}" class="visitors">Loading...</span></small>
  5. <h1>{{ page.title }}</h1>
  6. <p class="view">by <a href="//github.com/{{ page.author | default: "Mabbs" }}">{{ page.author | default: site.author }}</a></p>
  7. <div id="outdate" style="display:none;">
  8. <hr />
  9. 这是一篇创建于 <span id="outime"></span> 天前的文章,其中的信息可能已经有所发展或是发生改变。
  10. <br /><br />
  11. </div>
  12. <script>
  13. BirthDay = new Date("{{ page.date | date: "%m/%d/%Y" }} 00:00:00");
  14. today = new Date();
  15. timeold = (today.getTime() - BirthDay.getTime());
  16. secondsold = Math.floor(timeold / 1000);
  17. e_daysold = timeold / (24 * 60 * 60 * 1000);
  18. daysold = Math.floor(e_daysold);
  19. if (daysold > 90) {
  20. document.getElementById("outdate").style.display = "block";
  21. document.getElementById("outime").innerHTML = daysold;
  22. }
  23. </script>
  24. <hr />
  25. {% if page.layout != "encrypt" %}
  26. <!--[if !IE]> -->
  27. <b>AI摘要</b>
  28. <p id="ai-output"></p>
  29. <script>
  30. async function sha(str) {
  31. const encoder = new TextEncoder();
  32. const data = encoder.encode(str);
  33. const hashBuffer = await crypto.subtle.digest("SHA-256", data);
  34. const hashArray = Array.from(new Uint8Array(hashBuffer)); // convert buffer to byte array
  35. const hashHex = hashArray
  36. .map((b) => b.toString(16).padStart(2, "0"))
  37. .join(""); // convert bytes to hex string
  38. return hashHex;
  39. }
  40. var postContent = "文章标题:" + {{ page.content | jsonify }} +",文章内容:" + {{ page.content | strip_html | strip_newlines | jsonify }};
  41. var postContentSign = await sha(postContent);
  42. var outputContainer = document.getElementById("ai-output");
  43. $.get("https://summary.mayx.eu.org/is_uploaded?id={{ page.url }}&sign=" + postContentSign, function (data) {
  44. if (data == "yes") {
  45. $.get("https://summary.mayx.eu.org/get_summary?id={{ page.url }}&sign=" + postContentSign, function (data2) {
  46. outputContainer.textContent = data2;
  47. });
  48. } else {
  49. $.post("https://summary.mayx.eu.org/upload_blog?id={{ page.url }}", postContent, function (data) {
  50. $.get("https://summary.mayx.eu.org/get_summary?id={{ page.url }}&sign=" + postContentSign);
  51. const evSource = new EventSource("https://summary.mayx.eu.org/summary?id={{ page.url }}");
  52. evSource.onmessage = (event) => {
  53. if (event.data == "[DONE]") {
  54. evSource.close();
  55. return;
  56. } else {
  57. const data = JSON.parse(event.data);
  58. outputContainer.textContent += data.response;
  59. }
  60. }
  61. });
  62. }
  63. });
  64. </script>
  65. <hr />
  66. <!-- <![endif]-->
  67. {% endif %}
  68. {% include toc.html html=content sanitize=true h_max=3 %}
  69. {{content}}
  70. {% if page.tags %}
  71. <small>tags: <em>{{ page.tags | join: "</em> - <em>" }}</em></small>
  72. {% endif %}
  73. <div class="pagination">
  74. {% if page.previous.url %}
  75. <span class="prev">
  76. <a href="{{ site.baseurl }}{{ page.previous.url }}">
  77. 上一篇:{{ page.previous.title }}
  78. </a>
  79. </span>
  80. {% endif %}
  81. <br />
  82. {% if page.next.url %}
  83. <span class="next">
  84. <a href="{{ site.baseurl }}{{ page.next.url }}">
  85. 下一篇:{{ page.next.title }}
  86. </a>
  87. </span>
  88. {% endif %}
  89. </div>
  90. <!--[if !IE]> -->
  91. <link rel="stylesheet" href="/css/gitalk.css">
  92. <script src="/js/gitalk.min.js"></script>
  93. <div id="gitalk-container"></div>
  94. <script>
  95. if (window.location.host != "mabbs.github.io") {
  96. var gitalk = new Gitalk({
  97. clientID: '098934a2556425f19d6e',
  98. clientSecret: '0bd44eed8425e5437ce43c4ba9b2791fbc04581d',
  99. repo: 'mabbs.github.io',
  100. owner: 'Mabbs',
  101. admin: ['Mabbs'],
  102. id: '{{ page.id }}', // Ensure uniqueness and length less than 50
  103. distractionFreeMode: false // Facebook-like distraction free mode
  104. })
  105. }
  106. else {
  107. var gitalk = new Gitalk({
  108. clientID: '36557aec4c3cb04f7ac6',
  109. clientSecret: 'ac32993299751cb5a9ba81cf2b171cca65879cdb',
  110. repo: 'mabbs.github.io',
  111. owner: 'Mabbs',
  112. admin: ['Mabbs'],
  113. id: '{{ page.id }}', // Ensure uniqueness and length less than 50
  114. distractionFreeMode: false // Facebook-like distraction free mode
  115. })
  116. }
  117. gitalk.render('gitalk-container')
  118. </script>
  119. <!-- <![endif]-->

Powered by TurnKey Linux.