diff --git a/src/.vuepress/config.js b/src/.vuepress/config.js
index 620537f225..1045fe4336 100644
--- a/src/.vuepress/config.js
+++ b/src/.vuepress/config.js
@@ -417,6 +417,11 @@ module.exports = {
indexName: 'vuejs-v3',
appId: 'BH4D9OD16A',
apiKey: 'bc6e8acb44ed4179c30d0a45d6140d3f'
+ },
+ carbonAds: {
+ carbon: 'CEBDT27Y',
+ custom: 'CKYD62QM',
+ placement: 'vuejsorg'
}
},
plugins: [
diff --git a/src/.vuepress/theme/components/BuySellAds.vue b/src/.vuepress/theme/components/BuySellAds.vue
new file mode 100644
index 0000000000..17df4bd167
--- /dev/null
+++ b/src/.vuepress/theme/components/BuySellAds.vue
@@ -0,0 +1,115 @@
+
+
+
+
+
+
+
diff --git a/src/.vuepress/theme/components/CarbonAds.vue b/src/.vuepress/theme/components/CarbonAds.vue
new file mode 100644
index 0000000000..c9c8f1f7f9
--- /dev/null
+++ b/src/.vuepress/theme/components/CarbonAds.vue
@@ -0,0 +1,85 @@
+
+
+
+
+
+
+
diff --git a/src/.vuepress/theme/layouts/Layout.vue b/src/.vuepress/theme/layouts/Layout.vue
index 990da117c3..b5780ce39b 100644
--- a/src/.vuepress/theme/layouts/Layout.vue
+++ b/src/.vuepress/theme/layouts/Layout.vue
@@ -5,7 +5,11 @@
@touchstart="onTouchStart"
@touchend="onTouchEnd"
>
-
+
@@ -23,9 +27,21 @@
+
+
@@ -38,6 +54,8 @@ import Navbar from '@theme/components/Navbar.vue'
import Page from '@theme/components/Page.vue'
import Sidebar from '@theme/components/Sidebar.vue'
import VueMasteryBanner from '@theme/components/sponsors/VueMasteryBanner.vue'
+import BuySellAds from '@theme/components/BuySellAds.vue'
+import CarbonAds from '@theme/components/CarbonAds.vue'
import { resolveSidebarItems } from '../util'
export default {
@@ -48,13 +66,15 @@ export default {
Page,
Sidebar,
Navbar,
- VueMasteryBanner
+ VueMasteryBanner,
+ BuySellAds,
+ CarbonAds
},
- data () {
+ data() {
return {
isSidebarOpen: false,
- isBannerOpen: true,
+ isBannerOpen: true,
isMenuFixed: false,
nameStorage: 'vuemastery-black-firday-2020-banner',
menuPosition: 0
@@ -62,7 +82,7 @@ export default {
},
computed: {
- shouldShowNavbar () {
+ shouldShowNavbar() {
const { themeConfig } = this.$site
const { frontmatter } = this.$page
if (frontmatter.navbar === false || themeConfig.navbar === false) {
@@ -77,7 +97,7 @@ export default {
)
},
- shouldShowSidebar () {
+ shouldShowSidebar() {
const { frontmatter } = this.$page
return (
!frontmatter.home &&
@@ -86,7 +106,7 @@ export default {
)
},
- sidebarItems () {
+ sidebarItems() {
return resolveSidebarItems(
this.$page,
this.$page.regularPath,
@@ -95,7 +115,7 @@ export default {
)
},
- pageClasses () {
+ pageClasses() {
const userPageClass = this.$page.frontmatter.pageClass
return [
{
@@ -107,10 +127,14 @@ export default {
},
userPageClass
]
+ },
+
+ adsConfig() {
+ return this.$site.themeConfig.carbonAds
}
},
- mounted () {
+ mounted() {
this.$router.afterEach(() => {
this.isSidebarOpen = false
})
@@ -124,20 +148,20 @@ export default {
},
methods: {
- toggleSidebar (to) {
+ toggleSidebar(to) {
this.isSidebarOpen = typeof to === 'boolean' ? to : !this.isSidebarOpen
this.$emit('toggle-sidebar', this.isSidebarOpen)
},
// side swipe
- onTouchStart (e) {
+ onTouchStart(e) {
this.touchStart = {
x: e.changedTouches[0].clientX,
y: e.changedTouches[0].clientY
}
},
- onTouchEnd (e) {
+ onTouchEnd(e) {
const dx = e.changedTouches[0].clientX - this.touchStart.x
const dy = e.changedTouches[0].clientY - this.touchStart.y
if (Math.abs(dx) > Math.abs(dy) && Math.abs(dx) > 40) {
@@ -161,7 +185,7 @@ export default {
this.isMenuFixed = this.isUnderBanner()
},
- closeBanner (e) {
+ closeBanner(e) {
// Remove events
this.toggleBannerEvents(false)
// Hide the banner
@@ -192,10 +216,26 @@ export default {
toggleBannerEvents(on) {
// Add or remove event listerners attached to the DOM
- let method = on ? "addEventListener" : "removeEventListener"
- window[method]("resize", this.getMenuPosition)
- window[method]("scroll", this.fixMenuAfterBanner)
+ let method = on ? 'addEventListener' : 'removeEventListener'
+ window[method]('resize', this.getMenuPosition)
+ window[method]('scroll', this.fixMenuAfterBanner)
}
}
}
+
+