diff --git a/docs/docusaurus.config.js b/docs/docusaurus.config.js index cdd690b4..d0d3fc79 100644 --- a/docs/docusaurus.config.js +++ b/docs/docusaurus.config.js @@ -96,7 +96,10 @@ const getConfig = async () => { }, blog: false, theme: { - customCss: [require.resolve('./src/css/custom.css')] + customCss: [ + require.resolve('./src/css/custom.css'), + require.resolve('./src/css/carbon.css') + ] }, gtag: { trackingID: 'G-4RT25NXQ7N', @@ -111,6 +114,13 @@ const getConfig = async () => { ] ], + scripts: [ + { + src: '/js/carbon.js', + async: true + } + ], + themeConfig: /** @type {import('@docusaurus/preset-classic').ThemeConfig} */ ({ diff --git a/docs/sidebars.js b/docs/sidebars.js index e93b90ba..afa86228 100644 --- a/docs/sidebars.js +++ b/docs/sidebars.js @@ -6,6 +6,10 @@ const sidebars = { { type: 'autogenerated', dirName: '.' + }, + { + type: 'html', + value: '' } ] }; diff --git a/docs/src/css/carbon.css b/docs/src/css/carbon.css new file mode 100644 index 00000000..312343e9 --- /dev/null +++ b/docs/src/css/carbon.css @@ -0,0 +1,65 @@ +#carbonads * { + margin: initial; + padding: initial; +} +#carbonads { + display: flex; + max-width: 330px; + background-color: hsl(0, 0%, 98%); + box-shadow: 0 1px 4px 1px hsla(0, 0%, 0%, 0.1); + z-index: 100; +} +#carbonads a { + color: inherit; + text-decoration: none; +} +#carbonads a:hover { + color: inherit; +} +#carbonads span { + position: relative; + display: block; + overflow: hidden; +} +#carbonads .carbon-wrap { + display: flex; +} +#carbonads .carbon-img { + display: block; + margin: 0; + line-height: 1; +} +#carbonads .carbon-img img { + display: block; +} +#carbonads .carbon-text { + font-size: 13px; + padding: 10px; + margin-bottom: 16px; + line-height: 1.5; + text-align: left; +} +#carbonads .carbon-poweredby { + display: block; + padding: 6px 8px; + background: #f1f1f2; + text-align: center; + text-transform: uppercase; + letter-spacing: 0.5px; + font-weight: 600; + font-size: 8px; + line-height: 1; + border-top-left-radius: 3px; + position: absolute; + bottom: 0; + right: 0; +} + +[data-theme='dark'] #carbonads { + background-color: hsl(0, 0%, 35%); + box-shadow: 0 1px 4px 1px hsl(0, 0%, 55%); +} + +[data-theme='dark'] #carbonads .carbon-poweredby { + background-color: hsl(0, 0%, 55%); +} diff --git a/docs/src/css/custom.css b/docs/src/css/custom.css index 34e934dd..bd242147 100644 --- a/docs/src/css/custom.css +++ b/docs/src/css/custom.css @@ -63,6 +63,11 @@ width: 100%; } +#carbonads { + margin-top: 30px; + margin-right: 10px; +} + .gold-sponsors { display: flex; justify-content: center; diff --git a/docs/static/js/.keep b/docs/static/js/.keep deleted file mode 100644 index e69de29b..00000000 diff --git a/docs/static/js/carbon.js b/docs/static/js/carbon.js new file mode 100644 index 00000000..f18744a2 --- /dev/null +++ b/docs/static/js/carbon.js @@ -0,0 +1,29 @@ +(function () { + function attachAd() { + var el = document.createElement('script'); + el.setAttribute('type', 'text/javascript'); + el.setAttribute('id', '_carbonads_js'); + el.setAttribute( + 'src', + '//cdn.carbonads.com/carbon.js?serve=CESI65QJ&placement=taskfiledev' + ); + el.setAttribute('async', 'async'); + + var wrapper = document.getElementById('sidebar-ads'); + wrapper.innerHTML = ''; + wrapper.appendChild(el); + } + + setTimeout(function () { + attachAd(); + + var currentPath = window.location.pathname; + + setInterval(function () { + if (currentPath !== window.location.pathname) { + currentPath = window.location.pathname; + attachAd(); + } + }, 1000); + }, 1000); +})();