Skip to content

Commit 6598efd

Browse files
committed
docs: update website scripts configuration
1 parent 50c60b1 commit 6598efd

File tree

4 files changed

+70
-6
lines changed

4 files changed

+70
-6
lines changed

docs/docusaurus.config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,14 @@ const config = {
3434
src: 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-7420210265158247',
3535
async: true,
3636
},
37+
// {
38+
// src: 'https://securepubads.g.doubleclick.net/tag/js/gpt.js',
39+
// async: true,
40+
// },
41+
{
42+
src: '/js/gpt.js',
43+
async: true,
44+
},
3745
],
3846

3947
presets: [

docs/src/theme/TOC/index.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,24 @@
1+
// import React, { useEffect } from 'react'
12
import React from 'react'
23
import TOC from '@theme-original/TOC'
34

5+
// import styles from './index.module.css'
6+
7+
// const AdsContainerElement = ({ id }) => {
8+
// useEffect(() => {
9+
// if (typeof window !== 'undefined') {
10+
// window.dispatchEvent(new CustomEvent('AdsContainerMounted', { detail: { id } }))
11+
// }
12+
// }, [])
13+
14+
// return <div id={id} className={styles.adsContainer} />
15+
// }
16+
417
export default function TOCWrapper(props) {
518
return (
619
<>
720
<TOC {...props} />
8-
<script
9-
async
10-
src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-7420210265158247"
11-
crossOrigin="anonymous"
12-
/>
21+
{/* <AdsContainerElement id="right-sidebar-ads" /> */}
1322
<ins
1423
className="adsbygoogle"
1524
style={{ display: 'block' }}
@@ -18,7 +27,6 @@ export default function TOCWrapper(props) {
1827
data-ad-format="auto"
1928
data-full-width-responsive="true"
2029
/>
21-
<script>(adsbygoogle = window.adsbygoogle || []).push({});</script>
2230
</>
2331
)
2432
}

docs/src/theme/TOC/index.module.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
.adsContainer {
3+
position: sticky;
4+
top: calc(3.75rem + 12rem);
5+
width: 300px;
6+
height: 250px;
7+
}

docs/static/js/gpt.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
window.onload = () => {
2+
;(window.adsbygoogle = window.adsbygoogle || []).push({})
3+
}
4+
5+
// window.reactTooltipAds = {
6+
// initialized: {},
7+
// }
8+
// window.googletag = window.googletag || { cmd: [] }
9+
10+
// window.googletag.cmd.push(function () {
11+
// window.googletag
12+
// .defineSlot('/6355419/Travel/Europe/France/Paris', [300, 250], 'right-sidebar-ads')
13+
// .addService(window.googletag.pubads())
14+
// window.googletag.enableServices()
15+
// })
16+
17+
// const handleLoadAds = (event) => {
18+
// const { id } = event.detail
19+
20+
// if (window.innerWidth < 1024) {
21+
// return
22+
// }
23+
24+
// console.log('loading ads for container: ', id)
25+
// window.googletag.cmd.push(function () {
26+
// if (window.reactTooltipAds.initialized[id]) {
27+
// window.googletag.cmd.push(function () {
28+
// window.googletag.pubads().refresh()
29+
// })
30+
31+
// window.googletag.display(id)
32+
// } else {
33+
// window.googletag.display(id)
34+
// window.reactTooltipAds.initialized[id] = true
35+
// }
36+
37+
// console.log('displayed: ', id)
38+
// })
39+
// }
40+
41+
// window.addEventListener('AdsContainerMounted', handleLoadAds)

0 commit comments

Comments
 (0)