The phenomenon of

After installing the AdBlock Plus plugin, this is what happens when you access CSDN…



Before or click “read more” after the jump, now directly forced to jump, I erase…

Although using ABP is not very kind to you CSDN, but you don’t have to be so cruel…

I can’t take this ocD anymore!


strategy

1. Capture the package, search for the source code, and check when the pop-up box is executed



! function () {    var c, e;
    function t() {        console.log("AdBlock is not enabled")}function n() {        var c, e, t;        console.log("Adblock is enabled"), c = "adblock", e = {            step: "install"        }, t = window.location.protocol + "//statistic.csdn.net/", $.get(t + c, e);        var n;
        function o(c, e) {            var t = document.createElement("div");            t.innerHTML = c;            var n = document.body.firstChild;            document.body.insertBefore(t, n), e && "function"= =typeof e && e()        }

        (function (c) {            for (var e, t, n = document.cookie.split("; "), o = 0; o < n.length; o++)                if (n[o] && (e = n[o].split("="))0] === c) {                    t = e[1];                    break                }            return t        })("UserName") || o('
      
+ To continue reading the full article, please add the CSDN website to the ADP< BR /> whitelist or log on to the website. (< span id = "check - adblock - time" > < / span > 3 seconds automatically jump) < a href = "https://passport.csdn.net/account/login" class = "login" > login < / a >
'
, setInterval(function () { var c = $("#check-adblock-time").text(); c = parseInt(c), 0 < --c ? $("#check-adblock-time").text(c) : location.href = "https://passport.csdn.net/account/login" }, 1e3)), o('< div class = "adblock" > < img SRC = "https://g.csdnimg.cn/check-adblock/1.0.0/img/[email protected]" / > < span > dear customer, you use the AD blocking software, Advertising is an important support for CSDN to provide you with free services and products. Hope you will join csdn.net AdBlock Plus < a class = "check_a" href = "https://bbs.csdn.net/topics/392458005" target = "_blank" > white list < / a >, thanks for support! < SVG t="1539053811268" class="icon" style="" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="7199" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" Height ="200"> ') and $(".check_close").length && $(".check_close").on("click".function (c) { c.stopPropagation(), $(this).parents(".adblock").remove(), "function"= =typeof window.csdn.insertcallbackBlock && window.csdn.insertcallbackBlock() }), (n = new Date).setDate(n.getDate() + 7), document.cookie = "c_adb=1; expires=" + n.toGMTString() + "; domain=csdn.net; path=/"."function"= =typeof window.csdn.insertcallbackBlock && window.csdn.insertcallbackBlock() } if (void 0= = =window.csdn && (window.csdn = {}), c = "https://g.csdnimg.cn/check-adblock/1.1.1/css/check-adblock.css", (e = document.createElement("link")).rel = "stylesheet", e.type = "text/css", e.href = c, document.getElementsByTagName("head") [0].appendChild(e), "undefined"! =typeof fuckAdBlock || "undefined"! =typeof FuckAdBlock) n(); else { var o = document.createElement("script"); o.onload = function () { fuckAdBlock.onDetected(n), fuckAdBlock.onNotDetected(t) }, o.onerror = function () { n() }, o.type = "text/javascript", o.src = "https://g.csdnimg.cn/lib/fuckadblock/3.2.1/fuckadblock.min.js".document.head.appendChild(o) }}(); Copy the code

Testing steps

  1. Fuckadblock checks if ABP is enabled and registers two callbacks (enabled and not enabled detected)
  2. If enabled is detected
  3. Obtain the local Cookie and check whether UserName exists to confirm whether the user is logged in
  4. If the user is not logged in, perform function o
  5. Pop up and force to jump to the login page after x seconds

2. How to solve it?

I tried to hack into the fuckadblock, but later I decided it wasn’t necessary, this code was useless anyway… Let’s just let him enforce errors! What’s the easiest way to do it? It’s window.setInterval so we’ll leave it at that…

window.setInterval = null;Copy the code

Hee hee, anyway to see a page so that does not affect the other, right ~ incidentally that “read more” also stands in the way, then again

document.getElementById('article_content').style.height = ' ';
Copy the code

Hey hey! That’s all it takes, right

When will this code be executed? How do you do that? We can’t open the TAB manually either. Just put the code on the console.

In fact, you can do it with a Chrome plugin!

However, if writing a native Chrome plugin takes time and effort, we can use a third-party script manager (Tampermonkey) to do this for us. It is very easy to get started. For details about how to write Tampermonkey scripts, see the official documentation.



// ==UserScript==
// @name         CSDN
// @namespace
// @version      0.1
// @description
// @author       nannongrousong
// @match        https://blog.csdn.net/*
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    window.setInterval = null;
    window.onload = () => {
        document.getElementById('article_content').style.height = ' ';
    }
})();
Copy the code


This is a simple script that will execute automatically every time you open the CSDN Blog page