CSDN常用技巧

-
-
2025-12-12 09:07
 
 

登录/关注才能看全篇

const style = document.createElement('style');
style.textContent = `
    .hide-article-box,
    #article_content {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }
    .article_content {
        height: auto !important;
    }
`;
document.head.appendChild(style);

 

不登录就无法复制

// 移除复制限制
document.addEventListener('copy', function(e) {
    e.stopPropagation();
}, true);

// 移除选择限制
document.onselectstart = null;
document.oncontextmenu = null;

// 移除所有禁用选择的样式
const style = document.createElement('style');
style.textContent = `
    * {
        -webkit-user-select: text !important;
        -moz-user-select: text !important;
        -ms-user-select: text !important;
        user-select: text !important;
    }
    body {
        -webkit-user-select: text !important;
        user-select: text !important;
    }
`;
document.head.appendChild(style);

// 移除事件监听
document.body.onselectstart = null;
document.body.oncopy = null;