Skip to content

Commit 0841867

Browse files
committed
added carbon ads
1 parent c3711af commit 0841867

File tree

2 files changed

+148
-17
lines changed

2 files changed

+148
-17
lines changed
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
<script>
2+
export default {
3+
name: 'CarbonAds',
4+
5+
watch: {
6+
'$route' (to, from) {
7+
if (
8+
to.path !== from.path
9+
// Only reload if the ad has been loaded
10+
// otherwise it's possible that the script is appended but
11+
// the ads are not loaded yet. This would result in duplicated ads.
12+
&& this.$el.querySelector('#carbonads')
13+
) {
14+
this.$el.innerHTML = ''
15+
this.load()
16+
}
17+
}
18+
},
19+
20+
mounted () {
21+
this.load()
22+
},
23+
24+
methods: {
25+
load () {
26+
const s = document.createElement('script')
27+
s.id = '_carbonads_js'
28+
s.src = `//cdn.carbonads.com/carbon.js?serve=CEBITKQJ&placement=jbaysolutionsgithubio`
29+
this.$el.appendChild(s)
30+
}
31+
},
32+
33+
render (h) {
34+
return h('div', { class: 'carbon-ads' })
35+
}
36+
}
37+
</script>
38+
39+
<style lang="stylus">
40+
.carbon-ads
41+
min-height 102px
42+
padding 1.5rem 1.5rem 0
43+
margin-bottom -0.5rem
44+
font-size 0.75rem
45+
a
46+
color #444
47+
font-weight normal
48+
display inline
49+
.carbon-img
50+
float left
51+
margin-right 1rem
52+
border 1px solid $borderColor
53+
img
54+
display block
55+
.carbon-poweredby
56+
color #999
57+
display block
58+
margin-top 0.5em
59+
60+
@media (max-width: $MQMobile)
61+
.carbon-ads
62+
.carbon-img img
63+
width 100px
64+
height 77px
65+
</style>
66+
67+
<!--
68+
<style lang="css">
69+
#carbonads {
70+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu,
71+
Cantarell, "Helvetica Neue", Helvetica, Arial, sans-serif;
72+
}
73+
74+
#carbonads {
75+
display: flex;
76+
max-width: 330px;
77+
background-color: hsl(0, 0%, 98%);
78+
box-shadow: 0 1px 4px 1px hsla(0, 0%, 0%, .1);
79+
}
80+
81+
#carbonads a {
82+
color: inherit;
83+
text-decoration: none;
84+
}
85+
86+
#carbonads a:hover {
87+
color: inherit;
88+
}
89+
90+
#carbonads span {
91+
position: relative;
92+
display: block;
93+
overflow: hidden;
94+
}
95+
96+
#carbonads .carbon-wrap {
97+
display: flex;
98+
}
99+
100+
.carbon-img {
101+
display: block;
102+
margin: 0;
103+
line-height: 1;
104+
}
105+
106+
.carbon-img img {
107+
display: block;
108+
}
109+
110+
.carbon-text {
111+
font-size: 13px;
112+
padding: 10px;
113+
line-height: 1.5;
114+
text-align: left;
115+
}
116+
117+
.carbon-poweredby {
118+
display: block;
119+
padding: 8px 10px;
120+
background: repeating-linear-gradient(-45deg, transparent, transparent 5px, hsla(0, 0%, 0%, .025) 5px, hsla(0, 0%, 0%, .025) 10px) hsla(203, 11%, 95%, .4);
121+
text-align: center;
122+
text-transform: uppercase;
123+
letter-spacing: .5px;
124+
font-weight: 600;
125+
font-size: 9px;
126+
line-height: 1;
127+
}
128+
</style>
129+
-->

website/docs/.vuepress/theme/layouts/Layout.vue

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,30 @@
11
<template>
2-
<ParentLayout>
3-
<!--<template #sidebar-top>
4-
<h2>XXX</h2>
5-
</template>-->
6-
<template #sidebar-bottom>
7-
<footer class="footer">
8-
A product by:
9-
<a href="https://www.jbaysolutions.com/" target="_blank" rel="noopener" class="footer-card">
10-
<img src="assets/img/logo-jbay.png" />
11-
</a>
12-
</footer>
13-
</template>
14-
</ParentLayout>
2+
<ParentLayout>
3+
<template #sidebar-top>
4+
<CarbonAds/>
5+
</template>
6+
<template #sidebar-bottom>
7+
<footer class="footer">
8+
A product by:
9+
<a href="https://www.jbaysolutions.com/" target="_blank" rel="noopener" class="footer-card">
10+
<img src="assets/img/logo-jbay.png"/>
11+
</a>
12+
</footer>
13+
</template>
14+
</ParentLayout>
1515
</template>
1616

1717
<script>
1818
import ParentLayout from '@parent-theme/layouts/Layout.vue'
19+
import CarbonAds from '../components/CarbonAds'
1920
2021
export default {
21-
name: 'Layout',
22+
name: 'Layout',
2223
23-
components: {
24-
ParentLayout,
25-
}
24+
components: {
25+
ParentLayout,
26+
CarbonAds,
27+
}
2628
}
2729
</script>
2830

0 commit comments

Comments
 (0)