| 
									
										
										
										
											2022-01-04 20:42:55 +08:00
										 |  |  | --- | 
					
						
							|  |  |  | layout: default | 
					
						
							|  |  |  | --- | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-07-02 16:09:28 +08:00
										 |  |  | <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> | 
					
						
							| 
									
										
										
										
											2022-01-04 20:42:55 +08:00
										 |  |  | <h1>{{ page.title }}</h1> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <p class="view">by <a href="//github.com/{{ page.author | default: "Mabbs" }}">{{ page.author | default: site.author }}</a></p> | 
					
						
							|  |  |  | <div id="outdate" style="display:none;"> | 
					
						
							| 
									
										
										
										
											2024-07-02 16:09:28 +08:00
										 |  |  |   <hr /> | 
					
						
							|  |  |  |   这是一篇创建于 <span id="outime"></span> 天前的文章,其中的信息可能已经有所发展或是发生改变。 | 
					
						
							|  |  |  |   <br /><br /> | 
					
						
							| 
									
										
										
										
											2022-01-04 20:42:55 +08:00
										 |  |  | </div> | 
					
						
							|  |  |  | <script> | 
					
						
							| 
									
										
										
										
											2024-07-02 16:09:28 +08:00
										 |  |  |   BirthDay = new Date("{{ page.date | date: "%m/%d/%Y" }} 00:00:00"); | 
					
						
							|  |  |  |   today = new Date(); | 
					
						
							|  |  |  |   timeold = (today.getTime() - BirthDay.getTime()); | 
					
						
							|  |  |  |   secondsold = Math.floor(timeold / 1000); | 
					
						
							|  |  |  |   e_daysold = timeold / (24 * 60 * 60 * 1000); | 
					
						
							|  |  |  |   daysold = Math.floor(e_daysold); | 
					
						
							|  |  |  |   if (daysold > 90) { | 
					
						
							| 
									
										
										
										
											2022-01-04 20:42:55 +08:00
										 |  |  |     document.getElementById("outdate").style.display = "block"; | 
					
						
							|  |  |  |     document.getElementById("outime").innerHTML = daysold; | 
					
						
							| 
									
										
										
										
											2024-07-02 16:09:28 +08:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2022-01-04 20:42:55 +08:00
										 |  |  | </script> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <hr /> | 
					
						
							| 
									
										
										
										
											2024-07-02 16:09:28 +08:00
										 |  |  | {% if page.layout != "encrypt" %} | 
					
						
							|  |  |  | <!--[if !IE]> --> | 
					
						
							|  |  |  | <b>AI摘要</b> | 
					
						
							| 
									
										
										
										
											2024-07-02 16:25:21 +08:00
										 |  |  | <p id="ai-output">正在生成中……</p> | 
					
						
							| 
									
										
										
										
											2024-07-02 16:09:28 +08:00
										 |  |  | <script> | 
					
						
							|  |  |  |   async function sha(str) { | 
					
						
							|  |  |  |     const encoder = new TextEncoder(); | 
					
						
							|  |  |  |     const data = encoder.encode(str); | 
					
						
							|  |  |  |     const hashBuffer = await crypto.subtle.digest("SHA-256", data); | 
					
						
							|  |  |  |     const hashArray = Array.from(new Uint8Array(hashBuffer)); // convert buffer to byte array | 
					
						
							|  |  |  |     const hashHex = hashArray | 
					
						
							|  |  |  |       .map((b) => b.toString(16).padStart(2, "0")) | 
					
						
							|  |  |  |       .join(""); // convert bytes to hex string | 
					
						
							|  |  |  |     return hashHex; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2024-07-02 16:46:57 +08:00
										 |  |  |   async function ai_gen(){ | 
					
						
							|  |  |  |     var postContent = "文章标题:" + {{ page.title | jsonify }} + ";文章内容:" + {{ page.content | strip_html | strip_newlines | jsonify }}; | 
					
						
							|  |  |  |     var postContentSign = await sha(postContent); | 
					
						
							|  |  |  |     var outputContainer = document.getElementById("ai-output"); | 
					
						
							|  |  |  |     $.get("https://summary.mayx.eu.org/is_uploaded?id={{ page.url }}&sign=" + postContentSign, function (data) { | 
					
						
							|  |  |  |       if (data == "yes") { | 
					
						
							|  |  |  |         $.get("https://summary.mayx.eu.org/get_summary?id={{ page.url }}&sign=" + postContentSign, function (data2) { | 
					
						
							|  |  |  |           outputContainer.textContent = data2; | 
					
						
							|  |  |  |         }); | 
					
						
							|  |  |  |       } else { | 
					
						
							|  |  |  |         $.post("https://summary.mayx.eu.org/upload_blog?id={{ page.url }}", postContent, function (data) { | 
					
						
							|  |  |  |           $.get("https://summary.mayx.eu.org/get_summary?id={{ page.url }}&sign=" + postContentSign); | 
					
						
							|  |  |  |           const evSource = new EventSource("https://summary.mayx.eu.org/summary?id={{ page.url }}"); | 
					
						
							|  |  |  |           outputContainer.textContent = ""; | 
					
						
							|  |  |  |           evSource.onmessage = (event) => { | 
					
						
							|  |  |  |             if (event.data == "[DONE]") { | 
					
						
							|  |  |  |               evSource.close(); | 
					
						
							|  |  |  |               return; | 
					
						
							|  |  |  |             } else { | 
					
						
							|  |  |  |               const data = JSON.parse(event.data); | 
					
						
							|  |  |  |               outputContainer.textContent += data.response; | 
					
						
							|  |  |  |             } | 
					
						
							| 
									
										
										
										
											2024-07-02 16:09:28 +08:00
										 |  |  |           } | 
					
						
							| 
									
										
										
										
											2024-07-02 16:46:57 +08:00
										 |  |  |         }); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   ai_gen(); | 
					
						
							| 
									
										
										
										
											2024-07-02 16:09:28 +08:00
										 |  |  | </script> | 
					
						
							|  |  |  | <hr /> | 
					
						
							|  |  |  | <!-- <![endif]--> | 
					
						
							|  |  |  | {% endif %} | 
					
						
							| 
									
										
										
										
											2022-01-04 20:42:55 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-30 02:44:09 +08:00
										 |  |  | {% include toc.html html=content sanitize=true h_max=3 %} | 
					
						
							| 
									
										
										
										
											2022-01-04 20:42:55 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | {{content}} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | {% if page.tags %} | 
					
						
							| 
									
										
										
										
											2024-07-02 16:09:28 +08:00
										 |  |  | <small>tags: <em>{{ page.tags | join: "</em> - <em>" }}</em></small> | 
					
						
							| 
									
										
										
										
											2022-01-04 20:42:55 +08:00
										 |  |  | {% endif %} | 
					
						
							| 
									
										
										
										
											2024-09-30 21:59:21 +08:00
										 |  |  | <br /> | 
					
						
							| 
									
										
										
										
											2024-09-30 22:59:32 +08:00
										 |  |  | <br /> | 
					
						
							| 
									
										
										
										
											2024-09-30 21:51:26 +08:00
										 |  |  | <p id="suggest-container"><button onclick="getSuggestBlog('{{ page.url }}')">查看推荐文章</button></p> | 
					
						
							| 
									
										
										
										
											2022-01-04 20:42:55 +08:00
										 |  |  | <div class="pagination"> | 
					
						
							| 
									
										
										
										
											2024-07-02 16:09:28 +08:00
										 |  |  |   {% if page.previous.url %} | 
					
						
							|  |  |  |   <span class="prev"> | 
					
						
							|  |  |  |     <a href="{{ site.baseurl }}{{ page.previous.url }}"> | 
					
						
							|  |  |  |       上一篇:{{ page.previous.title }} | 
					
						
							|  |  |  |     </a> | 
					
						
							|  |  |  |   </span> | 
					
						
							|  |  |  |   {% endif %} | 
					
						
							| 
									
										
										
										
											2022-01-04 20:42:55 +08:00
										 |  |  |   <br /> | 
					
						
							| 
									
										
										
										
											2024-07-02 16:09:28 +08:00
										 |  |  |   {% if page.next.url %} | 
					
						
							|  |  |  |   <span class="next"> | 
					
						
							|  |  |  |     <a href="{{ site.baseurl }}{{ page.next.url }}"> | 
					
						
							|  |  |  |       下一篇:{{ page.next.title }} | 
					
						
							|  |  |  |     </a> | 
					
						
							|  |  |  |   </span> | 
					
						
							|  |  |  |   {% endif %} | 
					
						
							|  |  |  | </div> | 
					
						
							| 
									
										
										
										
											2022-01-04 20:42:55 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | <!--[if !IE]> --> | 
					
						
							| 
									
										
										
										
											2024-07-02 16:09:28 +08:00
										 |  |  | <link rel="stylesheet" href="/css/gitalk.css"> | 
					
						
							|  |  |  | <script src="/js/gitalk.min.js"></script> | 
					
						
							| 
									
										
										
										
											2022-01-04 20:42:55 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | <div id="gitalk-container"></div> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <script> | 
					
						
							| 
									
										
										
										
											2024-07-02 16:09:28 +08:00
										 |  |  |   if (window.location.host != "mabbs.github.io") { | 
					
						
							|  |  |  |     var gitalk = new Gitalk({ | 
					
						
							|  |  |  |       clientID: '098934a2556425f19d6e', | 
					
						
							|  |  |  |       clientSecret: '0bd44eed8425e5437ce43c4ba9b2791fbc04581d', | 
					
						
							|  |  |  |       repo: 'mabbs.github.io', | 
					
						
							|  |  |  |       owner: 'Mabbs', | 
					
						
							|  |  |  |       admin: ['Mabbs'], | 
					
						
							|  |  |  |       id: '{{ page.id }}',      // Ensure uniqueness and length less than 50 | 
					
						
							|  |  |  |       distractionFreeMode: false  // Facebook-like distraction free mode | 
					
						
							|  |  |  |     }) | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   else { | 
					
						
							|  |  |  |     var gitalk = new Gitalk({ | 
					
						
							|  |  |  |       clientID: '36557aec4c3cb04f7ac6', | 
					
						
							|  |  |  |       clientSecret: 'ac32993299751cb5a9ba81cf2b171cca65879cdb', | 
					
						
							|  |  |  |       repo: 'mabbs.github.io', | 
					
						
							|  |  |  |       owner: 'Mabbs', | 
					
						
							|  |  |  |       admin: ['Mabbs'], | 
					
						
							|  |  |  |       id: '{{ page.id }}',      // Ensure uniqueness and length less than 50 | 
					
						
							|  |  |  |       distractionFreeMode: false  // Facebook-like distraction free mode | 
					
						
							|  |  |  |     }) | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2022-01-04 20:42:55 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-07-02 16:09:28 +08:00
										 |  |  |   gitalk.render('gitalk-container') | 
					
						
							| 
									
										
										
										
											2022-01-04 20:42:55 +08:00
										 |  |  | </script> | 
					
						
							| 
									
										
										
										
											2024-07-02 16:09:28 +08:00
										 |  |  | <!-- <![endif]--> |