CSDN博客

专注阅读CSDN博客主要内容

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==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();
        }
    }
})();