CSDN快捷工具
// ==UserScript==
// @name CSDN快捷工具
// @namespace http://tampermonkey.net/
// @version 0.1.3
// @description csde 快捷复制、不带版权文字、查看全文等功能
// @author 昊色居士
// @match *.csdn.net/*
// @match https://blog.csdn.net/*
// @icon https://www.google.com/s2/favicons?domain=csdn.net
// @grant none
// ==/UserScript==
(function () {
// 允许不登录复制
document.querySelector("#content_views").style.setProperty('user-select', 'text', 'important')
for (const e of document.querySelectorAll('#content_views pre')) {
e.style.setProperty('user-select', 'text', 'important')
}
for (const e of document.querySelectorAll('#content_views pre code')) {
e.style.setProperty('user-select', 'text', 'important')
}
$("#content_views").unbind()
// 复制不带版权
var copy_element = document.querySelector('main .blog-content-box')
csdn.copyright.init(copy_element, '')
// 登录后复制按钮 data-title 改成随便复制并删除点击事件
document.querySelectorAll('.hljs-button').forEach(
doc => {
doc.setAttribute("data-title", "随便复制")
doc.setAttribute("style", "pointer-events: none;!important")
}
)
// 不关注博主即可看全文
$(".hide-article-box").hide()
$("div.article_content").removeAttr("style")
})();