diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index e2a2563c62..ba88807e2d 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -75,7 +75,7 @@ module.exports = { ['meta', { name: 'apple-mobile-web-app-status-bar-style', content: 'black-translucent' }], ['link', { rel: 'apple-touch-icon', href: '/apple-touch-icon.png' }], ['link', { rel: 'mask-icon', href: '/safari-pinned-tab.svg', color: '#ff8549' }], - ['script', { type: 'text/javascript', src: 'https://cdn.wwads.cn/js/makemoney.js', async: true }], + ['script', { type: 'text/javascript', src: 'https://cdn.wwads.cn/js/makemoney.js' }], ], theme: 'vuepress-theme-rsshub', themeConfig: { diff --git a/docs/.vuepress/theme/layouts/Layout.vue b/docs/.vuepress/theme/layouts/Layout.vue index f7f8a0426c..dba46e8740 100644 --- a/docs/.vuepress/theme/layouts/Layout.vue +++ b/docs/.vuepress/theme/layouts/Layout.vue @@ -1,12 +1,10 @@ @@ -15,6 +13,30 @@ import ParentLayout from '@parent-theme/layouts/Layout.vue' import CarbonAds from '@theme/components/CarbonAds.vue' +window.addEventListener('load', () => { + // function called if wwads is blocked + function ABDetected() { + document.getElementsByClassName("wwads-cn")[0].insertAdjacentHTML("beforeend", "
为了本站的长期运营,请将我们的网站加入广告拦截器的白名单,感谢您的支持!万维广告
"); + }; + + //check document ready + function docReady(t) { + "complete" === document.readyState || + "interactive" === document.readyState + ? setTimeout(t, 1) + : document.addEventListener("DOMContentLoaded", t); + } + + //check if wwads' fire function was blocked after document is ready with 3s timeout (waiting the ad loading) + docReady(function () { + setTimeout(function () { + if( window._AdBlockInit === undefined ){ + ABDetected(); + } + }, 3000); + }); +}) + export default { name: 'Layout',