Skip to content

Commit 78429be

Browse files
chore: add codesponsor again
1 parent 0a64782 commit 78429be

File tree

2 files changed

+55
-36
lines changed

2 files changed

+55
-36
lines changed

docs/ads.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
<!-- Carbon Ads -->
22
<script async src="//cdn.carbonads.com/carbon.js?zoneid=1673&serve=C6AILKT&placement=vuematerialio" id="_carbonads_js"></script>
33

4+
<!-- Code Sponsor -->
5+
<div class="code-sponsor-widget">
6+
<div id="code-sponsor-widget" class="code-sponsor-widget-frame"></div>
7+
</div>
8+
<script src="https://app.codesponsor.io/scripts/Tuxp4vQN_tThtWBhF8yOtA?theme=light&amp;width=330"></script>
9+
410
<!-- Amazon Pixel -->
511
<img src="//ir-na.amazon-adsystem.com/e/ir?t=vuematerial-20&l=ur2&o=1" class="amazon-pixel" />

docs/app/components/AdManager.vue

Lines changed: 49 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
1-
<template>
2-
<div class="carbon-ads-widget"></div>
3-
</template>
41

52
<script>
63
export default {
74
name: 'AdManager',
5+
abstract: true,
86
data: () => ({
9-
carbonEl: null
7+
carbonEl: null,
8+
codeSponsorEl: null
109
}),
10+
render () {
11+
return null
12+
},
1113
methods: {
1214
saveAdsElements () {
1315
this.carbonEl = document.getElementById('carbonads')
14-
15-
if (!this.carbonEl) {
16+
this.codeSponsorEl = document.querySelector('.code-sponsor-widget')
17+
if (!this.carbonEl || !this.codeSponsorEl) {
1618
this.$destroy()
1719
}
1820
},
@@ -22,17 +24,30 @@
2224
const container = document.querySelector('.container')
2325
const mainContainer = document.querySelector('.main-container')
2426
const splashContainer = document.querySelector('.splash-container')
25-
const adsContainer = document.querySelector('.carbon-ads-widget')
26-
27+
const carbonAdsContainer = document.querySelector('.code-sponsor-widget')
2728
if (carbonAds && container) {
2829
if (splashContainer) {
29-
adsContainer.appendChild(carbonAds)
30+
carbonAdsContainer.appendChild(carbonAds)
3031
} else if (mainContainer) {
3132
mainContainer.insertBefore(carbonAds, mainContainer.firstChild)
3233
} else {
3334
container.insertBefore(carbonAds, container.firstChild)
3435
}
35-
36+
window.clearInterval(interval)
37+
}
38+
}, 50)
39+
},
40+
appendCodeSponsor() {
41+
const interval = window.setInterval(() => {
42+
const carbonAds = document.querySelector('.code-sponsor-widget')
43+
const container = document.querySelector('.container')
44+
const mainContainer = document.querySelector('.main-container')
45+
if (carbonAds && mainContainer) {
46+
if (mainContainer) {
47+
mainContainer.appendChild(carbonAds)
48+
} else {
49+
container.appendChild(carbonAds)
50+
}
3651
window.clearInterval(interval)
3752
}
3853
}, 50)
@@ -41,85 +56,80 @@
4156
if (this.carbonEl) {
4257
document.body.appendChild(this.carbonEl)
4358
}
59+
},
60+
moveCodeSponsorToBody() {
61+
if (this.codeSponsorEl) {
62+
document.body.appendChild(this.codeSponsorEl)
63+
}
4464
}
4565
},
4666
mounted () {
4767
this.saveAdsElements()
4868
this.appendCarbonAds()
69+
this.appendCodeSponsor()
4970
},
5071
beforeDestroy() {
5172
this.moveCarbonAdsToBody()
73+
this.moveCodeSponsorToBody()
5274
}
5375
}
5476
</script>
5577

5678
<style lang="scss">
5779
@import "~vue-material/theme/engine";
58-
5980
$ad-responsive-big: 1670px;
6081
$ad-responsive-small: 600px;
61-
6282
@mixin ad-theme ($hue, $color) {
63-
#carbonads {
83+
#carbonads,
84+
.code-sponsor-widget {
6485
background: md-get-palette-color(grey, $hue);
6586
}
66-
6787
.carbon-wrap a {
6888
color: rgba($color, .7);
69-
7089
&:hover {
7190
color: $color;
7291
}
7392
}
74-
7593
#carbonads .carbon-poweredby {
7694
color: rgba($color, .54);
77-
7895
&:hover {
7996
color: rgba($color, .87);
8097
}
8198
}
8299
}
83-
84100
.main-container {
85101
@include ad-theme(200, #000);
86102
}
87-
88103
.splash-container {
89104
@media (min-width: $ad-responsive-big) {
90105
@include ad-theme(800, #fff);
91106
}
92107
}
93-
94108
#carbonads {
95109
max-width: 162px;
96110
margin: 1em 0 24px 16px;
97111
padding: 16px;
98112
float: right;
99113
position: relative;
100114
z-index: 10;
101-
102115
.splash-container & {
103116
@media (max-width: $ad-responsive-big) {
104117
background: #fff;
105118
}
106119
}
107-
108120
@media (min-width: $ad-responsive-big) {
109121
margin: 0;
110122
position: fixed;
111123
right: 16px;
112124
bottom: 16px;
113125
}
114-
115126
@media (max-width: $ad-responsive-small) {
116127
max-width: none;
117128
min-height: 100px;
118129
margin-left: 0;
119130
padding: 0;
120131
float: none;
121132
}
122-
123133
.splash-container & {
124134
@media (max-width: $ad-responsive-big) {
125135
max-width: none;
@@ -129,64 +139,67 @@
129139
float: none;
130140
}
131141
}
132-
133142
.carbon-wrap {
134143
display: flex;
135144
flex-direction: column;
136145
font-size: 12px;
137-
138146
@media (max-width: $ad-responsive-small) {
139147
display: block;
140148
}
141-
142149
.splash-container & {
143150
@media (max-width: $ad-responsive-big) {
144151
display: block;
145152
}
146153
}
147-
148154
.carbon-img {
149155
@media (max-width: $ad-responsive-small) {
150156
margin-right: 16px;
151157
float: left;
152158
}
153-
154159
.splash-container & {
155160
@media (max-width: $ad-responsive-big) {
156161
margin-right: 16px;
157162
float: left;
158163
}
159164
}
160165
}
161-
162166
.carbon-text {
163167
line-height: 1.5em;
164-
165168
@media (max-width: $ad-responsive-big) {
166169
padding-top: 1em;
167170
padding-right: 16px;
168171
display: block;
169172
}
170-
171173
@media (min-width: $ad-responsive-big) {
172174
margin: 12px 0 8px;
173175
}
174176
}
175-
176177
a {
177178
&:hover {
178179
text-decoration: none;
179180
}
180181
}
181182
}
182-
183183
.carbon-poweredby {
184184
font-size: 11px;
185185
}
186186
}
187-
188-
.carbon-ads-widget {
187+
.code-sponsor-widget {
188+
margin-top: 64px;
189+
padding: 10px;
190+
display: flex;
191+
justify-content: center;
192+
@media (max-width: $ad-responsive-small) {
193+
align-items: center;
194+
flex-direction: column;
195+
}
196+
.splash-container & {
197+
width: calc(100% + 32px);
198+
margin: 0 -16px -16px;
199+
background: #fff;
200+
}
189201
#carbonads {
202+
margin-left: 16px;
190203
@media (max-width: $ad-responsive-small) {
191204
margin-top: 16px;
192205
margin-left: 0;

0 commit comments

Comments
 (0)