my csdn layout

try to change csdn css!

От 08.08.2023. Виж последната версия.

За да инсталирате този скрипт, трябва да имате инсталирано разширение като Tampermonkey, Greasemonkey или Violentmonkey.

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

За да инсталирате този скрипт, трябва да имате инсталирано разширение като Tampermonkey или Violentmonkey.

За да инсталирате този скрипт, трябва да имате инсталирано разширение като Tampermonkey или Userscripts.

За да инсталирате скрипта, трябва да инсталирате разширение като Tampermonkey.

За да инсталирате този скрипт, трябва да имате инсталиран скриптов мениджър.

(Вече имам скриптов мениджър, искам да го инсталирам!)

За да инсталирате този стил, трябва да инсталирате разширение като Stylus.

За да инсталирате този стил, трябва да инсталирате разширение като Stylus.

За да инсталирате този стил, трябва да инсталирате разширение като Stylus.

За да инсталирате този стил, трябва да имате инсталиран мениджър на потребителски стилове.

За да инсталирате този стил, трябва да имате инсталиран мениджър на потребителски стилове.

За да инсталирате този стил, трябва да имате инсталиран мениджър на потребителски стилове.

(Вече имам инсталиран мениджър на стиловете, искам да го инсталирам!)

// ==UserScript==
// @name         my csdn layout
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to change csdn css!
// @author       bo.zou
// @match        https://blog.csdn.net/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=csdn.net
// @grant        none
// @license MIT
// @connect      *
// ==/UserScript==

(function() {
    'use strict';



    // Your code here...
   toHandle()

    function toHandle() {
        var toDeleteElementClass = [ 'toolbar-inside','more-toolbox-new','blog_container_aside','recommend-right_aside','recommendAdBox','csdn-side-toolbar','recommendAdBox','csdn-side-toolbar', 'article-info-box',
                              'column-group', 'recommendNps', 'copyright-box', , 'recommend-nps-box', 'template-box', 'blog-footer-bottom', 'csdn-toolbar']

        for (const e of toDeleteElementClass) {
            deleteElement(e)
        }

        var toClickButtonClass = ['look-more-preCode', 'look-more-preCode']
        for (const e of toClickButtonClass) {
            clickButton(e)
        }
        scroll(-100,0)
        fullScreen()

    }




    // Your function here...
    function deleteElement(className){
        var nodes = document.getElementsByClassName(className);
        if (nodes && nodes[0] && nodes[0].style) {

            nodes[0].setAttribute('style', 'display: none !important');
            nodes[0].parentNode.removeChild(nodes[0]);
            // nodes[0].style.width = 0;
        }
    }
    function clickButton(className){
        var nodes = document.getElementsByClassName(className);
        if (nodes && nodes[0]) {
            for (const node of nodes) {
               node.click()
            }
        }
    }

    function fullScreen() {
        let nodes = document.getElementsByClassName('container');
        if (nodes && nodes[0] && nodes[0].style) {
            nodes[0].setAttribute('style', `width: ${(document.documentElement.clientWidth)/1.6}px !important`);
        }

        var changeSizeElement = ['blog-content-box', 'recommend-box', 'comment-box', 'second-recommend-box', 'recommend-item-box', 'content-box']
        for (const e of changeSizeElement) {
            let nodes = document.getElementsByClassName(e);
            if (nodes && nodes[0] && nodes[0].style) {
                for (const node of nodes){
                    node.setAttribute('style', `width: ${document.documentElement.clientWidth*2/3}px !important`);
                }


            }
        }


    }
})();