<script> function GetRandomNum(Min,Max) { var Range = Max - Min; var Rand = Math.random(); return(Min + Math.round(Rand * Range)); }
function setSidebarMarginTop (headerOffset) { return $('#sidebar').css({ 'margin-top': headerOffset }); }
function getHeaderOffset () { return $('.header-inner').height() + CONFIG.sidebar.offset; }
window.onload=function(){ var subtitle = "{{config.subtitles}}"; var mytitle = subtitle.split(","); var max = mytitle.length-1; var index = GetRandomNum(0,max); var text = mytitle[index]; $(".site-subtitle").html(text); var headOffset = getHeaderOffset(); setSidebarMarginTop(headOffset); } </script>
<script> // Function called if AdBlock is not detected function adBlockNotDetected() { // console.log('AdBlock check is ok'); } // Function called if AdBlock is detected function adBlockDetected() { for ( i=0; i<document.styleSheets.length; i++) { void(document.styleSheets.item(i).disabled=true); } alert('本站显示不正常,可能因为您使用了广告拦截器。'); }
// We look at whether FuckAdBlock already exists. if(typeof fuckAdBlock !== 'undefined' || typeof FuckAdBlock !== 'undefined') { // If this is the case, it means that something tries to usurp are identity // So, considering that it is a detection adBlockDetected(); } else { // Otherwise, you import the script FuckAdBlock var importFAB = document.createElement('script'); importFAB.onload = function() { // If all goes well, we configure FuckAdBlock fuckAdBlock.onDetected(adBlockDetected) // fuckAdBlock.onNotDetected(adBlockNotDetected); }; importFAB.onerror = function() { // If the script does not load (blocked, integrity error, ...) // Then a detection is triggered adBlockDetected(); }; importFAB.integrity = 'sha256-xjwKUY/NgkPjZZBOtOxRYtK20GaqTwUCf7WYCJ1z69w='; importFAB.crossOrigin = 'anonymous'; importFAB.src = 'https://cdnjs.cloudflare.com/ajax/libs/fuckadblock/3.2.1/fuckadblock.min.js'; document.head.appendChild(importFAB); } </script>