|
1 | 1 | <template> |
2 | | - <md-content id="ad-manager" md-theme="default"></md-content> |
| 2 | + <md-content class="ad-manager" id="ad-manager" md-theme="default"> |
| 3 | + <div id="code-sponsor" class="code-sponsor"> |
| 4 | + <span class="code-sponsor-header">Vue Material is proudly sponsored by:</span> |
| 5 | + |
| 6 | + <a :href="linkHref" class="code-sponsor-content" target="_blank" rel="noopener"> |
| 7 | + <strong class="code-sponsor-name">Rollbar</strong> |
| 8 | + <span class="code-sponsor-description">Real-time error monitoring, alerting, and analytics for developers 🚀</span> |
| 9 | + </a> |
| 10 | + |
| 11 | + <img class="code-sponsor-pixel" :src="pixelHref" /> |
| 12 | + </div> |
| 13 | + </md-content> |
3 | 14 | </template> |
4 | 15 |
|
5 | 16 | <script> |
| 17 | + const isProd = process.env.NODE_ENV === 'production' |
| 18 | + const token = 'bb9dade0-0207-4ab0-8c86-d00502d952f5' |
| 19 | +
|
6 | 20 | export default { |
7 | 21 | name: 'AdManager', |
8 | | - data: () => ({ |
9 | | - carbonEl: null |
10 | | - }), |
11 | | - render () { |
12 | | - return null |
13 | | - }, |
14 | | - methods: { |
15 | | - saveAdsElements () { |
16 | | - this.carbonEl = document.getElementById('carbonads') |
17 | | -
|
18 | | - if (!this.carbonEl) { |
19 | | - this.$destroy() |
| 22 | + computed: { |
| 23 | + linkHref () { |
| 24 | + if (isProd) { |
| 25 | + return `https://cs.berry.sh/c/${token}` |
20 | 26 | } |
21 | 27 | }, |
22 | | - appendCarbonAds () { |
23 | | - const interval = window.setInterval(() => { |
24 | | - const carbonAds = document.getElementById('carbonads') |
25 | | - const container = document.querySelector('.container') |
26 | | - const pageContainer = document.querySelector('.page-container') |
27 | | - const splashContainer = document.querySelector('.splash-container') |
28 | | - const adManager = this.$el |
29 | | -
|
30 | | - if (carbonAds && container) { |
31 | | - if (pageContainer) { |
32 | | - pageContainer.insertBefore(carbonAds, pageContainer.firstChild) |
33 | | - } else if (splashContainer && adManager) { |
34 | | - adManager.appendChild(carbonAds) |
35 | | - } else { |
36 | | - container.insertBefore(carbonAds, container.firstChild) |
37 | | - } |
38 | | -
|
39 | | - window.clearInterval(interval) |
40 | | - } |
41 | | - }, 50) |
42 | | - }, |
43 | | - moveCarbonAdsToBody () { |
44 | | - if (this.carbonEl) { |
45 | | - document.body.appendChild(this.carbonEl) |
| 28 | + pixelHref () { |
| 29 | + if (isProd) { |
| 30 | + return `https://cs.berry.sh/l/${token}/pixel.png` |
46 | 31 | } |
47 | 32 | } |
48 | | - }, |
49 | | - mounted () { |
50 | | - this.saveAdsElements() |
51 | | - this.appendCarbonAds() |
52 | | - }, |
53 | | - beforeDestroy () { |
54 | | - this.moveCarbonAdsToBody() |
55 | 33 | } |
56 | 34 | } |
57 | 35 | </script> |
58 | 36 |
|
59 | | -<style lang="scss"> |
| 37 | +<style lang="scss" scoped> |
60 | 38 | @import "~vue-material/theme/engine"; |
61 | 39 |
|
62 | | - $ad-responsive-big: 1670px; |
63 | | - $ad-responsive-small: 600px; |
| 40 | + $ad-responsive-big: 1690px; |
| 41 | + $ad-responsive-small: 768px; |
64 | 42 |
|
65 | 43 | @mixin ad-theme ($hue, $color) { |
66 | | - #carbonads { |
| 44 | + .code-sponsor { |
67 | 45 | background: md-get-palette-color(grey, $hue); |
68 | 46 |
|
69 | | - .carbon-poweredby { |
| 47 | + .code-sponsor-header { |
70 | 48 | color: rgba($color, .54); |
71 | | -
|
72 | | - &:hover { |
73 | | - color: rgba($color, .87); |
74 | | - } |
75 | 49 | } |
76 | 50 | } |
77 | 51 |
|
78 | | - .carbon-wrap a { |
| 52 | + .code-sponsor-content { |
79 | 53 | color: rgba($color, .7); |
80 | 54 |
|
81 | 55 | &:hover { |
|
84 | 58 | } |
85 | 59 | } |
86 | 60 |
|
87 | | - .main-container { |
88 | | - @include ad-theme(200, #000); |
89 | | - } |
| 61 | + .ad-manager { |
| 62 | + width: calc(100% + 32px); |
| 63 | + margin: 0 -16px -16px; |
90 | 64 |
|
91 | | - .splash-container { |
92 | | - @media (min-width: $ad-responsive-big) { |
93 | | - @include ad-theme(800, #fff); |
| 65 | + @media (max-width: $ad-responsive-small) { |
| 66 | + display: flex; |
94 | 67 | } |
95 | 68 | } |
96 | 69 |
|
97 | | - #carbonads { |
98 | | - max-width: 162px; |
99 | | - margin: 1em 0 24px 16px; |
100 | | - padding: 16px; |
| 70 | + .code-sponsor { |
| 71 | + max-width: 175px; |
| 72 | + margin: 7px 16px 24px 16px; |
| 73 | + padding: 8px; |
| 74 | + display: flex; |
| 75 | + flex-direction: column; |
101 | 76 | float: right; |
102 | 77 | position: relative; |
103 | 78 | z-index: 10; |
104 | | -
|
105 | | - .splash-container & { |
106 | | - @media (max-width: $ad-responsive-big) { |
107 | | - background: #fff; |
108 | | - } |
109 | | - } |
| 79 | + font-size: 12px; |
| 80 | + line-height: 1.5em; |
110 | 81 |
|
111 | 82 | @media (min-width: $ad-responsive-big) { |
112 | 83 | margin: 0; |
|
117 | 88 |
|
118 | 89 | @media (max-width: $ad-responsive-small) { |
119 | 90 | max-width: none; |
120 | | - min-height: 100px; |
121 | | - margin-left: 0; |
122 | | - padding: 0; |
| 91 | + margin-bottom: 16px; |
123 | 92 | float: none; |
124 | 93 | } |
125 | 94 |
|
126 | 95 | .splash-container & { |
127 | 96 | @media (max-width: $ad-responsive-big) { |
128 | | - max-width: none; |
| 97 | + max-width: 530px; |
129 | 98 | min-height: 100px; |
130 | | - margin-left: 0; |
131 | | - padding: 0; |
| 99 | + margin: 8px auto; |
132 | 100 | float: none; |
| 101 | + background: none !important; |
133 | 102 | } |
134 | 103 | } |
| 104 | + } |
135 | 105 |
|
136 | | - .carbon-wrap { |
137 | | - display: flex; |
138 | | - flex-direction: column; |
139 | | - font-size: 12px; |
140 | | -
|
141 | | - @media (max-width: $ad-responsive-small) { |
142 | | - display: block; |
143 | | - } |
144 | | -
|
145 | | - .splash-container & { |
146 | | - @media (max-width: $ad-responsive-big) { |
147 | | - display: block; |
148 | | - } |
149 | | - } |
150 | | -
|
151 | | - .carbon-img { |
152 | | - @media (max-width: $ad-responsive-small) { |
153 | | - margin-right: 16px; |
154 | | - float: left; |
155 | | - } |
156 | | -
|
157 | | - .splash-container & { |
158 | | - @media (max-width: $ad-responsive-big) { |
159 | | - margin-right: 16px; |
160 | | - float: left; |
161 | | - } |
162 | | - } |
163 | | - } |
164 | | -
|
165 | | - .carbon-text { |
166 | | - line-height: 1.5em; |
167 | | -
|
168 | | - @media (max-width: $ad-responsive-big) { |
169 | | - padding-top: 1em; |
170 | | - padding-right: 16px; |
171 | | - display: block; |
172 | | - } |
| 106 | + .code-sponsor-header { |
| 107 | + font-size: 11px; |
| 108 | + line-height: 1.3em; |
| 109 | + } |
173 | 110 |
|
174 | | - @media (min-width: $ad-responsive-big) { |
175 | | - margin: 12px 0 8px; |
176 | | - } |
177 | | - } |
| 111 | + .code-sponsor-content { |
| 112 | + margin-top: 1em; |
178 | 113 |
|
179 | | - a { |
180 | | - &:hover { |
181 | | - text-decoration: none; |
182 | | - } |
183 | | - } |
| 114 | + &:hover { |
| 115 | + text-decoration: none; |
184 | 116 | } |
| 117 | + } |
185 | 118 |
|
186 | | - .carbon-poweredby { |
187 | | - font-size: 11px; |
| 119 | + .code-sponsor-name, |
| 120 | + .code-sponsor-description { |
| 121 | + &:hover { |
| 122 | + text-decoration: underline; |
188 | 123 | } |
189 | 124 | } |
190 | 125 |
|
191 | | - #ad-manager { |
192 | | - width: calc(100% + 32px); |
193 | | - margin: 0 -16px -16px; |
| 126 | + .code-sponsor-name { |
| 127 | + margin-bottom: .5em; |
| 128 | + display: block; |
| 129 | + font-weight: 600; |
| 130 | + } |
194 | 131 |
|
195 | | - #carbonads { |
196 | | - @media (max-width: $ad-responsive-big) { |
197 | | - max-width: 530px; |
198 | | - margin: 24px auto; |
199 | | - } |
| 132 | + .code-sponsor-pixel { |
| 133 | + width: 1px; |
| 134 | + height: 1px; |
| 135 | + margin: -1px; |
| 136 | + padding: 0; |
| 137 | + position: absolute; |
| 138 | + overflow: hidden; |
| 139 | + clip: rect(0 0 0 0); |
| 140 | + border: 0; |
| 141 | + } |
| 142 | +
|
| 143 | + .main-container { |
| 144 | + @include ad-theme(200, #000); |
| 145 | + } |
| 146 | +
|
| 147 | + .splash-container { |
| 148 | + @media (min-width: $ad-responsive-big) { |
| 149 | + @include ad-theme(800, #fff); |
200 | 150 | } |
201 | 151 | } |
202 | 152 | </style> |
0 commit comments