CSDN博客

专注阅读CSDN博客主要内容

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         CSDN博客
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  专注阅读CSDN博客主要内容
// @author       You
// @match        *://blog.csdn.net/*/article/details/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    var $container = $('div.container.clearfix');
    var $children;
    if ($container.length > 0) {
        var $parent = $container.parent();
        $children = $parent.children(':not(div.container.clearfix)');
        remove($children);
        $children = $container.children(':not(main)');
        remove($children);
        var $main = $container.children('main');
        $main.css('width', '100%');
        $children = $main.children(':not(article,div.readall_box)');
        remove($children);
    } else {
        var $target = $('#article_details');
        while ($target.length > 0) {
            if ($target[0].id === 'main') {
                $target.css('padding-left', '0');
            } else if ($target[0].tagName.toLowerCase() === 'body') {
                break;
            }
            var $siblings = $target.siblings();
            remove($siblings);
            $target = $target.parent();
        }
    }

    function remove(list) {
        for (var i = 0; i < list.length; ++i) {
            list[i].remove();
        }
    }
})();