|
1 | 1 | <template> |
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 JavaScript error monitoring, alerting, and analytics for developers 🚀</span> |
9 | | - </a> |
10 | | - |
11 | | - <img class="code-sponsor-pixel" :src="pixelHref" /> |
12 | | - </div> |
| 2 | + <md-content class="ad-manager" id="ad-manager" md-theme="docs-dark"> |
| 3 | + <div id="code-fund" class="code-fund"></div> |
13 | 4 | </md-content> |
14 | 5 | </template> |
15 | 6 |
|
16 | 7 | <script> |
17 | | - const isProd = process.env.NODE_ENV === 'production' |
18 | | - const token = '0989e0dbf1919e50f5b34ab00c81fa6f' |
19 | | -
|
20 | 8 | export default { |
21 | 9 | name: 'AdManager', |
22 | | - computed: { |
23 | | - linkHref () { |
24 | | - if (isProd) { |
25 | | - return `https://codesponsor.io/t/c/${token}` |
26 | | - } |
| 10 | + methods: { |
| 11 | + getSponsor () { |
| 12 | + let sponsorUrl = 'https://api.codefund.app/properties/60/funder.html' |
27 | 13 |
|
28 | | - return false |
29 | | - }, |
30 | | - pixelHref () { |
31 | | - if (isProd) { |
32 | | - return `https://codesponsor.io/t/l/${token}/pixel.png` |
| 14 | + if (this.$route.name !== 'home') { |
| 15 | + sponsorUrl += '?theme=light' |
33 | 16 | } |
34 | 17 |
|
35 | | - return false |
| 18 | + this.$http.get(sponsorUrl).then(({ data }) => { |
| 19 | + document.getElementById('code-fund').innerHTML = data; |
| 20 | + }) |
36 | 21 | } |
| 22 | + }, |
| 23 | + mounted () { |
| 24 | + this.getSponsor() |
| 25 | + }, |
| 26 | + updated () { |
| 27 | + this.getSponsor() |
37 | 28 | } |
38 | 29 | } |
39 | 30 | </script> |
|
44 | 35 | $ad-responsive-big: 1690px; |
45 | 36 | $ad-responsive-small: 768px; |
46 | 37 |
|
47 | | - @mixin ad-theme ($hue, $color) { |
48 | | - .code-sponsor { |
49 | | - background: md-get-palette-color(grey, $hue); |
50 | | - .code-sponsor-header { |
51 | | - color: rgba($color, .54); |
52 | | - } |
53 | | - } |
54 | | -
|
55 | | - .code-sponsor-content { |
56 | | - color: rgba($color, .7); |
57 | | - &:hover { |
58 | | - color: $color; |
59 | | - } |
60 | | - } |
61 | | - } |
62 | | -
|
63 | 38 | .ad-manager { |
64 | 39 | width: calc(100% + 32px); |
65 | 40 | margin: 0 -16px -16px; |
|
69 | 44 | } |
70 | 45 | } |
71 | 46 |
|
72 | | - .code-sponsor { |
| 47 | + .code-fund { |
73 | 48 | max-width: 175px; |
74 | | - margin: 7px 16px 24px 16px; |
| 49 | + margin: 0 16px 24px 16px; |
75 | 50 | padding: 8px; |
76 | 51 | display: flex; |
77 | 52 | flex-direction: column; |
|
84 | 59 | @media (min-width: $ad-responsive-big) { |
85 | 60 | margin: 0; |
86 | 61 | position: fixed; |
87 | | - right: 16px; |
88 | | - bottom: 16px; |
| 62 | + top: 80px; |
| 63 | + right: 24px; |
89 | 64 | z-index: 1000; |
90 | 65 | } |
91 | 66 |
|
92 | 67 | @media (max-width: $ad-responsive-small) { |
93 | 68 | max-width: none; |
94 | | - margin-bottom: 16px; |
| 69 | + margin: 8px auto 16px; |
95 | 70 | float: none; |
96 | 71 | } |
97 | 72 |
|
98 | 73 | .splash-container & { |
99 | 74 | @media (max-width: $ad-responsive-big) { |
100 | 75 | max-width: 530px; |
101 | 76 | min-height: 100px; |
102 | | - margin: 8px auto; |
| 77 | + margin: 60px auto 8px; |
103 | 78 | float: none; |
104 | 79 | background: none !important; |
105 | 80 | } |
106 | 81 | } |
107 | 82 | } |
108 | | -
|
109 | | - .code-sponsor-header { |
110 | | - font-size: 11px; |
111 | | - line-height: 1.3em; |
112 | | - } |
113 | | -
|
114 | | - .code-sponsor-content { |
115 | | - margin-top: 1em; |
116 | | - &:hover { |
117 | | - text-decoration: none; |
118 | | - } |
119 | | - } |
120 | | -
|
121 | | - .code-sponsor-name, |
122 | | - .code-sponsor-description { |
123 | | - &:hover { |
124 | | - text-decoration: underline; |
125 | | - } |
126 | | - } |
127 | | -
|
128 | | - .code-sponsor-name { |
129 | | - margin-bottom: .5em; |
130 | | - display: block; |
131 | | - font-weight: 600; |
132 | | - } |
133 | | -
|
134 | | - .code-sponsor-pixel { |
135 | | - width: 1px; |
136 | | - height: 1px; |
137 | | - margin: -1px; |
138 | | - padding: 0; |
139 | | - position: absolute; |
140 | | - overflow: hidden; |
141 | | - clip: rect(0 0 0 0); |
142 | | - border: 0; |
143 | | - } |
144 | | -
|
145 | | - .main-container { |
146 | | - @include ad-theme(200, #000); |
147 | | - } |
148 | | -
|
149 | | - .splash-container { |
150 | | - @media (min-width: $ad-responsive-big) { |
151 | | - @include ad-theme(800, #fff); |
152 | | - } |
153 | | - } |
154 | 83 | </style> |
0 commit comments