Last active
November 9, 2023 15:20
-
-
Save sunzsh/e66cbef4f43820a5c2007d5c747c9529 to your computer and use it in GitHub Desktop.
书签栏免登陆复制CSDN博客中代码片段
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)}}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
复制的能力是csdn自带的函数,有办法我们手动实现复制通用页面上的内容吗