今天执刀人网上找一篇一键解除CSDN代码复制限制油猴脚本代码分享给大家,可以一键解除未登录时,代码复制限制(仅限Markdown文章),解除必须关注博主等条件才能继续阅读下文限制。
油猴脚本代码
// ==UserScript==
// @name CSDN 代码复制限制
// @namespace http://tampermonkey.net/
// @version 0.1
// @description 用于解除 CSDN 博客内代码复制限制
// @author Bright Xu
// @match *.csdn.net/*
// @icon https://g.csdnimg.cn/static/logo/favicon32.ico
// @grant none
// ==/UserScript==
function removeLimit() {
if (window.csdn) {
if (window.csdn.copyright) window.csdn.copyright.textData = ”;
if (window.csdn.loginBox) window.csdn.loginBox.show = function(){}
}
const d = document.getElementById(‘article_content’);
if(d) d.style.height = ‘unset’;
}
(function() {
‘use strict’;
const style = document.createElement(‘style’);
style.innerHTML = `
#articleSearchTip, #csdn-redpack, .csdn-redpack-container, .toolbar-advert, .csdn-reapck-select {
display: none !important;
}
.hide-article-box {
display: none !important;
}
#content_views {
user-select: unset !important;
-webkit-user-select: unset !important;
}
`;
document.head.append(style);
if (window.$ !== undefined) $(‘pre,code’).css(‘user-select’, ‘unset’);
removeLimit()
setInterval(function() {
removeLimit();
}, 3000);
})();