mirror of
https://git.beihong.wang/wangbeihong/blog-source.git
synced 2026-04-24 08:13:04 +08:00
initial
This commit is contained in:
1
usr/themes/HarmonyHues/assets/js/codecopy.min.js
vendored
Executable file
1
usr/themes/HarmonyHues/assets/js/codecopy.min.js
vendored
Executable file
@@ -0,0 +1 @@
|
||||
$(document).ready(function(){$(".pre-copy").on("click",function(){const e=$(this),t=e.closest(".pre-container").find("code").text();navigator.clipboard.writeText(t).then(()=>{e.text("复制成功"),setTimeout(()=>e.text("复制"),1e3)}).catch(o=>{const c=$("<textarea>");$("body").append(c),c.val(t).select();const n=document.execCommand("copy");c.remove(),n?(e.text("复制成功"),setTimeout(()=>e.text("复制"),1e3)):(alert("复制失败,请手动复制代码。"),console.error("复制失败:",o))})})});
|
||||
Reference in New Issue
Block a user