Greasy Fork is available in English.

HappyCSDN

做一个快乐的CV工程师,连接直接跳转,移除复制小尾巴,移除下载推荐

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         HappyCSDN
// @namespace    http://tampermonkey.net/
// @homepage     https://github.com/mouday/tampermonkey-script
// @version      0.3
// @description  做一个快乐的CV工程师,连接直接跳转,移除复制小尾巴,移除下载推荐
// @author       Mouday
// @email        [email protected]
// @icon         https://csdnimg.cn/public/favicon.ico

// @match        *://blog.csdn.net/*/article/details/*
// @match        *://*.blog.csdn.net/article/details/*

// @grant        none
// ==/UserScript==

// 新tab打开文章内部链接,取消中间跳转,加快coding步伐
function openLinkOnNewTab(){
    for(let a of [...document.querySelectorAll('#article_content a')]){
        a.target = '_blank';
        a.addEventListener('click', (e) => {
            e.stopPropagation()
        });
    }
}

// 移除复制小尾巴,保护delete键
function removeCopyAppend(){
    document.querySelector('#article_content').addEventListener('copy', function(e){
        e.stopPropagation()
    })
}


// 移除下载推荐栏,避免点错浪费时间
function removeDownloadRecommendBox(){
    document.querySelector('.second-recommend-box').style.display = 'none';
    document.querySelector('.first-recommend-box').style.display = 'none';

}

// 自动展开代码 2023-02-16
function autoExpandCode(){
    document.querySelectorAll('.hide-preCode-bt').forEach(item=>item.click())
}

(function() {
    'use strict';
    openLinkOnNewTab();
    removeCopyAppend();
    removeDownloadRecommendBox();
    autoExpandCode();
})();