Ruan Yifeng's web log (how does http://www.ruanyifeng.com/blog/) detect that advertisements are blocked?

after AdBlock is enabled, the page does not display properly

Sep.08,2021

Adblock uses CSP technology, which does not allow the execution of inline-script, while teacher Ruan uses inline-script to load css files in his blog.

function loadjscssfile(filename, filetype){
    if (filetype=="js"){ //if filename is a external JavaScript file
        var fileref=document.createElement('script')
        fileref.setAttribute("type","text/javascript")
        fileref.setAttribute("src", filename)
    }
    else if (filetype=="css"){ //if filename is an external CSS file
        var fileref=document.createElement("link")
        fileref.setAttribute("rel", "stylesheet")
        fileref.setAttribute("type", "text/css")
        fileref.setAttribute("href", filename)
    }
    if (typeof fileref!="undefined")
        document.getElementsByTagName("head")[0].appendChild(fileref)
}
//loadjscssfile("http://www.ruanyifeng.com/blog/styles.css", "css");
loadjscssfile('/static/themes/theme_scrapbook/theme_scrapbook.css', "css");

http://www.ruanyifeng.com/sta., this css file is not loaded, causing problems with the page style.

...
-sharpcontainer::before {
  display: none;
}
...

there is no detection, but some information is displayed when the advertisement does not come out.
see source code

-sharpcontainer::before {
  display: block;
  width: 100%;
  padding: 10px;
  background: rgba(0,0,0,0.1);
  text-align: center;
  content: "";
}

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3ba0b-2aff0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3ba0b-2aff0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?