From: Eduardo San Martin Morote Date: Mon, 31 Jan 2022 14:06:28 +0000 (+0100) Subject: docs: wwads (#1014) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0dabed228f8f86fc45425718c640a191244abc5c;p=thirdparty%2Fvuejs%2Fpinia.git docs: wwads (#1014) --- diff --git a/packages/docs/.vitepress/config.js b/packages/docs/.vitepress/config.js index fd7b00a3..f04ff994 100644 --- a/packages/docs/.vitepress/config.js +++ b/packages/docs/.vitepress/config.js @@ -38,10 +38,7 @@ module.exports = { ['link', { rel: 'icon', type: 'image/svg+xml', href: '/logo.svg' }], ['link', { rel: 'icon', type: 'image/png', href: '/logo.png' }], - [ - 'meta', - { name: 'wwads-cn-verify', content: '5878a7ab84fb43402106c575658472fa' }, - ], + ['script', { src: 'https://cdn.wwads.cn/js/makemoney.js', async: '' }], [ 'meta', diff --git a/packages/docs/.vitepress/theme/Layout.ts b/packages/docs/.vitepress/theme/Layout.ts index 5cb4cc42..c0c8ea35 100644 --- a/packages/docs/.vitepress/theme/Layout.ts +++ b/packages/docs/.vitepress/theme/Layout.ts @@ -7,7 +7,78 @@ import { darkStorageConfig } from '../theme/dark-theme' import { useDark } from '@vueuse/core' export const Layout: FunctionalComponent = () => { + const showWwAds = + typeof navigator !== 'undefined' && + typeof navigator.language === 'string' && + navigator.language.startsWith('zh') + const isDark = useDark(darkStorageConfig) + + const slots = { + 'sidebar-top': () => + h('div', { class: 'sponsors sponsors-top' }, [ + h('span', 'Platinum Sponsors'), + ...(sponsors.platinum.length + ? sponsors.platinum.map(({ href, imgSrcDark, imgSrcLight, alt }) => + h( + 'a', + { + href, + target: '_blank', + rel: 'noopener', + }, + [ + h('img', { + src: isDark.value ? imgSrcDark : imgSrcLight, + alt, + }), + ] + ) + ) + : [ + h( + 'a', + { + class: 'become-sponsor', + href: 'https://github.com/sponsors/posva', + target: '_blank', + rel: 'noopener', + alt: 'Your logo here', + }, + 'Become a Sponsor!' + ), + ]), + ]), + 'sidebar-bottom': () => + h('div', { class: 'sponsors' }, [ + h('span', 'Sponsors'), + ...sponsors.gold.map(({ href, imgSrcDark, imgSrcLight, alt }) => + h( + 'a', + { + href, + target: '_blank', + rel: 'noopener', + }, + [h('img', { src: isDark.value ? imgSrcDark : imgSrcLight, alt })] + ) + ), + ]), + } + + if (showWwAds) { + slots['page-top-ads'] = () => + h('div', { id: 'wwads-container' }, [ + h('div', { + class: 'wwads-cn wwads-vertical', + 'data-id': 114, + style: { + maxWidth: '150px', + }, + }), + ]) + } + return h( Theme.Layout, { @@ -21,57 +92,7 @@ export const Layout: FunctionalComponent = () => { }) }, }, - { - 'sidebar-top': () => - h('div', { class: 'sponsors sponsors-top' }, [ - h('span', 'Platinum Sponsors'), - ...(sponsors.platinum.length - ? sponsors.platinum.map(({ href, imgSrcDark, imgSrcLight, alt }) => - h( - 'a', - { - href, - target: '_blank', - rel: 'noopener', - }, - [ - h('img', { - src: isDark.value ? imgSrcDark : imgSrcLight, - alt, - }), - ] - ) - ) - : [ - h( - 'a', - { - class: 'become-sponsor', - href: 'https://github.com/sponsors/posva', - target: '_blank', - rel: 'noopener', - alt: 'Your logo here', - }, - 'Become a Sponsor!' - ), - ]), - ]), - 'sidebar-bottom': () => - h('div', { class: 'sponsors' }, [ - h('span', 'Sponsors'), - ...sponsors.gold.map(({ href, imgSrcDark, imgSrcLight, alt }) => - h( - 'a', - { - href, - target: '_blank', - rel: 'noopener', - }, - [h('img', { src: isDark.value ? imgSrcDark : imgSrcLight, alt })] - ) - ), - ]), - } + slots ) } diff --git a/packages/docs/.vitepress/theme/custom.css b/packages/docs/.vitepress/theme/custom.css index 331e09a8..ed0a5c6a 100644 --- a/packages/docs/.vitepress/theme/custom.css +++ b/packages/docs/.vitepress/theme/custom.css @@ -211,3 +211,27 @@ code { width: auto; max-width: 150px; } + +#wwads-container { + position: relative; + float: right; + z-index: 9; + margin: 0 0 16px 16px; +} + +#wwads-container .wwads-text { + font-size: 12px; +} + +.page .container .content { + clear: none !important; +} + +@media (min-width: 1368px) { + #wwads-container { + position: fixed; + bottom: 10px; + right: 10px; + margin: 0; + } +} diff --git a/packages/docs/package.json b/packages/docs/package.json index a8620a04..55842252 100644 --- a/packages/docs/package.json +++ b/packages/docs/package.json @@ -10,6 +10,6 @@ "dependencies": { "@vueuse/core": "^7.3.0", "pinia": "^2.0.0-rc.4", - "vitepress": "^0.20.5" + "vitepress": "^0.21.6" } } diff --git a/yarn.lock b/yarn.lock index dd5a93ee..64f334e5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8238,7 +8238,7 @@ verror@1.10.0: core-util-is "1.0.2" extsprintf "^1.2.0" -vite@^2.7.0, vite@^2.7.1: +vite@^2.7.1, vite@^2.7.12: version "2.7.13" resolved "https://registry.yarnpkg.com/vite/-/vite-2.7.13.tgz#99b56e27dfb1e4399e407cf94648f5c7fb9d77f5" integrity sha512-Mq8et7f3aK0SgSxjDNfOAimZGW9XryfHRa/uV0jseQSilg+KhYDSoNb9h1rknOy6SuMkvNDLKCYAYYUMCE+IgQ== @@ -8250,17 +8250,17 @@ vite@^2.7.0, vite@^2.7.1: optionalDependencies: fsevents "~2.3.2" -vitepress@^0.20.5: - version "0.20.10" - resolved "https://registry.yarnpkg.com/vitepress/-/vitepress-0.20.10.tgz#18266182aee192191db76f63b68203eea3ac148d" - integrity sha512-dKgH6k1yxdEjIIxoXGI0vMg3lpBLvMarre/vvt4beuxd+rXOUB1a7DAtXDmgIXOMGQ7IcF+4zyd2132IedhjtQ== +vitepress@^0.21.6: + version "0.21.6" + resolved "https://registry.yarnpkg.com/vitepress/-/vitepress-0.21.6.tgz#aa9e7a597efad607a08a79a020417771bec081c7" + integrity sha512-OzwD2cTfvoK5VKV0UWSqu4XvUOz4vWFJ4Bdi0z8GoVkTFXkfmbFawEDVXAZwzu0Hn4/VLopgmEyooc91iGKFlg== dependencies: "@docsearch/css" "^3.0.0-alpha.41" "@docsearch/js" "^3.0.0-alpha.41" "@vitejs/plugin-vue" "^2.0.0" prismjs "^1.25.0" - vite "^2.7.0" - vue "^3.2.26" + vite "^2.7.12" + vue "^3.2.27" vscode-oniguruma@^1.6.1: version "1.6.1" @@ -8296,7 +8296,7 @@ vue-router@^4.0.12: resolved "https://registry.yarnpkg.com/vue/-/vue-2.6.14.tgz#e51aa5250250d569a3fbad3a8a5a687d6036e235" integrity sha512-x2284lgYvjOMj3Za7kqzRcUSxBboHqtgRE2zlos1qWaOye5yUmHn42LB1250NJBLRwEcdrB0JRwyPTEPhfQjiQ== -vue@^3.2.26: +vue@^3.2.26, vue@^3.2.27: version "3.2.29" resolved "https://registry.yarnpkg.com/vue/-/vue-3.2.29.tgz#3571b65dbd796d3a6347e2fd45a8e6e11c13d56a" integrity sha512-cFIwr7LkbtCRanjNvh6r7wp2yUxfxeM2yPpDQpAfaaLIGZSrUmLbNiSze9nhBJt5MrZ68Iqt0O5scwAMEVxF+Q==