wozho

最近CSDN需要登录后才能查看更多内容,有点影响心情

解决方案

添加一段书签

javascript:(function(){document.getElementById(\'article_content\').style.height=\'auto\';document.getElementsByClassName(\'hide-article-box\')[0].style.display=\'none\';}())

在网页里面点一下就行了

进阶版

每次点一下还是有点麻烦,还是使用了一个chorme插件TamperMonkey来自动执行代码,下面的代码隐藏掉一些碍眼的广告和推荐(CSDN自带JQuery)

// ==UserScript==
// @name         BOLCK CSDN
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       WozHuang
// @match        https://blog.csdn.net/*
// @grant        none
// @run-at       document-end
// ==/UserScript==

function rm(elementArray){
    for(let element of elementArray){
        element && element.parentNode.removeChild(element);
        //element.style.display=\'none\';
    }
}

(function() {
    \'use strict\';
    var old_onload = window.onload;
    var temp
    window.onload=function(){
        old_onload && old_onload();
        (function(){
            (temp = document.getElementById(\'article_content\')) && (temp.style.height=\'auto\');
            (temp = document.getElementsByClassName(\'hide-article-box\')[0]) && (temp.style.display=\'none\');
        }())
        rm([
            document.getElementsByClassName(\'adblock\')[0],
            document.getElementById(\'csdn-toolbar\'),
            document.getElementById(\'asideProfile\').parentNode,
            document.getElementsByClassName(\'pulllog-box\')[0],
            document.getElementsByClassName(\'recommend-right\')[0],
            document.getElementsByClassName(\'tool-box\')[0],
            document.getElementsByClassName(\'fourth_column\')[0],
            document.getElementsByClassName(\'comment-box\')[0],
            document.getElementById(\'dmp_ad_58\'),
        ]);
        var main = document.getElementsByTagName(\'main\')[0];
        main && (main.style.float=\'none\');
        main && (main.style.margin=\'0px auto\');
        var $ = window.$;
        if(!$){alert(\'There are no jQuery\');}
        $(function(){
            var rec_box = $(".recommend-box");
            rec_box.css("opacity","0.1");
            rec_box.css("overflow","hidden");
            rec_box.css("height","100px");
        });
        $(".recommend-box").hover(function(){
            $(this).css("opacity","1");
            $(this).css("height","auto");
        },function(){
            $(this).css("opacity","0.1");
        });
    };
})();

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2021-06-07
  • 2021-11-27
  • 2021-11-11
  • 2021-12-13
  • 2021-06-08
  • 2021-12-05
  • 2021-12-23
猜你喜欢
  • 2021-12-24
  • 2022-12-23
  • 2021-05-12
  • 2021-12-20
  • 2021-05-26
  • 2022-01-02
  • 2021-12-24
相关资源
相似解决方案