Skip to content

Commit

Permalink
算了,没法插入内嵌广告
Browse files Browse the repository at this point in the history
  • Loading branch information
ForteScarlet committed May 14, 2024
1 parent ccea9a3 commit 7856dc7
Showing 1 changed file with 1 addition and 41 deletions.
42 changes: 1 addition & 41 deletions Writerside/cfg/head-script.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,45 +15,5 @@
</script>

<!-- meta keywords -->
<meta name="keywords" content="Simple Robot, simbot, Simple Robot 4, simbot4, Java, Java11, Kotlin, Kotlin Multiplatform, KMP, Kotlin JVM, Simple Robot v4, bot, forte, ForteScarlet, 法欧特斯卡雷特, 法欧特">
<meta name="keywords" content="Simple Robot, simbot, Simple Robot 4, simbot4, Java, Kotlin, bot, forte, ForteScarlet, 法欧特斯卡雷特, 法欧特">

<style type="text/css">
ins.adsbygoogle[data-ad-status="unfilled"] {
display: none !important;
}
</style>

<script>
/*https://support.google.com/adsense/thread/4144770?hl=en*/
function _addIns() {
const elements = document.getElementsByTagName('article');
if (elements && elements.length > 0) {
const article = elements[0];
const insDiv = document.createElement('div');
insDiv.className = 'adsbygoogle_container';
const ins = document.createElement('ins');
ins.className = 'adsbygoogle';
ins.style.display = 'block';
ins.setAttribute('data-ad-client', 'ca-pub-4062299174917944');
ins.setAttribute('data-ad-slot', 'auto');
ins.setAttribute('data-full-width-responsive', 'true');
// after ins script
const insScript = document.createElement('script');
insScript.innerText = "(adsbygoogle = window.adsbygoogle || []).push({});console.log('ad pushed.');"
insDiv.appendChild(ins);
insDiv.appendChild(insScript);
article.appendChild(insDiv);
}
}

/*横向广告*/
if (!(/Mobi|Android|iPhone/i.test(navigator.userAgent))) {
// 当前设备不是移动设备
window.addEventListener('load', (event) => {
try {
_addIns();
} catch(e) {console.log(e);}
});
}

</script>

0 comments on commit 7856dc7

Please sign in to comment.