Skip to content

Instantly share code, notes, and snippets.

@sunzsh
Last active November 9, 2023 15:20
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save sunzsh/e66cbef4f43820a5c2007d5c747c9529 to your computer and use it in GitHub Desktop.
Save sunzsh/e66cbef4f43820a5c2007d5c747c9529 to your computer and use it in GitHub Desktop.
书签栏免登陆复制CSDN博客中代码片段
javascript:$('#content_views').unbind('copy');csdn.copyright.textData='';document.querySelectorAll(".prism,.hljs-button").forEach((b)=>{b.setAttribute('data-title','\u590d\u5236');b.onclick=function(e){navigator.clipboard.writeText(e.target.parentElement.innerText);e.stopPropagation();e.target.setAttribute('data-title','\u590d\u5236\u6210\u529f');setTimeout(()=>{e.target.setAttribute('data-title','\u590d\u5236');},2000)}});document.querySelectorAll("style").forEach((s)=>{if((s.innerText||"").indexOf('#content_views pre')>-1){s.parentElement.removeChild(s)}});
@daigang666
Copy link

复制的能力是csdn自带的函数,有办法我们手动实现复制通用页面上的内容吗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment