Greasy Fork

Greasy Fork is available in English.

CSDN 去广告沉浸阅读模式

加入随机背景图片, 净化剪切板

当前为 2019-04-18 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

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

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         CSDN 去广告沉浸阅读模式
// @namespace    http://tampermonkey.net/
// @version      1.3
// @description  加入随机背景图片, 净化剪切板
// @description  移除页面内广告和底部列表中的下载链接, 建议使用 ABP 屏蔽广告!!!
// @description  清理 CSDN 底部提示栏及广告并直接展开内容
// @icon         https://avatar.csdn.net/D/7/F/3_nevergk.jpg
// @author       sven
// @include      https://blog.csdn.net/*
// @include      https://bbs.csdn.net/topics/*
// @include      https://*.iteye.com/blog/*
// @run-at       document-end
// @match        <$URL$>
// ==/UserScript==

(function() {
    'use strict';
    (() => {
        const IMG_MAX_ID = 887
        const SHEETS = `
            body { background-image: url(https://ss2.bdstatic.com/lfoZeXSm1A5BphGlnYG/skin/${Math.ceil(Math.random() * IMG_MAX_ID)}.jpg); background-color:#EAEAEA; background-attachment: fixed ;background-size; cover; background-repeat: no-repeat; background-size: 100%; }
            main { opacity: 0.9;margin: 20px; }
            .recommend-item-box .content,.post_feed_box,.topic_r,.mod_topic_wrap,#bbs_title_bar,#bbs_detail_wrap,#left-box,main {width: 100% !important;}
            .login-mark,#passportbox,.hljs-button.signin,.recommend-download-box,.recommend-ad-box,#dmp_ad_58,.blog_star_enter,#header,.blog-sidebar,.blog-sidebar,#new_post.login,.mod_fun_wrap,.hide_topic_box,.bbs_bread_wrap,.news-nav,#rightList.right-box,aside,#kp_box_476,.tool-box,.recommend-right,.pulllog-box,.adblock,.fourth_column,.hide-article-box,#csdn-toolbar,.meau-gotop-box
                {display: none !important;}
            #blog_content,#bbs_detail_wrap,.article_content {height: auto !important;}
            #bbs_detail_wrap {max-height: none !important;}
            #main {width: calc(100% - 208px) !important;}
            #page {margin-top: 0 !important;}
        `
        class CSDNCleaner {
            constructor () {
                console.log('%c[CSDN 去广告沉浸阅读模式] %c感谢支持, %c欢迎反馈: http://greasyfork.icu/zh-CN/scripts/373457-csdn-%E5%8E%BB%E5%B9%BF%E5%91%8A%E6%B2%89%E6%B5%B8%E9%98%85%E8%AF%BB%E6%A8%A1%E5%BC%8F/feedback', 'font-size: 16px;color:#C60', 'color: teal', '')
            }
            // 通过注入 css 实现隐藏广告并固定布局
            appendSheets () {
                const sheet = document.createTextNode(SHEETS)
                const el = document.createElement('style')
                el.appendChild(sheet)
                document.getElementsByTagName('head')[0].appendChild(el)
                return this
            }
            // 复制功能
            cleanCopy () {
                csdn.copyright.init('', '', '')
                return this
            }
        }
        const fc = new CSDNCleaner()
        fc.appendSheets().cleanCopy()
    })()
})();