diff --git a/templates/post.html b/templates/post.html index 6f81c04..cc7a9d0 100644 --- a/templates/post.html +++ b/templates/post.html @@ -73,6 +73,11 @@ + {% endblock %} {% block content %} @@ -95,7 +100,14 @@ document.getElementById("pathHome").setAttribute("d",IconList["home"]); span.innerHTML="{{ blogBase['commentNum'] }}"; cmButton.appendChild(span); {%- endif %} - +document.getElementById("copyLinkBtn").addEventListener("click", () => { + const url = window.location.href; + navigator.clipboard.writeText(url).then(() => { + alert("文章链接已复制!"); + }).catch(() => { + alert("复制失败,请手动复制链接"); + }); +}); {% if blogBase['needComment']==1 %} function openComments(){ cm=document.getElementById("comments");